SlideShare a Scribd company logo
Reactive Programming with
RxJava
Reactive Extension for Java: why do we need it and
how we can use it.
Roots and Motivation behind RxJava
• What is reactive programming
• Possible approaches to asynchronous programming model
• Observable<T> - core concept, contract and interface
• Push vs Pull and Iterable/Observable duality
• Cold and Hot streams
• Lazy evaluation
• Diagrams
• Operators
What is Reactive Programming?
• Reactive programming is programming with asynchronous data
streams
Typical example:
• Why callbacks are inconvenient?
Observable
• Push model
• Contract – onNext(), onComplete(), onError():
• Zero or more onNext()
• Exacly one onComplete() or onError()
Observable (continued)
• Duality:
Pull
• T next()
• Throw Exception
• Returns
Push
• onNext(T)
• onError(Throwable t)
• onComplete()
Cold and Hot Streams
• Cold streams:
• Do not produce any event until subscription (Lazy)
• Hot streams:
• Production of events is out of control of application
Lazy VS Eager
• RxJava adopts lazy model
• Subscription, not construction starts work
• Observables can be reused
RxJava 1 vs RxJava 2
• Handling of null values – RxJava 2 does not accept null values
• Observable and Flowable – RxJava 2 has separated non- and
backpressured versions
• Maybe – RxJava 2 Observable for 0 or 1 element emission
• Subjects and Processors – New RxJava 2 types for subject-like
behavior (producer and consumer at the same time). Subjects are
accompanying Observable while Processor – Flowable
• Functional interfaces with Exception – RxJava 2
• Many smaller changes

More Related Content

PDF
Automating EVA Workflows with AWS Step Functions
Chris Shenton
 
PPTX
Scilab: Computing Tool For Engineers
Naren P.R.
 
PPTX
Cape2013 scilab-workshop-19Oct13
Naren P.R.
 
PPTX
Quantum Computing With the Q# Language
.NET Crowd
 
PDF
Introduction to Scala for Java Developers
Solix JJ
 
PPTX
Continuous Delivery Automation of Cloud Infrastructure and Applications at Ch...
Brian Mericle
 
PDF
Scala in-practice-3-years by Patric Fornasier, Springr, presented at Pune Sca...
Thoughtworks
 
PDF
Build machine learning pipelines from research to production
cnvrg.io AI OS - Hands-on ML Workshops
 
Automating EVA Workflows with AWS Step Functions
Chris Shenton
 
Scilab: Computing Tool For Engineers
Naren P.R.
 
Cape2013 scilab-workshop-19Oct13
Naren P.R.
 
Quantum Computing With the Q# Language
.NET Crowd
 
Introduction to Scala for Java Developers
Solix JJ
 
Continuous Delivery Automation of Cloud Infrastructure and Applications at Ch...
Brian Mericle
 
Scala in-practice-3-years by Patric Fornasier, Springr, presented at Pune Sca...
Thoughtworks
 
Build machine learning pipelines from research to production
cnvrg.io AI OS - Hands-on ML Workshops
 

What's hot (10)

PPTX
Spring IO - Spring Boot for DevOps
Nicolas Fränkel
 
PDF
How To Build Auto-Adaptive Machine Learning Models with Kubernetes
cnvrg.io AI OS - Hands-on ML Workshops
 
PPTX
Helpful into to Rx
Serg Dort
 
PDF
from ai.backend import python @ pycontw2018
Chun-Yu Tseng
 
PDF
ReactiveX
BADR
 
PDF
ReactiveX-SEA
Yang Yang
 
PDF
Active record, standalone migrations, and working with Arel
Alex Tironati
 
PPTX
Data structure
swapnilnav99
 
PDF
Scilab-by-dr-gomez-june2014
Ir. Dr. R.Badlishah Ahmad
 
PPTX
Elm - never get a runtime error anymore. Almost.
Anton Astashov
 
Spring IO - Spring Boot for DevOps
Nicolas Fränkel
 
How To Build Auto-Adaptive Machine Learning Models with Kubernetes
cnvrg.io AI OS - Hands-on ML Workshops
 
Helpful into to Rx
Serg Dort
 
from ai.backend import python @ pycontw2018
Chun-Yu Tseng
 
ReactiveX
BADR
 
ReactiveX-SEA
Yang Yang
 
Active record, standalone migrations, and working with Arel
Alex Tironati
 
Data structure
swapnilnav99
 
Scilab-by-dr-gomez-june2014
Ir. Dr. R.Badlishah Ahmad
 
Elm - never get a runtime error anymore. Almost.
Anton Astashov
 
Ad

