Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Rx Java introduction
Search
SingaSUG
July 29, 2015
Technology
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Rx Java introduction
Talk from Xavier Lepretre
SingaSUG
July 29, 2015
More Decks by SingaSUG
See All by SingaSUG
Java/Spring and Node.JS side by side
singasug
0
250
Migrating to microservices (Carlos Queiroz)
singasug
0
250
Docker 101 - Mario Loriedo
singasug
0
320
Docker for Java/Spring developers
singasug
0
110
Cloud Foundry and Docker
singasug
0
250
Multi dimensional scaling with CouchBase
singasug
1
160
NoSql presentation from Clarence Tauro
singasug
2
220
Spring Websockets
singasug
0
250
migrating from JSP to AngularJS
singasug
0
2.7k
Other Decks in Technology
See All in Technology
インバスケット試験対策アプリを 作って見えたAIエージェント構築 ナレッジ2選
shichijoyuhi
1
110
【ゲームメーカーズスクランブル2026】『Shadowverse: Worlds Beyond』UIとアニメーションで実現する最高のユーザー体験を叶えるプロトタイピング
cygames
PRO
1
710
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
16
120k
MCPゲートウェイを作って運用してわかったこと — Agent時代の権限管理の現在地
mtpooh
10
2.6k
[2026 Oracle Technical Deep Dive] AI時代のデータベース基盤をどう選ぶ? Exadata Database Serviceの選択肢と使い分け (2026年9月17日開催)
oracle4engineer
PRO
0
150
OSC2026on_the-world-is-waiting-for-your-voice.pdf
naruoga
0
180
HacobuにおけるFDEとは/登壇資料(戸井田 裕貴)
hacobu
PRO
1
700
Lambda MicroVMsが分からなすぎたので使い所を1から考えてみた
tsukuboshi
2
290
企業の現実世界をグラフで写し取る
sansantech
PRO
0
240
検証フェーズはAIの回答を判断するための学習機会
toru_kubota
2
220
セルフサービスのオブザーバビリティ基盤をOpenTelemetryで作る / Building a Self-Service Observability Platform with OpenTelemetry
ymotongpoo
3
500
Apache Iceberg が拓く AI 時代のオープンレイクハウス
tomtanaka
0
210
Featured
See All Featured
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
510
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
750
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
520
Facilitating Awesome Meetings
lara
57
7.2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
The Curious Case for Waylosing
cassininazir
1
550
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
600
For a Future-Friendly Web
brad_frost
183
10k
Darren the Foodie - Storyboard
khoart
PRO
4
4k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
270
Transcript
RxJava Intro Functional reactive programming By Xavier Lepretre
What we want What we know
Imperative and synchronous var a = fetch(key); var b =
transform(a); var c = transformAgain(b); return process(c);
Asynchronous with callbacks fetch(key, new Callback() { void onReceived(a) {
transform(a, new Callback() { void onFinished(b) ... }); } });
Futures future = executor.submit(new Callback() { Object call() { return
doLongExecution(); } }); a = future.get();
Nice to have, workflow description When done, do that fetch(key).then(a
-> transform(a)) .then(b -> transformAgain(b)) .then(c -> process(c)) .then(d -> use(d));
Important classes
Observable<MyType> - like an object(s) pipe - no limit on
number of objects piped - also pipes Throwable - signals when no more object, completed - can have many observers, like a multicast
Observer<MyType> - will receive: - the objects - the errors
- the completed signal - can subscribe to many observables
Subscription - a handle to an observer subscribed to an
observable - call .unsubscribe() when you no longer need to receive
Action1<MyType> { void call(MyType obj); } - 1 because it
takes 1 parameter - There are Action2 … Action9
Func1<MyType, NextType> { public NextType call(MyType obj); } - 1
because it takes 1 parameter - There are Func2 … Func9
Important operations
.map(new Func1<A,B>(){}) - works on an object traveling along the
pipe - transforms from one type to another - to be used when the transformation is synchronous - example: convert
None
.doOnNext(new Action1<A>(){}) - Works on a object from the pipe
- Leaves the object unchanged - Example: save in cache, log
None
.flatMap(Func1<A, Observable<B>>) - Works on an object traveling along the
pipe - Transforms from one type to another - To be used when the transformation is asynchronous - Example: network fetch, open dialog
None
Advantages - Unsubscription handles removing callback - Method can describe
a subset of workflow
Create your own: OnSubscribe<> - Change callbacks into objects in
pipeline - Know when to call onCompleted() - subscribeOn() - Subscriptions.create() - AndroidSubscriptions. unsubscribeInUiThread
Pitfalls - Forgot to .subscribe() - subscriptionList.unsubscribe(). Do not reuse
- forgot observeOn(AndroidSchedulers. mainThread()) - callbacks may not show as used if you use retrolambda
Code Example https://github.com/xavierlepretre/rx-example
- All code shown is on client - Retrofit creates
Observables -
- workflow pieces in methods: for dialog, no need to
know next step - .onErrorResumeNext() to avoid break on less important elements - .flatMap() to show and wait for dialog - .publish() and .connect() to share Observable - SimpleAlertDialogOperator to convert a dialog into Observable