Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Rx 101
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Matt Stasch
June 26, 2015
Programming
0
860
Rx 101
Introduction to Reactive Extensions
Matt Stasch
June 26, 2015
Tweet
Share
More Decks by Matt Stasch
See All by Matt Stasch
Monads in .NET
mat3u
0
460
HATEOAS dla ludzi!
mat3u
0
520
Architektura, która pomaga!
mat3u
0
610
Domain Events - czyli jak radzić sobie z rzeczywistością!
mat3u
1
920
F# 101
mat3u
0
810
Prosta architektura dla nieprostego systemu
mat3u
1
830
Other Decks in Programming
See All in Programming
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
1.1k
ネイティブアプリとWebフロントエンドのAPI通信ラッパーにおける共通化の勘所
suguruooki
0
210
Claude Code Skill入門
mayahoney
0
440
Fundamentals of Software Engineering In the Age of AI
therealdanvega
2
300
Symfony + NelmioApiDocBundle を使った スキーマ駆動開発 / Schema Driven Development with NelmioApiDocBundle
okashoi
0
240
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
160
ファインチューニングせずメインコンペを解く方法
pokutuna
0
210
Codex の「自走力」を高める
yorifuji
0
1.3k
安いハードウェアでVulkan
fadis
1
830
飯MCP
yusukebe
0
390
Rethinking API Platform Filters
vinceamstoutz
0
2.2k
「効かない!」依存性注入(DI)を活用したAPI Platformのエラーハンドリング奮闘記
mkmk884
0
270
Featured
See All Featured
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
270
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
600
Believing is Seeing
oripsolob
1
97
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
160
A better future with KSS
kneath
240
18k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
150
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
170
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
120
Building an army of robots
kneath
306
46k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
150
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
230
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
310
Transcript
Introduction to Rx Mateusz Stasch
2 1 N (-> ∞) Synchronous T IEnumerable<T> Iterable<T> Asynchronous
Task<T> Future<T> Promise<T> IObservable<T> Observable<T>
3 IObservable<T> IObserver<T>
4 IObservable<T> IObserver<T> public interface IObservable<out T> { IDisposable Subscribe(IObserver<T>
observer); } public interface IObserver<in T> { void OnCompleted(); void OnError(Exception error); void OnNext(T value); }
5 IObservable<T> IObserver<T> public interface IObservable<out T> { IDisposable Subscribe(IObserver<T>
observer); } public interface IObserver<in T> { void OnCompleted(); void OnError(Exception error); void OnNext(T value); }
6 IObservable<T> events.Throttle(TimeSpan.FromMilliseconds(100)) .Select(e => HandleDeviceConnDiscon(e.EventArgs)) .Subscribe(v => Console.WriteLine("2: {0}",
v));
7 IObservable<T> IObserver<T> subscribe
8 IObservable<T> IObserver<T> subscribe onNext
9 IObservable<T> IObserver<T> subscribe onNext / onCompleted
10 IObservable<T> IObserver<T> subscribe onNext onError
11 IObservable<T> IObserver<T> subscribe onNext unsubscribe
12 Demo
13 IObservable<T> IObserver<T> subscribe onNext onError
14 IObservable<T> IObserver<T> subscribe onNext onError ObserveOn(Scheduler)
15 IObservable<T> IObserver<T> subscribe onNext onError ObserveOn(Scheduler)
16 IObservable<T> IObserver<T> subscribe onNext onError SubscribeOn(Scheduler)
17 IObservable<T> IObserver<T> subscribe onNext onError SubscribeOn(Scheduler)
18 IObservable<T> IObserver<T> subscribe onNext onError SubscribeOn(Scheduler)
19 Rx will pick a default scheduler by using the
principle of least concurrency… https://msdn.microsoft.com/en-us/library/hh242963(v=vs.103).aspx
20 Schedulers CurrentThread Immediate TaskPool ThreadPool
NewThread
21 Schedulers CurrentThread Immediate TaskPool ThreadPool
NewThread Actor-Model Timers Own implementations
22 Demo
23 var sequence = new Subject<int>(); Console.WriteLine("Next line should lock
the system."); var value = sequence.First(); sequence.OnNext(1); Console.WriteLine("I can never execute....");
24 http://reactivex.io/ http://reactivex.io/documentation/operators/combinelatest.html
25 https://gist.github.com/staltz/868e7e9bc2a7b8c1f754 http://reactivex.io/ http://reactivex.io/tutorials.html http://www.introtorx.com/
Naming Convention http://onoffswitch.net/rxjava-observables-akka-actors/ Bibliography