reactive extensions, rx
TRANSCRIPT
![Page 1: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/1.jpg)
Reactive Extensions“democratize cloud”
Dima Pasko
![Page 2: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/2.jpg)
about me
Kharkiv – Ciklum (Scale Point) - .NET – podcasts – open source
![Page 3: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/3.jpg)
Erik MeijerProfessor at Utrecht
UniversityOne of the designers
of HaskellMicrosoft Architect LINQVoltaRx
![Page 4: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/4.jpg)
Rx mission“Rx is a library for composing
asynchronous and event-based programs using observable collections.”
![Page 5: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/5.jpg)
Rx current version• Base interfaces in BCL .NET 4 and
WP7• Stable version: v1.0.10621
Experimental Release: v1.1.11011 Last update: October 12, 2011
• http://msdn.microsoft.com/en-us/data/gg577609
![Page 6: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/6.jpg)
Rx for.NET
.NET 3.5 SP1 .NET 4 .NET Framework 4.5 (with Metro support
on Windows 8 Developer Preview)
Silverlight Silverlight 4 Silverlight 5 Windows Phone
Java script
![Page 7: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/7.jpg)
“asynchronous”
![Page 8: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/8.jpg)
“observable”interface IEnumerable<out T>{ IEnumerator<T> GetEnumerator();}
interface IEnumerator<out T> : IDisposable{ bool MoveNext(); T Current { get; } void Reset();}
interface IObservable<out T>{ IDisposable Subscribe(IObserver<T> observer);}
interface IObserver<in T>{ void OnNext(T value); void OnError(Exception ex); void OnCompleted();}
![Page 9: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/9.jpg)
Environment
MoveN
ex
tGot next?
Application
On
Next
Have next!
IEnumerable<T>
IEnumerator<T>
IObservable<T>
IObserver<T>
Inte
racti
ve R
eactiv
e
![Page 10: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/10.jpg)
IDisposableinterface IObservable<out T>{ IDisposable Subscribe(IObserver<T> observer);}
interface IObserver<in T>{ void OnNext(T value); void OnError(Exception ex); void OnCompleted();}
![Page 11: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/11.jpg)
demo #1Simple example
![Page 12: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/12.jpg)
exception handlingObservable.Catch()
Observable.Throw()Observable.Retry()Observable.Timeout()
![Page 13: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/13.jpg)
demo #2Exception handling
![Page 14: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/14.jpg)
“composing”• Linq(Where, Take, Skip, Sum, Max,
Any, …)• Statements(If, Case, For, While,
DoWhile)• Combinators(Merge, Zip, Amb, …)• Exceptions(Catch, Retry, ..)• Rx(Delay, Throttle, Interval, Publish,
…)
![Page 15: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/15.jpg)
“event-based”Observable.FromEventPattern()Observable.FromAsyncEventPattern()
![Page 16: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/16.jpg)
ISchedulerObservable.OnserveOn()Observable.SubscribeOn(Scheduler.Tas
kPool)
![Page 17: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/17.jpg)
demo #3Big demo!!!
![Page 18: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/18.jpg)
Rx unit testing
![Page 19: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/19.jpg)
more RxRx Contrib
http://rxcontrib.codeplex.com/ Reactive Extensions - Extensions (Rxx)
http://rxx.codeplex.com/ Rx Power Toys
http://rxpowertoys.codeplex.com/
![Page 20: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/20.jpg)
examples
![Page 21: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/21.jpg)
ReactiveUI
http://www.reactiveui.net/
![Page 22: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/22.jpg)
“Anna”
http://github.com/jfromaniello/Anna
![Page 23: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/23.jpg)
domain events
http://chaliy.name/archive/2010/1/business_logic_rx_example
![Page 24: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/24.jpg)
TweetSharp.Rx
https://github.com/jhollingworth/TweetSharp.Rx
![Page 25: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/25.jpg)
Rx in books
Programming Reactive Extensions and LINQJesse Liberty, Paul Betts
http://www.amazon.com/Programming-Reactive-Extensions-Jesse-Liberty/dp/1430237473/
![Page 26: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/26.jpg)
out of scope• Hot&Cold• Marble diagrams• IQbservable<T>
(IQueryable<T> + IObservable<T>)
• ISubject, Subject<T>• ReactiveJS• ….
![Page 27: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/27.jpg)
informationRx team blog
http://blogs.msdn.com/rxteamDevLabs
http://msdn.microsoft.com/en-us/data/gg577609MSDN forums
http://social.msdn.microsoft.com/Forums/en-US/rxChannel9
http://channel9.msdn.com/Tags/RxWiki
http://rxwiki.wikidot.com Examples
http://rxworkshop.codeplex.com/
![Page 28: Reactive Extensions, Rx](https://reader035.vdocuments.us/reader035/viewer/2022062312/554ebebeb4c905064d8b47a0/html5/thumbnails/28.jpg)
summary