Rx Challenge #10 (Solution): DistinctUntilChanged with expiration period

Friday, September 2, 2016

Rx Challenge #10 (Solution): DistinctUntilChanged with expiration period The solution for the DistinctUntilChanged challenge is: Code Snippet public static IObservable<TSource> DistinctUntilChanged<TSource, TKey, TPeriod>(     this IObservable<TSource> source,     Func<TSource, TKey> keySelector,     IEqualityComparer<TKey> comparer,     IObservable<TPeriod> distinctPeriod) {     var result = source.Publish(hot =>     {         var distinct = hot.TakeUntil(distinctPeriod)                           .DistinctUntilChanged(keySelector, comparer)                           .Repeat();         return distinct;     });     return result; }   The idea is to cancel the district stream after a period and resume the subscription (repeat).   You can use the following convenient overloads: Code Snippet public static IObservable<TSource> DistinctUntilChanged<TSource>(     this IObservable<TSource>...

Rx Challenge #9: Execute Async Until [Solution]

Tuesday, August 30, 2016

Rx Challenge #9: Execute Async Until Challenge #9 was about implementing a pattern where you have to keep sending async message until you will get notification which approve that the message is handled by the other side. see the full detail at the Challenge at this post. Simple scenario For the simple scenario of you calling service and retry sending, according to it’s response. You can use the following pattern. Code Snippet private static async Task VerySimpleScenario() {     var delay = Observable.Timer(TimeSpan.FromSeconds(1));     var noDelay = Observable.Return(1L);     var xs = Observable.FromAsync(() => ExecSimpleAsync(1))...

Rx Challenge #10: DistinctUntilChanged with expiration period

Friday, August 19, 2016

Rx Challenge #10: DistinctUntilChanged with expiration period This challenge is DistinctUntilChanged  cancellation after a period. When having event stream which may produce items in a row and then be idle for a period. You may want to get item after a period even those it identical the the previous one.   On challenge you need to construct it using composition of existing Rx’s operators. It can be formulate into the following pattern: Code Snippet public static IObservable<T> DistinctUntilChanged<T>(     this IObservable<T> source,     TimeSpan distinctPeriod) {     // TODO: your code }   ...
no comments

Rx Challenge #9: Execute Async Until

Tuesday, August 16, 2016

Rx Challenge #9: Execute Async Until This time the challenge is for implementing a pattern where you have to keep sending async message until you will get notification which approve that the message is handled by the other side. The idea is to verify that the message was handled by other side without keeping open connection and waiting for response (which already implement by the TCP protocol). This pattern can be useful on many scenarios, For example, any queue mechanism like Service Bus, Rabbit MQ, etc. Using this pattern you can keep sending the message using predefine interval...

Visual Rx is having new Home and future plans

Tuesday, August 2, 2016

.Visual Rx is having new Home and future plans Visual Rx is having new Home under GitHub. It had moved from CodePlex to GitHub and will be maintain on GitHub. The plans for Visual Rx future is to start new version from scratch. This version will have the following characteristic: - Support .NET Core. - Better organized. - API improvements. - Support more communication client out of the box. - Have Angular 2 viewer. After setting the foundation for this version I will post call for the community to join the effort. The final target of Visual Rx (if...

Visual Rx 3.0.0

Wednesday, July 20, 2016

Visual Rx compatible with Rx 3.0.0 is available at NuGet. The client side can be download from here. When you open the viewer make sure you run it with administrator privilege, otherwise it won’t start. It need this level of trust because it open WCF hosting.
2 comments

Awaiting RX

Saturday, November 21, 2015

Awaiting RX this post discuss the meaning of awaiting RX stream. many languages including .NET embrace the concept of async / await. async / await on .NET is usually refer to Task, but Task in not the only await-able type in .net, in matter of fact there is a few type which can be awaited, one of those type is IObservable.   what happens when you’re awaiting IObservable? When awaiting IObservable the await schedule on completion and resume with the last value. for example: Code Snippet int i = await Observable.Range(0,...
one comment

Challenge Quick Access (Links)

Friday, July 17, 2015

this is a quick access page to the Challenges Challenge #1: Buffer On Time, Count and Custom Trigger  http://blogs.microsoft.co.il/bnaya/2015/01/27/rx-challenge/ #2: Avoid Overlaps http://blogs.microsoft.co.il/bnaya/2015/02/05/rx-challenge-2/ #3: Suspend on faults throttle http://blogs.microsoft.co.il/bnaya/2015/03/06/rx-challenge-3/ #4: Create message from spitted chunks http://blogs.microsoft.co.il/bnaya/2015/03/25/rx-challenge-4/ #5: Exception Safe-Point http://blogs.microsoft.co.il/bnaya/2015/04/03/rx-challenge-5/ #6: Weak subscription  http://blogs.microsoft.co.il/bnaya/2015/04/10/rx-challenge-6/ #7: Where Async http://blogs.microsoft.co.il/bnaya/2015/07/11/rx-challenge-7/ #8: Suspend Buffering and flush http://blogs.microsoft.co.il/bnaya/2015/07/24/rx-challenge-8/ #9: Execute Async Until http://blogs.microsoft.co.il/bnaya/2016/08/16/rx-challenge-9-execute-async-until/ #10: DistinctUntilChanged with expiration period http://blogs.microsoft.co.il/bnaya/2016/08/19/rx-challenge-10-distinctuntilchanged-with-expiration-period/ #11: Semaphore Wait Async Like http://blogs.microsoft.co.il/bnaya/2016/09/08/rx-challenge-11/ #12: Task.Delay http://blogs.microsoft.co.il/bnaya/2017/04/14/task-delay-challenge/   Solutions #1: Buffer On Time, Count and Custom Trigger http://blogs.microsoft.co.il/bnaya/2015/01/31/rx-challenge-solution/ #2: Avoid Overlaps  http://blogs.microsoft.co.il/bnaya/2015/02/09/rx-challenge-2-solution/...
3 comments