2. SOLUTION ARCHITECT AT EPAM SYSTEMS.
PASSIONATE DEVELOPER, SPEAKER,
ACTIVE MEMBER OF KIEV JUG.
PARTICIPATE IN DIFFERENT EDUCATIONAL
INITIATIVES, ENGINEERING EVENTS AND
JCP/ADOPTJSR PROGRAMS.
MEMBER OF ARCHITECTURE EXCELLENCE
INITIATIVE AND ENGINEERING
PRODUCTIVITY GROUPS IN EPAM.
OLEG TSAL-TSALKO
14. CONFIDENTIAL 14
Reactive Streams spec
Asynchronous stream processing with non-blocking back pressure
The Problem
Handling streams of “live” data
whose volume is not predetermined so that
fast data source does not overwhelm the stream destination
Scope
Minimal set of interfaces, methods and protocols to build
asynchronous streams of data with non-blocking back pressure
20. CONFIDENTIAL 20
Difference to CompletableFuture
If you have a reference to the Future,
it means the task processing an asynchronous result is already
executing!
Deferred - nothing happens before the call to subscribe()
Pull - Subscriber pull the next chunk of data when needed
Push - Producer push new data to Consumer according to demand
CompletableFuture is push only model
ReactiveStreams is deferred pull-push model
27. CONFIDENTIAL 27
Programming model is very similar
Both heavily use operators chaining and lambdas
Java8 Streams
Reactive
Streams
However purpose is different!!!
Reactive Streams operate on
reactive data
and represent data over time
Java8 streams operate on
collections
and have all or nothing semantics
28. CONFIDENTIAL 28
Reactive streams lifecycle
• Assembly-time: When you compose your stream
just().subscribeOn().map()
• Subscription-time: When Subscriber subscribes to a stream
and it triggers a "storm" of subscriptions under the hood
• Runtime: When items are generated followed by zero or one
terminal event of error/completion