Similar to Reactive Programming with RxJava (20)

PDF
Reactive java - Reactive Programming + RxJava
NexThoughts Technologies
 
PPTX
Reactive Programming in Java 8 with Rx-Java
Kasun Indrasiri
 
PPTX
Intro to Functional Programming with RxJava
Mike Nakhimovich
 
PDF
RxJava - introduction & design
allegro.tech
 
PPTX
Introduction to RxJava on Android
Chris Arriola
 
PDF
Intro to Rx Java
Syed Awais Mazhar Bukhari
 
PDF
Streams, Streams Everywhere! An Introduction to Rx
Andrzej Sitek
 
PDF
Reactive programming using rx java & akka actors - pdx-scala - june 2014
Thomas Lockney
 
PDF
Reactive Programming in Java by Mario Fusco - Codemotion Rome 2015
Codemotion
 
PDF
Reactive Programming for a demanding world: building event-driven and respons...
Mario Fusco
 
PPTX
RxJava 2 Reactive extensions for the JVM
Netesh Kumar
 
PPTX
Reactive Programming with RxJS
Danca Prima
 
PDF
Reactive programming and RxJS
Ravi Mone
 
PPTX
Reactive programming
saykopatt
 
PPTX
ReactiveX
János Murvai-Gaál
 
PDF
Go reactive - Manuel Vicente Vivo
Manuel Vicente Vivo
 
PPTX
RxJS vs RxJava: Intro
Martin Toshev
 
PPTX
Strange Async Code - ReaxtiveX
Matthew Will
 
PPTX
Mario Fusco - Reactive programming in Java - Codemotion Milan 2017
Codemotion
 
PDF
rx-java-presentation
Mateusz Bukowicz
 
Reactive java - Reactive Programming + RxJava
NexThoughts Technologies
 
Reactive Programming in Java 8 with Rx-Java
Kasun Indrasiri
 
Intro to Functional Programming with RxJava
Mike Nakhimovich
 
RxJava - introduction & design
allegro.tech
 
Introduction to RxJava on Android
Chris Arriola
 
Intro to Rx Java
Syed Awais Mazhar Bukhari
 
Streams, Streams Everywhere! An Introduction to Rx
Andrzej Sitek
 
Reactive programming using rx java & akka actors - pdx-scala - june 2014
Thomas Lockney
 
Reactive Programming in Java by Mario Fusco - Codemotion Rome 2015
Codemotion
 
Reactive Programming for a demanding world: building event-driven and respons...
Mario Fusco
 
RxJava 2 Reactive extensions for the JVM
Netesh Kumar
 
Reactive Programming with RxJS
Danca Prima
 
Reactive programming and RxJS
Ravi Mone
 
Reactive programming
saykopatt
 
Go reactive - Manuel Vicente Vivo
Manuel Vicente Vivo
 
RxJS vs RxJava: Intro
Martin Toshev
 
Strange Async Code - ReaxtiveX
Matthew Will
 
Mario Fusco - Reactive programming in Java - Codemotion Milan 2017
Codemotion
 
rx-java-presentation
Mateusz Bukowicz
 
Ad

More from Grand Parade Poland (14)

PDF
Making Games in WebGL - Aro Wierzbowski & Tomasz Szepczyński
Grand Parade Poland
 
PDF
Mobile Team on Daily basis - Kamil Burczyk & Michał Ćwikliński (Mobiconf2017)
Grand Parade Poland
 
PDF
Css encapsulation strategies | Marcin Mazurek
Grand Parade Poland
 
PDF
Reason - introduction to language and its ecosystem | Łukasz Strączyński
Grand Parade Poland
 
PDF
Thinking in Graphs - GraphQL problems and more - Maciej Rybaniec (23.06.2017)
Grand Parade Poland
 
PDF
Introduction to React Native - Marcin Mazurek (09.06.2017)
Grand Parade Poland
 
PDF
Pawel Cygal - SQL Injection and XSS - Basics (Quality Questions Conference)
Grand Parade Poland
 
