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
240
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
Claude Code本って、 読む必要あるの?
oikon48
2
490
Von-Neumann Machines, Dreams & The Futures of IT
ufried
0
110
AIで社員の自主発信に広報目線を組み込む
_mossann_t
0
130
技術的負債から考える、AI時代のエンジニアリング投資 — ビズリーチの技術的負債と向き合った経験から、変更し続けられるソフトウェアを考える/ technical-debt-con2026
visional_engineering_and_design
4
3.3k
.NET WebAssemblyで実現するクライアントサイドAI推論:NuGetからViteまで、2つのエコシステムを繋ぐビルド戦略
yamachu
0
260
Goodbye ShellScript, Hello File-based App
shunsock
0
430
品質と信頼性を地続きにする
grimoh
2
830
AIによるクリエイティブ生成を行う上での試行錯誤
plaidtech
PRO
0
160
登壇の自信を奪う3匹のオバケ / 3 Ghosts That Rob You of Your Confidence in Public Speaking
pauli
9
1k
AIエージェントを最高のパートナーに育てる方法|評価と判断軸を育てる5つのステップ
koichiaoki
1
150
Slack上でインフラをトラブルシュートする! Agentic Platform Engineeringの第一歩
teru0x1
5
1.8k
ユーザー価値を届け続けるためにウォンテッドリーが大切にしている文化
kotaminato
0
180
Featured
See All Featured
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
440
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
2
2.9k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Unsuck your backbone
ammeep
672
58k
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.6k
Skip the Path - Find Your Career Trail
mkilby
1
230
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
250
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
530
How to Think Like a Performance Engineer
csswizardry
28
2.8k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
Navigating Team Friction
lara
192
16k
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