SlideShare a Scribd company logo
An introduction to reactive
applications, Reactive Streams, and
options for the JVM
Steve Pember
CTO, ThirdChannel
Software Architecture Con, 2016
THIRDCHANNEL @svpember
“Reactive Streams”, “Reactive
Extensions”, or “Rx”
THIRDCHANNEL @svpember
Agenda
• The Problem
• What are Reactive Streams?
• Rx in depth
• An Overview of JVM options
• Demo Time!
THIRDCHANNEL @svpember
The Problem: The Need to go
Reactive
Really, it’s Two problems
THIRDCHANNEL @svpember
1) Performance Demands
Are Always Increasing
An Introduction to Reactive Application, Reactive Streams, and options for JVM
We Use Technology from the
Beginning of Web Development
An Introduction to Reactive Application, Reactive Streams, and options for JVM
Things Slow Down
Users get
angry
quickly
–Johnny Appleseed
“Type a quote here.”
Let’s Keep Our Users Happy
And Engaged
THIRDCHANNEL @svpember
2) The Rise of Microservices
Multiple
Integration
Points
It’s Not Only Users That Use Up
Resources
So what to do?
Embrace
Reactive
Applications
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Reactive Applications
• Responsive
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Reactive Applications
• Responsive
• Resilient
An Introduction to Reactive Application, Reactive Streams, and options for JVM
Embrace Failure
An Introduction to Reactive Application, Reactive Streams, and options for JVM
Independent Things Fail
Independently
THIRDCHANNEL @svpember
Reactive Applications
• Responsive
• Resilient
• Elastic (Scalable)
An Introduction to Reactive Application, Reactive Streams, and options for JVM
THIRDCHANNEL @svpember
Reactive Applications
• Responsive
• Resilient
• Elastic (Scalable)
• Asynchronous / Message Driven
Free up resources
with Async
Operations & Non-
Blocking I/O
Async is Hard for Humans
One Excellent Tool is (are?)
Reactive Streams
THIRDCHANNEL @svpember
Agenda
• The Problem
• What are Reactive Streams?
Collections + Time
An Introduction to Reactive Application, Reactive Streams, and options for JVM
Single abstraction over data
from many sources
THIRDCHANNEL @svpember
Observer Pattern
Push (not Pull)
based Iterators
Stream-Based
Functional Programming
Imperative
vs
Stream
Streams with Extensions for
Reactive Programming
Rx makes Async behavior easy!
(Reactive Pull) Backpressure
An Introduction to Reactive Application, Reactive Streams, and options for JVM
THIRDCHANNEL @svpember
What is Rx?
• Collections + Time
• A Single Abstraction over data from different sources
• Observer Pattern with Push-based iterators
• Stream Based Functional Programming
• … with Extensions for Reactive Programming
• Async is easy
• Backpressure
Rx Simplifies Complex Work
…Once you
understand,
of course…
THIRDCHANNEL @svpember
Agenda
• The Problem
• What are Reactive Streams?
• Rx in depth
THIRDCHANNEL @svpember
Key Terms:
An Observable is like Promise ++
An Observable pushes items to
Subscribers
Subscribers receive and
operate on emitted data
Observables and Subscribers
operate on a Scheduler
The
following
examples
use rxJava
But, try out rxGroovy
THIRDCHANNEL @svpember
Groovy
• Dynamic Language for the JVM
• Less Verbose (Reduce Java Boilerplate)
• Ruby/Python - esque Collections
• Run Time Meta Programming
• Optionally Typed
• AST Transformations
• Powerful Annotations
• Multi - Inheritance via Traits and @DelegatesTo
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Basic Usage
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Thankfully, there are shortcuts
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Streams are Composable
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
You can get much power from 5 functions
• filter
• map
• reduce
• groupBy
• flatMap
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
First Mental Leap: An
Observable of Observables
–Johnny Appleseed
“Type a quote here.”
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Hot vs Cold
Cold Observable: finite data, on
demand
Hot Observable: infinite data, as
it’s ready
Cold Observable: only starts
emitting data on .subscribe ()
Hot Observable: emits data
whenever it’s ready
THIRDCHANNEL @svpember
Asynchronous Streams
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
BackPressure
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Can only Mitigate Hot Streams
• throttle
• sample
• window
• buffer
• drop
THIRDCHANNEL @svpember
Stream Interaction
Don’t Unsubscribe from Observables
Programmatically complete them
when another Observable fires
An Introduction to Reactive Application, Reactive Streams, and options for JVM
THIRDCHANNEL @svpember
AutoComplete Requirements
• Wait 250 ms between keypresses before querying
• If no keys are pressed, no query
• Successful queries should render movies
• Any new queries should kill in-flight queries
An Introduction to Reactive Application, Reactive Streams, and options for JVM
Pretty
Great,
But what’s
going on?
The keyPress stream is reacting
to itself
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Questions?
THIRDCHANNEL @svpember
Agenda
• The Problem
• What are Reactive Streams?
• Rx In Depth
• An Overview of JVM options
THIRDCHANNEL @svpember
Story Time
THIRDCHANNEL @svpember
Story Time
THIRDCHANNEL @svpember
Story Time
THIRDCHANNEL @svpember
Story Time
2012 - MS Open Source’s RX!
THIRDCHANNEL @svpember
Story Time
2012 - MS Open Source’s RX!
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
We should probably start
with RxJava
Brings
Reactive
Streams to
the JVM
But Don’t Forget rxGroovy
An Introduction to Reactive Application, Reactive Streams, and options for JVM
An Introduction to Reactive Application, Reactive Streams, and options for JVM
THIRDCHANNEL @svpember
• High performance web framework
• Non-opinionated
• Non-Blocking Network Stack
• Built on Reactive Streams, Netty, Java 8, Guice
• Fully embodies reactive
• Light-weight, self-contained deployables
Take a Look at Ratpack
http://www.infoq.com/presentations/ratpack-2015
Includes rxRatpack module, but
we’ll talk about that later
THIRDCHANNEL @svpember
Akka & Akka Streams
• Library
• Definition of Reactive System
• Created by LightBend
• Actor-Based Concurrency
• Implemented Streams on Top of Actor Model
An Introduction to Reactive Application, Reactive Streams, and options for JVM
An Introduction to Reactive Application, Reactive Streams, and options for JVM
An Introduction to Reactive Application, Reactive Streams, and options for JVM
–Johnny Appleseed
“Type a quote here.”
–Johnny Appleseed
“Type a quote here.”
THIRDCHANNEL @svpember
• Library
• Reactive Streams
• Reactor Pattern
• Built on LMAX Ring Buffer / Disrupter
• Multiple libraries to extend Ring Buffer in multiple ways
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
Many Tools Seem to be Moving
Towards Reactive Streams
THIRDCHANNEL @svpember
Demo Time
THIRDCHANNEL @svpember
Any Questions?
Thank You!
@svpember
spember@gmail.com
THIRDCHANNEL @svpember
THIRDCHANNEL @svpember
More Information
• Reactive Groovy & Ratpack Demo: https://github.com/spember/reactive-movie-demo
• Jafar Husain: RxJS: https://www.youtube.com/watch?v=XRYN2xt11Ek
• Reactive Streams Spec: http://www.reactive-streams.org/
• Reactive Manifesto: http://www.reactivemanifesto.org/
• Akka: http://akka.io/
• rxJava / ReactiveX libraries: https://github.com/ReactiveX
• Ratpack: http://ratpack.io/
• Reactor: https://github.com/reactor/reactor
• The Introduction to Reactive Programming you’ve been missing: https://gist.github.com/staltz/868e7e9bc2a7b8c1f754
• Martin Fowler: Stream / Pipeline programming: http://martinfowler.com/articles/refactoring-pipelines.html
• Or Just on Groovy (Groovy the Awesome Parts): http://www.slideshare.net/SpringCentral/groovy-the-awesome-parts
• Ratpack Web Presentation: http://www.infoq.com/presentations/ratpack-2015
• Advanced RxJava Blog: http://akarnokd.blogspot.com/
• Martin Fowler LMAX breakdown: http://martinfowler.com/articles/lmax.html
Images
• Empty Pool: http://www.wtok.com/home/headlines/Water-Problems-205987121.html
• Juggling: https://en.wikipedia.org/wiki/Juggling
• Directing Traffic: https://www.flickr.com/photos/tracilawson/3474012583L
• LMAX Disrupter: http://martinfowler.com/articles/lmax.html
• Mailman: thebrandtstandard.com/2013/02/09/u-s-post-office-to-end-saturday-letter-delivery-this-summer/
• Actors Diagram: https://blog.codecentric.de/en/2015/08/introduction-to-akka-actors/
• Cheetah: www.livescience.com/21944-usain-bolt-vs-cheetah-animal-olympics.html
• Dominoes: https://www.flickr.com/photos/louish/5611657857/sizes/l/in/photostream/
• Spartans: www.300themovie.com/
• Stampeding Buffalo: news.sd.gov/newsitem.aspx?id=15164

