SlideShare a Scribd company logo
1 of 32
Download to read offline
Panta rhei
by Tomasz Kowalczewski
Reactive Java in practice
EXAMPLES REPOSITORY
https://github.com/tkowalcz/rx-java-pantha-rhei
REACTIVE, ASYNCHRONOUS
People has been doing it for years
(Re)invented time and again by big companies
and/or in high performance products
Now every company may need to operate at
that scale
As users demand more and faster we need
tools to do it right
SYNCHRONOUS DESIGN
List<String> tweets = client.getNextTweets();
List<Tweet> validTweets = Lists.newArrayList();
for (String jsonTweet : tweets) {

Tweet tweet = gson.fromJson(jsonTweet, Tweet.class);
Image image;
image = download(tweet.getUser().getProfileImage());
Tweet.setImage(image);


if (tweet.isValidTweet()) {
validTweets.add(tweet);
}
}
DECOMPOSING INDIVIDUAL OPERATIONS
List<String> tweets = client.getNextTweets();
List<Tweet> validTweets = Lists.newArrayList();
for (String jsonTweet : tweets) {

Tweet tweet = gson.fromJson(jsonTweet, Tweet.class);
Image image;
image = download(tweet.getUser().getProfileImage());
Tweet.setImage(image);


if (tweet.isValidTweet()) {
validTweets.add(tweet);
}
}
DECOMPOSING INDIVIDUAL OPERATIONS
List<String> tweets = client.getNextTweets();
List<Tweet> validTweets = Lists.newArrayList();
for (String jsonTweet : tweets) {

Tweet tweet = gson.fromJson(jsonTweet, Tweet.class);
Image image;
image = download(tweet.getUser().getProfileImage());
Tweet.setImage(image);


if (tweet.isValidTweet()) {
validTweets.add(tweet);
}
}
DECOMPOSING INDIVIDUAL OPERATIONS
List<String> tweets = client.getNextTweets();
List<Tweet> validTweets = Lists.newArrayList();
for (String jsonTweet : tweets) {

Tweet tweet = gson.fromJson(jsonTweet, Tweet.class);
Image image;
image = download(tweet.getUser().getProfileImage());
Tweet.setImage(image);


if (tweet.isValidTweet()) {
validTweets.add(tweet);
}
}
DECOMPOSING INDIVIDUAL OPERATIONS
List<String> tweets = client.getNextTweets();
List<Tweet> validTweets = Lists.newArrayList();
for (String jsonTweet : tweets) {

Tweet tweet = gson.fromJson(jsonTweet, Tweet.class);
Image image;
image = download(tweet.getUser().getProfileImage());
Tweet.setImage(image);


if (tweet.isValidTweet()) {
validTweets.add(tweet);
}
}
DECOMPOSING INDIVIDUAL OPERATIONS
List<String> tweets = client.getNextTweets();
List<Tweet> validTweets = Lists.newArrayList();
for (String jsonTweet : tweets) {

Tweet tweet = gson.fromJson(jsonTweet, Tweet.class);
Image image;
image = download(tweet.getUser().getProfileImage());
Tweet.setImage(image);


if (tweet.isValidTweet()) {
validTweets.add(tweet);
}
}
WHAT IS MISSING?
List<String> tweets = client.getNextTweets();
List<Tweet> validTweets = Lists.newArrayList();
for (String jsonTweet : tweets) {

Tweet tweet = gson.fromJson(jsonTweet, Tweet.class);
Image image;
image = download(tweet.getUser().getProfileImage());
Tweet.setImage(image);


if (tweet.isValidTweet()) {
validTweets.add(tweet);
}
}
Error
handling
Timeouts
Monitoring
Logging
Back pressure
Parallelism
SYNCHRONOUS DESIGN
List<String> tweets = client.getNextTweets();
List<Tweet> validTweets = Lists.newArrayList();
for (String jsonTweet : tweets) {
Tweet tweet = gson.fromJson(jsonTweet, Tweet.class);
Image image;
image = download(tweet.getUser().getProfileImage());
Tweet.setImage(image);
if (tweet.isValidTweet()) {
validTweets.add(tweet);
}
}
WHAT IS MISSING?
List<String> tweets = client.getNextTweets();
List<Tweet> validTweets = Lists.newArrayList();
for (String jsonTweet : tweets) {

Tweet tweet = gson.fromJson(jsonTweet, Tweet.class);
Image image;
image = download(tweet.getUser().getProfileImage());
Tweet.setImage(image);


if (tweet.isValidTweet()) {
validTweets.add(tweet);
}
}
Error
handling
Timeouts
Monitoring
Logging
Back pressure
Parallelism
STREAMS (ELEMENTS + TIME)
[" ", " ", " ", " ", " "]
T1 T2 T3 T4 T5
SUBSCRIBE, MAP, FILTER
[" ", " ", " ", " ", " "]
subscribe
SUBSCRIBE, MAP, FILTER
[" ", " ", " ", " ", " "]
[ , , , , ]
map
subscribe
SUBSCRIBE, MAP, FILTER
[" ", " ", " ", " ", " "]
[ , , , , ]
[ , , ]
map
filter
subscribe
Reactive flow
t
subscribe
onNext*
onCompleted | onError
unsubscribe
just(1, 1, 2, 3, 5, 8, 13).filter(i -> i % 2 != 0)
// 1, 1, 3, 5, 13
just(1, 1, 2, 3, 5, 8, 13).map(i -> i * 2)
// 2, 2, 4, 6, 10, 16, 26
Exercise 1a: filter, map
Exercise 1b: take, error handling
Subscriptions flow
map
filter
source
…
subscribe
subscribe
subscribe
subscribe
subscribe onNext
onNext
onNext
onNext
subscribeOn
If subscription should be 

