SlideShare a Scribd company logo
@alexsotob
Reactive Programming
for Real Use Cases
Alex Soto
Director of Developer Experience Red Hat
(@alexsotob)
@alexsotob
2
Buenas tardes, buenas noches,
señoritas y señores
To be here with you tonight. 
Brings me joy, que alegria
— Miguel
“
@alexsotob
3
Who Am I?
Alex Soto
@alexsotob
System extensions
Programming
Manifesto
Streams
Asynchrony
Resilience
Elasticity
Back-Pressure
Spreadsheets
Actor
Events
Messages
Data Flows
RX Java
Responsiveness
Fibers Non-
Blocking
Reactor
Spring
MicroProfile
REACTIVE ALL THE THING
R-Socket
@alexsotob5
What's this?
The streets are lined with
Little creatures laughing.
— Jack Skellington
“
@alexsotob
Click events on steroids
@alexsotob
C CC C C C
click stream
C CC C CC
double click stream
buffer(100ms)
C C CC
double clicks stream
filter >=2
subscribe executes everything
@alexsotob
Event-Driven => Concurrent Applications
Build concurrent
applications
Reactive
programming
Reactive
streams
Non-Blocking
Asynchronous
Non-Blocking IO (Netty)
Reactive Framework
Application Code
Callbacks, RX Java,
Reactor, Co-routines...
} 1 Thread -> n concurrent
tasks
@alexsotob9
Proceed with
caution!!!.
— Fear
“
@alexsotob
From Event-Driven to Systems
@alexsotob
Reactive => Responsive
RESPONSIVE
ASYNC MESSAGE
PASSING
ELASTICITY RESILIENCE
@alexsotob
Async != multi-thread
Async == never-block
@alexsotob
Asynchronous & Non-Blocking execution model
Ideal
world
Task A Task
B
Task
C
Real
world
Blocking I/O
Asynchronous
execution
@alexsotob
Containers are about sharing and deployment density
Container Host
Threads
costs memory
cost lots of memory
cost CPU cycles
+ quotas = BOOM
The hidden truth of containers
@alexsotob
2020
@alexsotob16
On an island that I own
Tan and rested and alone
Surrounded by 
enormous piles of money
— Eugene
“
@alexsotob17
I just don’t see how a world
that makes such a
wonderful things
could be bad?
— Ariel
“
@alexsotob18
Supersonic.
Subatomic.
REACTIVE.
@alexsotob
Quarkus = (Imperative + Reactive)/Reactive
Eclipse Vert.x / Netty
Undertow
(Servlet)
RESTEasy
(JAX-RS) Reactive
Routes
Reactive
Messaging
Reactive
Data Access
EventsMessages
HTTP
@alexsotob
Pagination + Filtering
Beer
Consumer
Beer
Service
getPage(1)
getPage(n)
@alexsotob
Pagination
Flowable<List<Beer>> beerStream = Flowable.generate(() -> 1, (page, emitter) -> {
final List<Beer> beers = beerGateway.getBeers(page);
if (beers.isEmpty()) {
emitter.onComplete();
} else {
emitter.onNext(beers);
}
return page + 1;
});
return beerStream
.flatMap(Flowable::fromIterable);
Initial Page
Get Beers
Emit Beers of Finish
Iterate to the next page
Individual Beer Is Emitted
@alexsotob
Pagination
@GET
@Path("/all")
@Produces(MediaType.APPLICATION_JSON)
public Publisher<Beer> getBeers() {
return beerservice.beers()
.filter(b -> b.getAbv() > 10.0);
}
~Thread
Get Beers Streams
Stream Operation
@alexsotob
Parallel Requests
Beer
Consumer
Beer
Service
getBeer(XXX)
getBeer(YYY)
@alexsotob
Parallel Requests
public Flowable<JsonValue> compareBeers(String beerA, String beerB) {
final Flowable<JsonObject> beerAInfo = beerGateway.getBeer(beerA)
.map(array -> array.get(0))
.map(this::filterContent);
final Flowable<JsonObject> beerBInfo = beerGateway.getBeer(beerB)
.map(array -> array.get(0))
.map(this::filterContent);
return beerAInfo.zipWith(beerBInfo, this::compare);
}
Get Beer Async
Get Important Fields
When Both Operations Finishes
Execute Comparison
@alexsotob25
A hundred thousand things to see
(Hold your breath, it gets better)
— Jasmine & Aladdin
“
@alexsotob26
Don’t you know
there’s part of me that
longs to go…
Into the Unknown
— Elsa
“
@alexsotob
HTTP => Strong Coupling
@alexsotob
HTTP => Uptime Coupling
@alexsotob
HTTP => Strong Coupling
C
B
C
B
C
B
C
B
C
B
C
B
@alexsotob
Messaging
Non-Blocking
Message
Passing
Elasticity
Resilience
@alexsotob
Data at Rest => Data At Motion
Message
Stream
Publish/
Subscribe
Request-Reply
@alexsotob
Quarkus = {HTTP, Messaging, Streaming}
Messaging / Streaming
Quarkus
Application Code
Container Host / Operating System
NIO HTTP Messaging
Quarkus
Application Code
Container Host / Operating System Messaging
Middleware
@alexsotob
Quarkus = {HTTP, Messaging, Streaming}
MicroProfile Reactive Messaging
Quarkus
Application Code
Container Host / Operating System
NIO HTTP Messaging
Quarkus
Application Code
Container Host / Operating System Messaging
Middleware
*
* Kafka or any other messaging system.
@alexsotob
Music Charts
Player Top Music Chart Player Top Music Chart
HTTP
Dashboard
Song Played
*
play music musicplay
@alexsotob
REST to Messaging
@Inject
@Channel("orders")
Emitter<String> orders;
public Order enqueue(Order order) {
orders.send(jsonb.toJson(order));
return order;
}
Send “data” to the
channel “orders”
@alexsotob
Processing Messages
@Incoming("orders")
@Outgoing("queue")
public CompletionStage<String> prepare(String message) {
Order order = fromJson(message, Order.class);
return makeIt(order)
.thenApply(beverage ->
PreparationState.ready(order, beverage)
);
}
Read from “orders”
Write to “queue”
Process data async*
@alexsotob37
A hundred thousand things to see
(Hold your breath, it gets better)
— Jasmine & Aladdin
“
@alexsotob38
Put on your Sunday clothes
there's lots of world
out there.
— Wall-E
“
[https://github.com/lordofthejars/rp4rp]
@alexsotob39
What's the lesson?
What is the take-away?
— Maui
“
@alexsotob40
Quarkus = {HTTP, Messaging, Streaming}
HTTP, Messaging, Streaming
Quarkus
Non-Blocking IO
@alexsotob41
WHAT ABOUT REACTIVE STREAMS?
@Channel(“foo”) Emitter
@Incoming(“foo”)
@Outgoing(“bar”)
@Channel(“bar”) Publisher
@Outoing(“foo”)
@Incoming(“bar”)
Publisher Processor Subscriber
Connector Connector
@alexsotob
Hay un amigo en mí,
cuando salgan a volar,
hay un amigo en mí
— Toy Story
“
@alexsotob
asotobue@redhat.com
http://www.lordofthejars.com/
lordofthejars

More Related Content

PPSX
Spring - Part 1 - IoC, Di and Beans
Hitesh-Java
 
PPTX
What is new in Notes & Domino Deleopment V10.x
Ulrich Krause
 
PDF
Project Reactor Now and Tomorrow
VMware Tanzu
 
PPTX
Java concurrency in practice
Mikalai Alimenkou
 
PPTX
Reactive programming intro
Ahmed Ehab AbdulAziz
 
PDF
Being Functional on Reactive Streams with Spring Reactor
Max Huang
 
PDF
Thousands of Threads and Blocking I/O
George Cao
 
PPTX
CICD Pipeline Using Github Actions
Kumar Shìvam
 
Spring - Part 1 - IoC, Di and Beans
Hitesh-Java
 
What is new in Notes & Domino Deleopment V10.x
Ulrich Krause
 
Project Reactor Now and Tomorrow
VMware Tanzu
 
Java concurrency in practice
Mikalai Alimenkou
 
Reactive programming intro
Ahmed Ehab AbdulAziz
 
Being Functional on Reactive Streams with Spring Reactor
Max Huang
 
Thousands of Threads and Blocking I/O
George Cao
 
CICD Pipeline Using Github Actions
Kumar Shìvam
 

What's hot (20)

PDF
git - eine praktische Einführung
Marcel Eichner
 
PDF
Api observability
Red Hat
 
PPTX
Lombok
Amit Aggarwal
 
KEY
Introduction To Git
Arnaud Seilles
 
PDF
Git Grundlagen
Benjamin Schürmann
 
PDF
Akka-intro-training-public.pdf
BernardDeffarges
 
PDF
Multi Master PostgreSQL Cluster on Kubernetes
Ohyama Masanori
 
PPTX
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
Scrum Breakfast Vietnam
 
PDF
REST APIs with Spring
Joshua Long
 
PPTX
Taking your version control to a next level with TFS and Git
Alexander Vanwynsberghe
 
PPTX
Spring Batch Avance
Olivier BAZOUD
 
PPT
Git vs SVN
neuros
 
PPTX
Git - Basic Crash Course
Nilay Binjola
 
PPTX
HTTP/2 Prioritization
Patrick Meenan
 
PDF
More mastering the art of indexing
Yoshinori Matsunobu
 
PDF
오픈소스 모니터링비교
sprdd
 
PDF
Understanding redux
David Atchley
 
PDF
Reactive Programming in Java and Spring Framework 5
Richard Langlois P. Eng.
 
PDF
Apache kafka performance(throughput) - without data loss and guaranteeing dat...
SANG WON PARK
 
PDF
Reactive Spring Framework 5
Aliaksei Zhynhiarouski
 
git - eine praktische Einführung
Marcel Eichner
 
Api observability
Red Hat
 
Introduction To Git
Arnaud Seilles
 
Git Grundlagen
Benjamin Schürmann
 
Akka-intro-training-public.pdf
BernardDeffarges
 
Multi Master PostgreSQL Cluster on Kubernetes
Ohyama Masanori
 
Reactive programming by spring webflux - DN Scrum Breakfast - Nov 2018
Scrum Breakfast Vietnam
 
REST APIs with Spring
Joshua Long
 
Taking your version control to a next level with TFS and Git
Alexander Vanwynsberghe
 
Spring Batch Avance
Olivier BAZOUD
 
Git vs SVN
neuros
 
Git - Basic Crash Course
Nilay Binjola
 
HTTP/2 Prioritization
Patrick Meenan
 
More mastering the art of indexing
Yoshinori Matsunobu
 
오픈소스 모니터링비교
sprdd
 
Understanding redux
David Atchley
 
Reactive Programming in Java and Spring Framework 5
Richard Langlois P. Eng.
 
Apache kafka performance(throughput) - without data loss and guaranteeing dat...
SANG WON PARK
 
Reactive Spring Framework 5
Aliaksei Zhynhiarouski
 
Ad

Similar to Reactive Programming for Real Use Cases (20)

PDF
Not Only Streams for Akademia JLabs
Konrad Malawski
 
PDF
Reactive Applications
Mike Bild
 
PPTX
Gr8conf US 2015: Reactive Options for Groovy
Steve Pember
 
PDF
Springone2gx 2014 Reactive Streams and Reactor
Stéphane Maldini
 
PPTX
Springone2gx 2015 Reactive Options for Groovy
Steve Pember
 
PPTX
Reactive applications tools of the trade huff po
shinolajla
 
PDF
Reactive in Android and Beyond Rx
Fabio Tiriticco
 
PPTX
The Reactive Landscape
Red Hat Developers
 
PDF
Reactor, Reactive streams and MicroServices
Stéphane Maldini
 
PDF
A Journey to Reactive Function Programming
Ahmed Soliman
 
PDF
Integrating Applications: the Reactive Way
Nicola Ferraro
 
PDF
Asynchronous stream processing with Akka Streams
Johan Andrén
 
PDF
Prezo tooracleteam (2)
Sharma Podila
 
PDF
Reactive Integrations - Caveats and bumps in the road explained
Markus Eisele
 
PDF
Openbar 12 - Leuven - From reactive programming to reactive architecture
Openbar
 
PDF
An introduction to Reactive applications, Reactive Streams, and options for t...
Steve Pember
 
PDF
Streaming to a new Jakarta EE / JOTB19
Markus Eisele
 
PDF
Activity feeds (and more) at mate1
Hisham Mardam-Bey
 
PDF
Webinar Alpakka 2018-08-16
Enno Runne
 
PDF
Pakk Your Alpakka: Reactive Streams Integrations For AWS, Azure, & Google Cloud
Lightbend
 
Not Only Streams for Akademia JLabs
Konrad Malawski
 
Reactive Applications
Mike Bild
 
Gr8conf US 2015: Reactive Options for Groovy
Steve Pember
 
Springone2gx 2014 Reactive Streams and Reactor
Stéphane Maldini
 
Springone2gx 2015 Reactive Options for Groovy
Steve Pember
 
Reactive applications tools of the trade huff po
shinolajla
 
Reactive in Android and Beyond Rx
Fabio Tiriticco
 
The Reactive Landscape
Red Hat Developers
 
Reactor, Reactive streams and MicroServices
Stéphane Maldini
 
A Journey to Reactive Function Programming
Ahmed Soliman
 
Integrating Applications: the Reactive Way
Nicola Ferraro
 
Asynchronous stream processing with Akka Streams
Johan Andrén
 
Prezo tooracleteam (2)
Sharma Podila
 
Reactive Integrations - Caveats and bumps in the road explained
Markus Eisele
 
Openbar 12 - Leuven - From reactive programming to reactive architecture
Openbar
 
An introduction to Reactive applications, Reactive Streams, and options for t...
Steve Pember
 
Streaming to a new Jakarta EE / JOTB19
Markus Eisele
 
Activity feeds (and more) at mate1
Hisham Mardam-Bey
 
Webinar Alpakka 2018-08-16
Enno Runne
 
Pakk Your Alpakka: Reactive Streams Integrations For AWS, Azure, & Google Cloud
Lightbend
 
Ad

More from Alex Soto (20)

PDF
Kubernetes Native Java
Alex Soto
 
PDF
Chaos Engineering Kubernetes
Alex Soto
 
PDF
Chaos Engineering Kubernetes
Alex Soto
 
PDF
Microservices testing and automation
Alex Soto
 
PDF
Testing in Production: From DevTestOops to DevTestOps
Alex Soto
 
PDF
Supersonic Subatomic Java
Alex Soto
 
PDF
From DevTestOops to DevTestOps
Alex Soto
 
PDF
Istio service mesh & pragmatic microservices architecture
Alex Soto
 
PDF
Zero Downtime Deployment in Microservices era
Alex Soto
 
PDF
Service Mesh Patterns
Alex Soto
 
PDF
Supersonic, Subatomic Java
Alex Soto
 
PDF
Zero Downtime Deployment in Microservices era
Alex Soto
 
PDF
Long Live and Prosper To Monolith
Alex Soto
 
PDF
Sail in the cloud - An intro to Istio commit
Alex Soto
 
PDF
KubeBoot - Spring Boot deployment on Kubernetes
Alex Soto
 
PDF
Sail in the Cloud - An intro to Istio
Alex Soto
 
PDF
Testing XXIst Century
Alex Soto
 
PDF
Arquillian Constellation
Alex Soto
 
PDF
Testing for Unicorns
Alex Soto
 
PDF
Live Long and Prosper to Monolith
Alex Soto
 
Kubernetes Native Java
Alex Soto
 
Chaos Engineering Kubernetes
Alex Soto
 
Chaos Engineering Kubernetes
Alex Soto
 
Microservices testing and automation
Alex Soto
 
Testing in Production: From DevTestOops to DevTestOps
Alex Soto
 
Supersonic Subatomic Java
Alex Soto
 
From DevTestOops to DevTestOps
Alex Soto
 
Istio service mesh & pragmatic microservices architecture
Alex Soto
 
Zero Downtime Deployment in Microservices era
Alex Soto
 
Service Mesh Patterns
Alex Soto
 
Supersonic, Subatomic Java
Alex Soto
 
Zero Downtime Deployment in Microservices era
Alex Soto
 
Long Live and Prosper To Monolith
Alex Soto
 
Sail in the cloud - An intro to Istio commit
Alex Soto
 
KubeBoot - Spring Boot deployment on Kubernetes
Alex Soto
 
Sail in the Cloud - An intro to Istio
Alex Soto
 
Testing XXIst Century
Alex Soto
 
Arquillian Constellation
Alex Soto
 
Testing for Unicorns
Alex Soto
 
Live Long and Prosper to Monolith
Alex Soto
 

Recently uploaded (20)

PDF
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Hironori Washizaki
 
PPTX
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pptx
Certivo Inc
 
PDF
Become an Agentblazer Champion Challenge
Dele Amefo
 
PPTX
ASSIGNMENT_1[1][1][1][1][1] (1) variables.pptx
kr2589474
 
PPTX
Smart Panchayat Raj e-Governance App.pptx
Rohitnikam33
 
PDF
The Role of Automation and AI in EHS Management for Data Centers.pdf
TECH EHS Solution
 
PPTX
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
PDF
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
PPTX
Presentation about variables and constant.pptx
kr2589474
 
PPT
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
PDF
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
PDF
Become an Agentblazer Champion Challenge Kickoff
Dele Amefo
 
PDF
Microsoft Teams Essentials; The pricing and the versions_PDF.pdf
Q-Advise
 
PPTX
Presentation about variables and constant.pptx
safalsingh810
 
PPTX
Contractor Management Platform and Software Solution for Compliance
SHEQ Network Limited
 
PPTX
Explanation about Structures in C language.pptx
Veeral Rathod
 
PPTX
TestNG for Java Testing and Automation testing
ssuser0213cb
 
PDF
Build Multi-agent using Agent Development Kit
FadyIbrahim23
 
PPTX
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
Hironori Washizaki
 
PFAS Reporting Requirements 2026 Are You Submission Ready Certivo.pptx
Certivo Inc
 
Become an Agentblazer Champion Challenge
Dele Amefo
 
ASSIGNMENT_1[1][1][1][1][1] (1) variables.pptx
kr2589474
 
Smart Panchayat Raj e-Governance App.pptx
Rohitnikam33
 
The Role of Automation and AI in EHS Management for Data Centers.pdf
TECH EHS Solution
 
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Web Testing.pptx528278vshbuqffqhhqiwnwuq
studylike474
 
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
Presentation about variables and constant.pptx
kr2589474
 
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
Become an Agentblazer Champion Challenge Kickoff
Dele Amefo
 
Microsoft Teams Essentials; The pricing and the versions_PDF.pdf
Q-Advise
 
Presentation about variables and constant.pptx
safalsingh810
 
Contractor Management Platform and Software Solution for Compliance
SHEQ Network Limited
 
Explanation about Structures in C language.pptx
Veeral Rathod
 
TestNG for Java Testing and Automation testing
ssuser0213cb
 
Build Multi-agent using Agent Development Kit
FadyIbrahim23
 
GALILEO CRS SYSTEM | GALILEO TRAVEL SOFTWARE
philipnathen82
 

Reactive Programming for Real Use Cases