More Related Content

PDF
An introduction to Reactive applications, Reactive Streams, and options for t...
PDF
Reactive Streams and the Wide World of Groovy
PDF
A year with event sourcing and CQRS
PDF
Reactive Streams and the Wide World of Groovy
PPTX
Ocassionally connected devices spark final
PPTX
Groovy Options for Reactive Applications - Greach 2015
PPTX
CQRS + ES with Scala and Akka
PDF
Patterns of the Lambda Architecture -- 2015 April - Hadoop Summit, Europe
An introduction to Reactive applications, Reactive Streams, and options for t...
Reactive Streams and the Wide World of Groovy
A year with event sourcing and CQRS
Reactive Streams and the Wide World of Groovy
Ocassionally connected devices spark final
Groovy Options for Reactive Applications - Greach 2015
CQRS + ES with Scala and Akka
Patterns of the Lambda Architecture -- 2015 April - Hadoop Summit, Europe

What's hot (20)

KEY
The guardian and app engine
PDF
Scaling the guardian
PPTX
Continuous database deployment
PPTX
Java Colombo: Developing Highly Scalable Apps
PDF
Event Sourcing
PDF
Dos and don'ts in AWS
PPT
Devops at Netflix (re:Invent)
PPTX
Sydney Continuous Delivery Meetup May 2014
PPTX
Accelerating Innovation and Time-to-Market @ Camp Devops Houston 2015
PDF
Actor model in F# and Akka.NET
PDF
Denver AWS Users' Group Meeting - July 2018 Slides
PPTX
BTD2015 - Your Place In DevTOps is Finding Solutions - Not Just Bugs!
PDF
Creating Hyper Performant Web Apps with React
PDF
Electron performance and C++ in Mailspring
PPTX
Mobile User Experience: Auto Drive through Performance Metrics
PDF
Optimizing Git LFS Migration Through Repository Data-mining
PDF
Ryan Brown - Open Community
PDF
Square Peg Round Hole: Serverless Solutions For Non-Serverless Problems
PPTX
MassTLC Cloud Summit Keynote
PDF
Troubleshooting serverless applications
The guardian and app engine
Scaling the guardian
Continuous database deployment
Java Colombo: Developing Highly Scalable Apps
Event Sourcing
Dos and don'ts in AWS
Devops at Netflix (re:Invent)
Sydney Continuous Delivery Meetup May 2014
Accelerating Innovation and Time-to-Market @ Camp Devops Houston 2015
Actor model in F# and Akka.NET
Denver AWS Users' Group Meeting - July 2018 Slides
BTD2015 - Your Place In DevTOps is Finding Solutions - Not Just Bugs!
Creating Hyper Performant Web Apps with React
Electron performance and C++ in Mailspring
Mobile User Experience: Auto Drive through Performance Metrics
Optimizing Git LFS Migration Through Repository Data-mining
Ryan Brown - Open Community
Square Peg Round Hole: Serverless Solutions For Non-Serverless Problems
MassTLC Cloud Summit Keynote
Troubleshooting serverless applications
Ad