made on a different thread
observeOn
If notifications should be 

made on a different thread

(e.g. UI thread)
Exercise 2: Observable::create
just([1], [1], [2, 3], [5], [], [13])
.flatMap(arr -> just(arr))
// 1, 1, 2, 3, 5, 13
Exercise 3: basic flatMap
Exercise 4: flatMap & async
Exercise 5: error handling
Exercise 6: cache
Exercise 7: testing
Exercise 8a: subjects
?
Exercise 8a: subjects
Exercise 8b: combineLatest
Backpressure
AVAILABLE IN A LANGUAGE OR FRAMEWORK NEAR YOU
FURTHER READING
Examples from this presentation
https://github.com/tkowalcz/rx-java-pantha-rhei
Reactive Java project
https://github.com/Netflix/RxJava
Other reactive projects
http://reactivex.io/
http://rxmarbles.com/
http://davesexton.com/blog/post/To-Use-Subject-Or-
Not-To-Use-Subject.aspx
https://speakerdeck.com/dlew/reactive-extensions-
beyond-the-basics

More Related Content

Viewers also liked

Digipak analysis-Bon Iver, Bon Iver
Digipak analysis-Bon Iver, Bon Iver Digipak analysis-Bon Iver, Bon Iver
Digipak analysis-Bon Iver, Bon Iver
mollygracethea
 

Viewers also liked (13)

эффект выпрямления сроков
эффект выпрямления сроковэффект выпрямления сроков
эффект выпрямления сроков
 
[4developers2016] - Taking advantage of microservice architecture and DynamoD...
[4developers2016] - Taking advantage of microservice architecture and DynamoD...[4developers2016] - Taking advantage of microservice architecture and DynamoD...
[4developers2016] - Taking advantage of microservice architecture and DynamoD...
 
Digipak analysis-Bon Iver, Bon Iver
Digipak analysis-Bon Iver, Bon Iver Digipak analysis-Bon Iver, Bon Iver
Digipak analysis-Bon Iver, Bon Iver
 
Knowledge organiztion
Knowledge organiztionKnowledge organiztion
Knowledge organiztion
 
Cotação de seguros online de veículos
Cotação  de  seguros online de veículos Cotação  de  seguros online de veículos
Cotação de seguros online de veículos
 
Lisosomas y generalidades.
Lisosomas y generalidades.Lisosomas y generalidades.
Lisosomas y generalidades.
 
Project chater
Project chaterProject chater
Project chater
 
Premiere "Disney" Audition
Premiere "Disney" AuditionPremiere "Disney" Audition
Premiere "Disney" Audition
 
Oficinas de Inverno
Oficinas de InvernoOficinas de Inverno
Oficinas de Inverno
 
primera guerra
primera guerraprimera guerra
primera guerra
 
«От малых носимых устройств к построению больших софтверных экосистем и серви...
«От малых носимых устройств к построению больших софтверных экосистем и серви...«От малых носимых устройств к построению больших софтверных экосистем и серви...
«От малых носимых устройств к построению больших софтверных экосистем и серви...
 
Aprendizaje autonomo
Aprendizaje autonomoAprendizaje autonomo
Aprendizaje autonomo
 
«Кроссплатформенная разработка мобильных приложений для бизнеса» Александр Еп...
«Кроссплатформенная разработка мобильных приложений для бизнеса» Александр Еп...«Кроссплатформенная разработка мобильных приложений для бизнеса» Александр Еп...
«Кроссплатформенная разработка мобильных приложений для бизнеса» Александр Еп...
 

Similar to JDD2015: Panta rhei or Reactive Java in practice - Tomasz Kowalczewski

Dtsn devnest9
Dtsn devnest9Dtsn devnest9
Dtsn devnest9
Angus Fox
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of us
OSCON Byrum
 

Similar to JDD2015: Panta rhei or Reactive Java in practice - Tomasz Kowalczewski (20)

