Rx: Materialize() – Stream Notifcations


Jeffery’s posting offer some insight in to what you can do with Materialize(). Using the Materialize() I can inspect the stream and handle any error without having to pass an Action though the various layer within an application:


public static IObservable CheckForErrorInStream(this IObservable source, Action action)
{
   return source.Materialize().Select(n =>
      {
         if (n.Kind == NotificationKind.OnError)
         {
            var error = (Notification.OnError) n;
            action(error.Exception);
          }
       return n;
   }).Dematerialize();
}

~ by mdavey on January 29, 2010.

One Response to “Rx: Materialize() – Stream Notifcations”

  1. Awesome Article. Hope to read more from you!

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.