Viewers also liked (7)

PPTX
autodiscoverable microservices with vertx3
PPTX
DDD-Enabling Architectures with EventStore
PDF
Reactive Microservices with Vert.x
PDF
Modern app programming with RxJava and Eclipse Vert.x
PPTX
Patterns and practices for real-world event-driven microservices
PDF
Vert.X: Microservices Were Never So Easy (Clement Escoffier)
PDF
How to build an event-driven, polyglot serverless microservices framework on ...
autodiscoverable microservices with vertx3
DDD-Enabling Architectures with EventStore
Reactive Microservices with Vert.x
Modern app programming with RxJava and Eclipse Vert.x
Patterns and practices for real-world event-driven microservices
Vert.X: Microservices Were Never So Easy (Clement Escoffier)
How to build an event-driven, polyglot serverless microservices framework on ...
Ad

Similar to An Introduction to Reactive Application, Reactive Streams, and options for JVM (20)

PDF
Reactive All the Way Down the Stack
PPTX
Springone2gx 2015 Reactive Options for Groovy
PPTX
Gr8conf US 2015: Reactive Options for Groovy
PPTX
RxJS and Reactive Programming - Modern Web UI - May 2015
PDF
Threading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
PDF
Frontend as a first class citizen
PPTX
Designing Fault Tolerant Microservices
PDF
How to debug slow lambda response times
PDF
Streaming to a New Jakarta EE
PDF
Streaming to a new Jakarta EE
PPTX
Fault Tolerance in Distributed Environment
PDF
Working With Concurrency In Java 8
PPTX
Reactive Programming in Java 8 with Rx-Java
PDF
Adding GraphQL to your existing architecture
PDF
Springone2gx 2014 Reactive Streams and Reactor
PPTX
Mini training - Reactive Extensions (Rx)
PPTX
Reactive Web Development with Spring Boot 2
PDF
Building Asynchronous Applications
PPTX
Cycling for noobs
PDF
Reactive Applications in Java
Reactive All the Way Down the Stack
Springone2gx 2015 Reactive Options for Groovy
Gr8conf US 2015: Reactive Options for Groovy
RxJS and Reactive Programming - Modern Web UI - May 2015
Threading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
Frontend as a first class citizen
Designing Fault Tolerant Microservices
How to debug slow lambda response times
Streaming to a New Jakarta EE
Streaming to a new Jakarta EE
Fault Tolerance in Distributed Environment
Working With Concurrency In Java 8
Reactive Programming in Java 8 with Rx-Java
Adding GraphQL to your existing architecture
Springone2gx 2014 Reactive Streams and Reactor
Mini training - Reactive Extensions (Rx)
Reactive Web Development with Spring Boot 2
Building Asynchronous Applications
Cycling for noobs
Reactive Applications in Java