PDF
Mateusz Gruszczynski - Performance tests in Gatling (Quality Questions Confer...
Grand Parade Poland
 
PDF
Krzysztof Skarbinski - Automated tests in Python (Quality Questions Conference)
Grand Parade Poland
 
PDF
Rafał Machnik - CQRS as a performance and security booster (Quality Questions...
Grand Parade Poland
 
PDF
Slawomir Kluz - ScalaTest from QA perspective (Quality Questions Conference)
Grand Parade Poland
 
PDF
Steve Bond - Managing the Threats in Online Gaming (Quality Questions Confere...
Grand Parade Poland
 
PDF
React-redux server side rendering enchanted with varnish-cache for the fastes...
Grand Parade Poland
 
PDF
Wielomilionowy Ruch na Wordpressie - Łukasz Wilczak & Piotr Federowicz (WordC...
Grand Parade Poland
 
Making Games in WebGL - Aro Wierzbowski & Tomasz Szepczyński
Grand Parade Poland
 
Mobile Team on Daily basis - Kamil Burczyk & Michał Ćwikliński (Mobiconf2017)
Grand Parade Poland
 
Css encapsulation strategies | Marcin Mazurek
Grand Parade Poland
 
Reason - introduction to language and its ecosystem | Łukasz Strączyński
Grand Parade Poland
 
Thinking in Graphs - GraphQL problems and more - Maciej Rybaniec (23.06.2017)
Grand Parade Poland
 
Introduction to React Native - Marcin Mazurek (09.06.2017)
Grand Parade Poland
 
Pawel Cygal - SQL Injection and XSS - Basics (Quality Questions Conference)
Grand Parade Poland
 
Mateusz Gruszczynski - Performance tests in Gatling (Quality Questions Confer...
Grand Parade Poland
 
Krzysztof Skarbinski - Automated tests in Python (Quality Questions Conference)
Grand Parade Poland
 
Rafał Machnik - CQRS as a performance and security booster (Quality Questions...
Grand Parade Poland
 
Slawomir Kluz - ScalaTest from QA perspective (Quality Questions Conference)
Grand Parade Poland
 
Steve Bond - Managing the Threats in Online Gaming (Quality Questions Confere...
Grand Parade Poland
 
React-redux server side rendering enchanted with varnish-cache for the fastes...
Grand Parade Poland
 
Wielomilionowy Ruch na Wordpressie - Łukasz Wilczak & Piotr Federowicz (WordC...
Grand Parade Poland
 

Recently uploaded (20)

PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
This slide provides an overview Technology
mineshkharadi333
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PPTX
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PPTX
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
PDF
Chapter 1 Introduction to CV and IP Lecture Note.pdf
Getnet Tigabie Askale -(GM)
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
PPTX
Coupa-Overview _Assumptions presentation
annapureddyn
 
PDF
Revolutionize Operations with Intelligent IoT Monitoring and Control
Rejig Digital
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PPT
L2 Rules of Netiquette in Empowerment technology
Archibal2
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
This slide provides an overview Technology
mineshkharadi333
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
Stamford - Community User Group Leaders_ Agentblazer Status, AI Sustainabilit...
Amol Dixit
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
Chapter 1 Introduction to CV and IP Lecture Note.pdf
Getnet Tigabie Askale -(GM)
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
A Day in the Life of Location Data - Turning Where into How.pdf
Precisely
 
Coupa-Overview _Assumptions presentation
annapureddyn
 
Revolutionize Operations with Intelligent IoT Monitoring and Control
Rejig Digital
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
L2 Rules of Netiquette in Empowerment technology
Archibal2
 

Reactive Programming with RxJava

  • 1. Reactive Programming with RxJava Reactive Extension for Java: why do we need it and how we can use it.
  • 2. Roots and Motivation behind RxJava • What is reactive programming • Possible approaches to asynchronous programming model • Observable<T> - core concept, contract and interface • Push vs Pull and Iterable/Observable duality • Cold and Hot streams • Lazy evaluation • Diagrams • Operators
  • 3. What is Reactive Programming? • Reactive programming is programming with asynchronous data streams Typical example:
  • 4. • Why callbacks are inconvenient?
  • 5. Observable • Push model • Contract – onNext(), onComplete(), onError(): • Zero or more onNext() • Exacly one onComplete() or onError()
  • 6. Observable (continued) • Duality: Pull • T next() • Throw Exception • Returns Push • onNext(T) • onError(Throwable t) • onComplete()
  • 7. Cold and Hot Streams • Cold streams: • Do not produce any event until subscription (Lazy) • Hot streams: • Production of events is out of control of application
  • 8. Lazy VS Eager • RxJava adopts lazy model • Subscription, not construction starts work • Observables can be reused
  • 9. RxJava 1 vs RxJava 2 • Handling of null values – RxJava 2 does not accept null values • Observable and Flowable – RxJava 2 has separated non- and backpressured versions • Maybe – RxJava 2 Observable for 0 or 1 element emission • Subjects and Processors – New RxJava 2 types for subject-like behavior (producer and consumer at the same time). Subjects are accompanying Observable while Processor – Flowable • Functional interfaces with Exception – RxJava 2 • Many smaller changes