Deep dive reactive java (DevoxxPl)
Deep dive reactive java (DevoxxPl)Deep dive reactive java (DevoxxPl)
Deep dive reactive java (DevoxxPl)
 
Who needs MVVM? Architecture components & MVP - Timor Surkis, Colu
Who needs MVVM? Architecture components & MVP - Timor Surkis, ColuWho needs MVVM? Architecture components & MVP - Timor Surkis, Colu
Who needs MVVM? Architecture components & MVP - Timor Surkis, Colu
 
Oleksandr Tolstykh
Oleksandr TolstykhOleksandr Tolstykh
Oleksandr Tolstykh
 
Appcelerator titanium
Appcelerator titaniumAppcelerator titanium
Appcelerator titanium
 
droidparts
droidpartsdroidparts
droidparts
 
Creating a Facebook Clone - Part XXIX - Transcript.pdf
Creating a Facebook Clone - Part XXIX - Transcript.pdfCreating a Facebook Clone - Part XXIX - Transcript.pdf
Creating a Facebook Clone - Part XXIX - Transcript.pdf
 
Creating a Facebook Clone - Part XXXVIII - Transcript.pdf
Creating a Facebook Clone - Part XXXVIII - Transcript.pdfCreating a Facebook Clone - Part XXXVIII - Transcript.pdf
Creating a Facebook Clone - Part XXXVIII - Transcript.pdf
 
Dtsn devnest9
Dtsn devnest9Dtsn devnest9
Dtsn devnest9
 
SQLite 周りのテストをしよう
SQLite 周りのテストをしようSQLite 周りのテストをしよう
SQLite 周りのテストをしよう
 
Android crashcourse
Android crashcourseAndroid crashcourse
Android crashcourse
 
React Native - Workshop
React Native - WorkshopReact Native - Workshop
React Native - Workshop
 
JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"
 
Android Threading
Android ThreadingAndroid Threading
Android Threading
 
Getting Started with Real-Time Analytics
Getting Started with Real-Time AnalyticsGetting Started with Real-Time Analytics
Getting Started with Real-Time Analytics
 
Bar graph
Bar graphBar graph
Bar graph
 
Big Data for each one of us
Big Data for each one of usBig Data for each one of us
Big Data for each one of us
 
Palestra - Utilizando tensorflow mobile e seus desafios
Palestra - Utilizando tensorflow mobile e seus desafiosPalestra - Utilizando tensorflow mobile e seus desafios
Palestra - Utilizando tensorflow mobile e seus desafios
 
Finding Clojure
Finding ClojureFinding Clojure
Finding Clojure
 
Easy REST APIs with Jersey and RestyGWT
Easy REST APIs with Jersey and RestyGWTEasy REST APIs with Jersey and RestyGWT
Easy REST APIs with Jersey and RestyGWT
 
React for Re-use: Creating UI Components with Confluence Connect
React for Re-use: Creating UI Components with Confluence ConnectReact for Re-use: Creating UI Components with Confluence Connect
React for Re-use: Creating UI Components with Confluence Connect
 

Recently uploaded

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 

Recently uploaded (20)

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 