More from Steve Pember (20)

PPTX
Spring I_O 2024 - Flexible Spring with Event Sourcing.pptx
PDF
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
PDF
SACon 2019 - Surviving in a Microservices Environment
PDF
Surviving in a Microservices environment -abridged
PDF
Gradle Show and Tell
PDF
Greach 2018: Surviving Microservices
PDF
Event storage in a distributed system
PDF
Harnessing Spark and Cassandra with Groovy
PDF
Surviving in a microservices environment
PDF
Surviving in a Microservices Environment
PDF
An Introduction to jOOQ
PPTX
Richer Data History with Event Sourcing (SpringOne 2GX 2015
PPTX
Gr8conf US 2015 - Intro to Event Sourcing with Groovy
PDF
Advanced Microservices - Greach 2015
PPTX
Richer data-history-event-sourcing
PPTX
Managing a Microservices Development Team (And advanced Microservice concerns)
PDF
Reactive Microservice Architecture with Groovy and Grails
PPT
Why Reactive Architecture Will Take Over The World (and why we should be wary...
PPT
Richer Data History in Groovy with Event Sourcing
PPT
Distributed Reactive Architecture: Extending SOA with Events
Spring I_O 2024 - Flexible Spring with Event Sourcing.pptx
Anatomy of a Spring Boot App with Clean Architecture - Spring I/O 2023
SACon 2019 - Surviving in a Microservices Environment
Surviving in a Microservices environment -abridged
Gradle Show and Tell
Greach 2018: Surviving Microservices
Event storage in a distributed system
Harnessing Spark and Cassandra with Groovy
Surviving in a microservices environment
Surviving in a Microservices Environment
An Introduction to jOOQ
Richer Data History with Event Sourcing (SpringOne 2GX 2015
Gr8conf US 2015 - Intro to Event Sourcing with Groovy
Advanced Microservices - Greach 2015
Richer data-history-event-sourcing
Managing a Microservices Development Team (And advanced Microservice concerns)
Reactive Microservice Architecture with Groovy and Grails
Why Reactive Architecture Will Take Over The World (and why we should be wary...
Richer Data History in Groovy with Event Sourcing
Distributed Reactive Architecture: Extending SOA with Events

Recently uploaded (20)

PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Digital Strategies for Manufacturing Companies
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
ai tools demonstartion for schools and inter college
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Essential Infomation Tech presentation.pptx
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Odoo Companies in India – Driving Business Transformation.pdf
Adobe Illustrator 28.6 Crack My Vision of Vector Design
How Creative Agencies Leverage Project Management Software.pdf
Digital Strategies for Manufacturing Companies
2025 Textile ERP Trends: SAP, Odoo & Oracle
Design an Analysis of Algorithms I-SECS-1021-03
ai tools demonstartion for schools and inter college
Odoo POS Development Services by CandidRoot Solutions
PTS Company Brochure 2025 (1).pdf.......
Essential Infomation Tech presentation.pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
Softaken Excel to vCard Converter Software.pdf
Operating system designcfffgfgggggggvggggggggg
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Design an Analysis of Algorithms II-SECS-1021-03
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf

An Introduction to Reactive Application, Reactive Streams, and options for JVM