JDD2015: Panta rhei or Reactive Java in practice - Tomasz Kowalczewski

  • 1. Panta rhei by Tomasz Kowalczewski Reactive Java in practice
  • 3. REACTIVE, ASYNCHRONOUS People has been doing it for years (Re)invented time and again by big companies and/or in high performance products Now every company may need to operate at that scale As users demand more and faster we need tools to do it right
  • 4. SYNCHRONOUS DESIGN List<String> tweets = client.getNextTweets(); List<Tweet> validTweets = Lists.newArrayList(); for (String jsonTweet : tweets) {
 Tweet tweet = gson.fromJson(jsonTweet, Tweet.class); Image image; image = download(tweet.getUser().getProfileImage()); Tweet.setImage(image); 
 if (tweet.isValidTweet()) { validTweets.add(tweet); } }
  • 5. DECOMPOSING INDIVIDUAL OPERATIONS List<String> tweets = client.getNextTweets(); List<Tweet> validTweets = Lists.newArrayList(); for (String jsonTweet : tweets) {
 Tweet tweet = gson.fromJson(jsonTweet, Tweet.class); Image image; image = download(tweet.getUser().getProfileImage()); Tweet.setImage(image); 
 if (tweet.isValidTweet()) { validTweets.add(tweet); } }
  • 6. DECOMPOSING INDIVIDUAL OPERATIONS List<String> tweets = client.getNextTweets(); List<Tweet> validTweets = Lists.newArrayList(); for (String jsonTweet : tweets) {
 Tweet tweet = gson.fromJson(jsonTweet, Tweet.class); Image image; image = download(tweet.getUser().getProfileImage()); Tweet.setImage(image); 
 if (tweet.isValidTweet()) { validTweets.add(tweet); } }
  • 7. DECOMPOSING INDIVIDUAL OPERATIONS List<String> tweets = client.getNextTweets(); List<Tweet> validTweets = Lists.newArrayList(); for (String jsonTweet : tweets) {
 Tweet tweet = gson.fromJson(jsonTweet, Tweet.class); Image image; image = download(tweet.getUser().getProfileImage()); Tweet.setImage(image); 
 if (tweet.isValidTweet()) { validTweets.add(tweet); } }
  • 8. DECOMPOSING INDIVIDUAL OPERATIONS List<String> tweets = client.getNextTweets(); List<Tweet> validTweets = Lists.newArrayList(); for (String jsonTweet : tweets) {
 Tweet tweet = gson.fromJson(jsonTweet, Tweet.class); Image image; image = download(tweet.getUser().getProfileImage()); Tweet.setImage(image); 
 if (tweet.isValidTweet()) { validTweets.add(tweet); } }
  • 9. DECOMPOSING INDIVIDUAL OPERATIONS List<String> tweets = client.getNextTweets(); List<Tweet> validTweets = Lists.newArrayList(); for (String jsonTweet : tweets) {
 Tweet tweet = gson.fromJson(jsonTweet, Tweet.class); Image image; image = download(tweet.getUser().getProfileImage()); Tweet.setImage(image); 
 if (tweet.isValidTweet()) { validTweets.add(tweet); } }
  • 10. WHAT IS MISSING? List<String> tweets = client.getNextTweets(); List<Tweet> validTweets = Lists.newArrayList(); for (String jsonTweet : tweets) {
 Tweet tweet = gson.fromJson(jsonTweet, Tweet.class); Image image; image = download(tweet.getUser().getProfileImage()); Tweet.setImage(image); 
 if (tweet.isValidTweet()) { validTweets.add(tweet); } } Error handling Timeouts Monitoring Logging Back pressure Parallelism
  • 11. SYNCHRONOUS DESIGN List<String> tweets = client.getNextTweets(); List<Tweet> validTweets = Lists.newArrayList(); for (String jsonTweet : tweets) { Tweet tweet = gson.fromJson(jsonTweet, Tweet.class); Image image; image = download(tweet.getUser().getProfileImage()); Tweet.setImage(image); if (tweet.isValidTweet()) { validTweets.add(tweet); } }
  • 12. WHAT IS MISSING? List<String> tweets = client.getNextTweets(); List<Tweet> validTweets = Lists.newArrayList(); for (String jsonTweet : tweets) {
 Tweet tweet = gson.fromJson(jsonTweet, Tweet.class); Image image; image = download(tweet.getUser().getProfileImage()); Tweet.setImage(image); 
 if (tweet.isValidTweet()) { validTweets.add(tweet); } } Error handling Timeouts Monitoring Logging Back pressure Parallelism
  • 13. STREAMS (ELEMENTS + TIME) [" ", " ", " ", " ", " "] T1 T2 T3 T4 T5
  • 14. SUBSCRIBE, MAP, FILTER [" ", " ", " ", " ", " "] subscribe
  • 15. SUBSCRIBE, MAP, FILTER [" ", " ", " ", " ", " "] [ , , , , ] map subscribe
  • 16. SUBSCRIBE, MAP, FILTER [" ", " ", " ", " ", " "] [ , , , , ] [ , , ] map filter subscribe
  • 18. just(1, 1, 2, 3, 5, 8, 13).filter(i -> i % 2 != 0) // 1, 1, 3, 5, 13 just(1, 1, 2, 3, 5, 8, 13).map(i -> i * 2) // 2, 2, 4, 6, 10, 16, 26 Exercise 1a: filter, map
  • 19. Exercise 1b: take, error handling
  • 20. Subscriptions flow map filter source … subscribe subscribe subscribe subscribe subscribe onNext onNext onNext onNext subscribeOn If subscription should be made on a different thread observeOn If notifications should be made on a different thread (e.g. UI thread)
  • 22. just([1], [1], [2, 3], [5], [], [13]) .flatMap(arr -> just(arr)) // 1, 1, 2, 3, 5, 13 Exercise 3: basic flatMap
  • 24. Exercise 5: error handling
  • 31. AVAILABLE IN A LANGUAGE OR FRAMEWORK NEAR YOU
  • 32. FURTHER READING Examples from this presentation https://github.com/tkowalcz/rx-java-pantha-rhei Reactive Java project https://github.com/Netflix/RxJava Other reactive projects http://reactivex.io/ http://rxmarbles.com/ http://davesexton.com/blog/post/To-Use-Subject-Or- Not-To-Use-Subject.aspx https://speakerdeck.com/dlew/reactive-extensions- beyond-the-basics