SlideShare a Scribd company logo
1
Reactive Java: Promises and
Streams with Reakt
Geoff Chandler and Rick Hightower
2
Speaker Introduction
Geoff Chandler (@SailorGeoff)
Rick Hightower (@RickHigh)
3
What is Reakt in 30 seconds!
4
Reakt
General purpose library for callback coordination and streams
Implements JavaScript style Promises and adapts them to a MT world
Can be used with
Reactor pattern systems,
actor system, event bus system,
and traditional forms of async Java programming
Lambda expression friendly
5
Fluent Lambda Friendly Promise API
6
About the Project
7
Goals
Small and focused
Easy-to-use
Lambda friendly
Scalar async calls, and streams
Fluent
Evolve it (no change for the sake of change but get it right)
Semantic versioning
8
More Project Goals
Should work with
actor model
MT model
Reactor Pattern (event loop)
Supports
Async call coordination
Complex call coordination
and streams
9
Problem: Async Coordination is Tricky
Results can comeback on foreign threads
Call several async services, one fails or times out? Now what?
Need to combine results of several calls before you can respond to the caller
What if a downstream service goes down?
What if your async handler throws an exception?
You can’t use a blocking future, or you will tie up the event handling thread
How do you test async services using a standard unit test framework?
10
Status
We use it often. We like it.
Integration libs for Guava, Vert.x, Netty (in the works), Kinesis, Cassandra,
DynamoDB, etc.
Write async call handling for Lokate, and Elekt
QBit now uses it instead of its own callbacks and async coordination
Version 3.1 has major stability improvements (a lot of work was done)
Version 4 - Major update to simplify and refine interfaces (after JavaOne)
Won’t change how it is used, but will clean up the interfaces and 11
Open Source on GitHub - We use it
12
How we got here. Why Promises?
13
Implementations of Reactor Pattern
Browser DOM model and client side JavaScript
AWT/GTK+/Windows C API
Twisted - Python
Akka's I/O Layer Architecture
Node.js - JavaScript
Vert.x - (Netty)
Multi-Reactor pattern
Spring 5 Reactor 14
Our experience with Async, Reactor Pattern, and Actors
Worked with Actor system / high-speed messaging / PoCs (2011)
Used Vert.x to handle large amount of traffic on less resources (2012)
Wrote QBit to batch stream service calls to optimize thread-hand off
and IO throughput (2013)
Needed high-speed call coordination for OAuth rate limiter (2014)
fronting many backend services
Worked on QBit Reactor but interface was better than before
but still too complicated
Worked on many microservices in 12 factor cloud env - lots of async
call coordination and circuit breaker - lots of retries (2015)
15
Why async, responsive and reactive?
Reactive Manifesto - what is it and why it matters
Reactor Pattern - Most common form of reactive programming, adopts
Promises
Microservices
Async programming prefered for resiliency
Avoiding cascading failures (“synchronous calls considered harmful”)
Async programming is key: How do you manages async call coordination?
16
Why the Semantics of ES6 Promises?
17
Reactor Pattern
Reactor pattern:
event-driven,
handlers register for events,
events can come from multiple sources,
single-threaded system - for handling events
handles multiple event loops
Can aggregate events from other IO threads
What is the most popular Reactor Pattern ecosystem? Oldest? Most
18
Promise from most popular Reactor system
AHA : This looks nice and makes sense
JS client side most popular reactor pattern of all time
What does JavaScript use to simplify async callback coordination?
Promises!
Node.js
Most popular server-side reactor pattern, and growing
What does JavaScript use to simplify async callback coordination?
Promises!
Reakt was born! 19
AHA Moment!
Wrote client libs in Java with Reakt Promises and ES6
(JavaScript) with/Promises
Code looked very similar
Semantics were same
Slight syntactic differences
“Wow!” That is clean
Hard to look at old way 20
Reakt Details
21
Reakt Concepts
Promise: Handler for registering events from an async call
Callback: Handler for resolving responses to an async call (scalar async result) / Mostly
internal
Stream: Like a Callback but has N numbers or results (stream of results)
Breaker: Async circuit breakers
Expected: Results that could be missing
Reactor: Replays callbacks on Actor, Verticle or event handler thread (event loop)
repeating tasks, delay tasks
Result: Async result, success, failure, result from a Callback or Stream
22
Promise
23
Promise Concepts
Like ES6 promises can be:
Completed States:
Resolved: callback/action relating to the promise succeeded
Rejected: callback/action relating to the promise failed
When a promise has been resolved or rejected it is marked completed
Completed: callback/action has been fulfilled/resolved or rejected
24
ES6 Promise vs Reakt
25
Special concerns with Java MT
JavaScript is single-threaded - Java is not.
Three types of Reakt promises:
Callback promises (async) (Promise)
Blocking promises (for unit testing and legacy integration)
(BlockingPromise)
Replay promises (ReplayPromise)
allow promises to be handled on the same thread as caller
Works with Vert.x verticles, QBit service actors, other actors and even bus reactor (Netty)
26
Using Promise
27
Handler methods
then() - use handle result of async calls
thenExpected() - use handle async calls whose result could be null
thenSafe() - like then but handles exception from handler
thenSafeExpected() - same as thenSafe but result could be null
catchError() - handles an exception
28
Promises.all
Promises.all(promises)
You create a promise whose then or catchError trigger (it resolves) when all
promises passed async return (all resolve)
If any promise fails, the all promise fails
29
Promises.all
30
Promises.any
Promise.any(promises)
Creates promise that resolves or rejects
as soon as one of the promises resolves
31
Promises.any() and Promise.all()
323232
Promises.invokeablePromise (Reakt-Guava)
33
Easy to integrate w/ async libs - reakt-vertx
34
Reactor
35
Reactor
Manages callbacks (ReplayPromises) that execute in caller's thread (thread
safe, async callbacks)
Promise handlers that are triggered in caller’s thread
Timeouts for async calls
Manages tasks that run in the caller's thread
Repeating tasks that run in a caller's thread
one shot timed tasks that run in the caller's thread
Adapts to event loop, Verticle, Actor 36
Notable Reactor Methods
addRepeatingTask(interval, runnable) add a task that repeats every interval
runTaskAfter(afterInterval, runnable) run a task after an interval expires
deferRun(runnable) run a task on this thread as soon as you can
all(...) creates a all promise; resolves with Reactor (you can pass a timeout)
any(...) create any promise with Reactor (you can pass a timeout)
promise() creates a ReplayPromise so Reactor manages promise (you can
pass a timeout)
37
38
39
Reactor, any, all, timeouts
Promise to queue
Promises to store todo in
NoSQL tables
Circuit breaker
40
Circuit Breaker
Breaker is short for circuit breaker
Wraps access to a service, resource, repo, connection, queue, etc.
Tracks errors which can trigger the breaker to open
Breaker is just an interface / contract
Implementers can be creative in what is considered an open or broken breaker
41
42
Come to the lab tomorrow to
See a full use case using
Async circuit breakers
Using breaker
4343
Blocking promises
44
Blocking promises
Legacy integration
Unit testing
Prototypes
Batch jobs that don’t need async
(so you don’t have to have two libs)
45
Unit test using blocking promise using invokeAsBlockingPromise then blockingGet
46
Stream
47
Stream
Handler for N results
While a Callback and Promise is for one Result, a Stream is for N results
Callback/Promise for Scalar returns
Stream is for many returns
Similar to Java 9 Flow, RxJava or Reactive Streams
Java 8/9 lambda expression friendly
(Fuller example as extra material on slide deck depending on time go to
end of slide deck or just cover next two slides) 48
streamResult.cancel(), streamResult.request(count)
49
streamResult.cancel(), streamResult.request(count) (part 2)
50
Fuller
Examples
In Hands-On Lab
Come
Tomorrow
Example that combines Reakt:
Reactor/Stream/Promises
51
Example Recommendation Service
Recommendation service
Watch what user does, then suggest recommended items
Recommendation service runs many recommendation engines per microservice
52
Worked example will show
53
User recommendation service
Delay giving recommendations to a user
until that user is loaded from a backend
service store
Users are streamed in (uses streams)
Stream comes in on foreign thread and we
use reactor to move handler to service actor
thread
If user is already in service actor, then
recommend a list of recommendations right
away
If user not in system, batch load user from
backend service store
Requests are batched to reduce IO overhead
Users can come from many sources from
service store (cache, disk cache, DB), and are
delivered as soon as found in a continuous
stream of user lists
Async call
recommendation
engine if user
present
If not add user id to
call batch, add to
outstanding call for
user.
54
Every 50 ms check to see if the
userIdsToLoad is greater than 0,
If so request those users now.
When a user is not found
loadUserFromStoreService is
called. If there are 100,
outstanding requests, then load
those users now.
Listen to the userStoreService’s
userStream
55
Process the stream
result.
Populate the user map
(or use a Simple cache
with an expiry and a
max number of users
allowed to be in
system).
Since the user is now
loaded, see if their are
outstanding calls
(promises) and resolve
those calls.
56
Next steps
57
Next steps
1)Get rid of invoke and detect when a frame drops (let Geoff explain this
one)
2)Simplify interface for Promise/Callback Reakt 4.0
a) We use semantic versioning, but even from version to version so far interfaces are fairly
compatible for 97% of use cases
3)More reakt libs ***
4)Refine streaming interface
5)Add more support for Vert.x reakt
a) Support streaming via Reakt 58
Related Talks
59
Conclusion
Reakt provides an easy-to-use lib for handling async callbacks
It uses Promise concepts from ES6 which seem well thought out and natural
We worked with many async libs and wrote a few our self, and really like the ES6
terminology and ease of use
Since Java is MT and JavaScript is not there are some differences
Java 8/9 lambda expression friendly
Async call coordination can be difficult but all promises, any promises,
reactor with replay promises and timeouts make it easier
Reakt is evolving and we welcome feedback and contributions (bug 60
Extra Material
61
Author Bio
62
Author Geoff Chandler
Senior Director at a large Media Company.
Works with Node.js, Cassandra, Mesos, QBit, EC2, and reactive programming. Major
Contributor to QBit, Spring Boot, Reakt, and more.
Creator of Lokate, ddp-client-java, guicefx, and various devops tools for gradle.
63
Author Bio Rick Hightower
Rick frequently writes about and develops high-speed microservices. He focuses on
streaming, monitoring, alerting, and deploying microservices. He was the founding
developer of QBit and Reakt as well as Boon.
64
Worked example
These are extra slides for a worked stream
example
65
Example
Take from a real world scenario which gave birth to use using Vert.x, and later creating
QBit and Reakt
Example uses Streams, and Promises
This is not the actual code from the actual project (this is just an example)
66
Block diagram of a HSRM system we built
67
68
Async call
recommendation
engine if user
present
If not add user id to
call batch, add to
outstanding call for
user.
69
Adding an outstanding call (promise)
70
Every 50 ms check to see if the
userIdsToLoad is greater than 0,
If so request those users now.
When a user is not found
loadUserFromStoreService is
called. If there are 100,
outstanding requests, then load
those users now.
Listen to the userStoreService’s
userStream
71
Process the stream
result.
Populate the user map
(or use a Simple cache
with an expiry and a
max number of users
allowed to be in
system).
Since the user is now
loaded, see if their are
outstanding calls
(promises) and resolve
those calls.
72
Slides we pulled out
73
Streams vs Service Calls
Microservices / RESTful services / SOA services
REST / HTTP calls common denominator
Even messaging can be request/reply
Streams vs. Service Calls
Level of abstraction differences,
Calls can be streamed, Results can be streamed
What level of abstraction fits the problem you are trying to solve
Are streams an implementation details or a direct concept?
74
Related projects
QBit Java Microservice (built on top of Vert.x for IO)
Using Reakt reactor to manage callbacks,
REST and WebSocket services (WebSocket RPC) use Reakt Promises and Reakt Callbacks
Lokate - service discovery lib for DNS-A, DNS-SRV, Consul, Mesos,
Marathon
Uses Reakt invokeable promises (Vert.x for IO)
Elekt - leadership lib that uses tools like Consul to do leadership election
(uses promises)
Reakt-Guava - Reakt Bridge to Guava listable futures 75
Promise
Promises can be used for all manners of async
programming
not just Reactor Pattern
You can use it with standard Java Lib
Bridges for Guava, Vert.x and Cassandra
QBit uses it (Service Actor/Microservices),
Lokate (Discovery), 76
Other Async Models
Messaging (Golang, Erlang, RabbitMQ, JMS, Kafka)
Actors (Erlang, Akka)
Active Objects (Akka types actors, DCOM)
Common problems when dealing with handling calls to
services:
Handling the call
77
Reactor works with
Works with Reactor Architecture (Vert.x, Spring Reactor )
Works with Actor model and Active Objects (Akka actors, Akka typed actor,
QBit, etc.)
ReplayPromises need a Reactor
Reactor is an interface
Replace it with one optimized for your environment
Or manage ReplayPromises and tasks with something else like a
Reactor
78
Review
Most of these
Should be familiar to you
79

More Related Content

What's hot

Kafka reliability velocity 17
Kafka reliability   velocity 17Kafka reliability   velocity 17
Kafka reliability velocity 17
Gwen (Chen) Shapira
 
Reactive Streams 1.0 and Akka Streams
Reactive Streams 1.0 and Akka StreamsReactive Streams 1.0 and Akka Streams
Reactive Streams 1.0 and Akka Streams
Dean Wampler
 
Deep dive into Apache Kafka consumption
Deep dive into Apache Kafka consumptionDeep dive into Apache Kafka consumption
Deep dive into Apache Kafka consumption
Alexandre Tamborrino
 
Troubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolutionTroubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolution
Joel Koshy
 
Reducing Microservice Complexity with Kafka and Reactive Streams
Reducing Microservice Complexity with Kafka and Reactive StreamsReducing Microservice Complexity with Kafka and Reactive Streams
Reducing Microservice Complexity with Kafka and Reactive Streams
jimriecken
 
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland KuhnReactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Zalando Technology
 
Deep Dive into the Pulsar Binary Protocol - Pulsar Virtual Summit Europe 2021
Deep Dive into the Pulsar Binary Protocol - Pulsar Virtual Summit Europe 2021Deep Dive into the Pulsar Binary Protocol - Pulsar Virtual Summit Europe 2021
Deep Dive into the Pulsar Binary Protocol - Pulsar Virtual Summit Europe 2021
StreamNative
 
Netflix Data Pipeline With Kafka
Netflix Data Pipeline With KafkaNetflix Data Pipeline With Kafka
Netflix Data Pipeline With Kafka
Steven Wu
 
Kafka Cluster Federation at Uber (Yupeng Fui & Xiaoman Dong, Uber) Kafka Summ...
Kafka Cluster Federation at Uber (Yupeng Fui & Xiaoman Dong, Uber) Kafka Summ...Kafka Cluster Federation at Uber (Yupeng Fui & Xiaoman Dong, Uber) Kafka Summ...
Kafka Cluster Federation at Uber (Yupeng Fui & Xiaoman Dong, Uber) Kafka Summ...
confluent
 
Bulletproof Kafka with Fault Tree Analysis (Andrey Falko, Lyft) Kafka Summit ...
Bulletproof Kafka with Fault Tree Analysis (Andrey Falko, Lyft) Kafka Summit ...Bulletproof Kafka with Fault Tree Analysis (Andrey Falko, Lyft) Kafka Summit ...
Bulletproof Kafka with Fault Tree Analysis (Andrey Falko, Lyft) Kafka Summit ...
confluent
 
Developing Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache KafkaDeveloping Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache Kafka
Joe Stein
 
Kafka 0.8.0 Presentation to Atlanta Java User's Group March 2013
Kafka 0.8.0 Presentation to Atlanta Java User's Group March 2013Kafka 0.8.0 Presentation to Atlanta Java User's Group March 2013
Kafka 0.8.0 Presentation to Atlanta Java User's Group March 2013
Christopher Curtin
 
Strata+Hadoop 2017 San Jose: Lessons from a year of supporting Apache Kafka
Strata+Hadoop 2017 San Jose: Lessons from a year of supporting Apache KafkaStrata+Hadoop 2017 San Jose: Lessons from a year of supporting Apache Kafka
Strata+Hadoop 2017 San Jose: Lessons from a year of supporting Apache Kafka
confluent
 
Sharing is Caring: Toward Creating Self-tuning Multi-tenant Kafka (Anna Povzn...
Sharing is Caring: Toward Creating Self-tuning Multi-tenant Kafka (Anna Povzn...Sharing is Caring: Toward Creating Self-tuning Multi-tenant Kafka (Anna Povzn...
Sharing is Caring: Toward Creating Self-tuning Multi-tenant Kafka (Anna Povzn...
HostedbyConfluent
 
Stream-Native Processing with Pulsar Functions
Stream-Native Processing with Pulsar FunctionsStream-Native Processing with Pulsar Functions
Stream-Native Processing with Pulsar Functions
Streamlio
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
Viswanath J
 
Let the alpakka pull your stream
Let the alpakka pull your streamLet the alpakka pull your stream
Let the alpakka pull your stream
Enno Runne
 
Consumer offset management in Kafka
Consumer offset management in KafkaConsumer offset management in Kafka
Consumer offset management in Kafka
Joel Koshy
 
KafkaConsumer - Decoupling Consumption and Processing for Better Resource Uti...
KafkaConsumer - Decoupling Consumption and Processing for Better Resource Uti...KafkaConsumer - Decoupling Consumption and Processing for Better Resource Uti...
KafkaConsumer - Decoupling Consumption and Processing for Better Resource Uti...
confluent
 
Grokking TechTalk #24: Kafka's principles and protocols
Grokking TechTalk #24: Kafka's principles and protocolsGrokking TechTalk #24: Kafka's principles and protocols
Grokking TechTalk #24: Kafka's principles and protocols
Grokking VN
 

What's hot (20)

Kafka reliability velocity 17
Kafka reliability   velocity 17Kafka reliability   velocity 17
Kafka reliability velocity 17
 
Reactive Streams 1.0 and Akka Streams
Reactive Streams 1.0 and Akka StreamsReactive Streams 1.0 and Akka Streams
Reactive Streams 1.0 and Akka Streams
 
Deep dive into Apache Kafka consumption
Deep dive into Apache Kafka consumptionDeep dive into Apache Kafka consumption
Deep dive into Apache Kafka consumption
 
Troubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolutionTroubleshooting Kafka's socket server: from incident to resolution
Troubleshooting Kafka's socket server: from incident to resolution
 
Reducing Microservice Complexity with Kafka and Reactive Streams
Reducing Microservice Complexity with Kafka and Reactive StreamsReducing Microservice Complexity with Kafka and Reactive Streams
Reducing Microservice Complexity with Kafka and Reactive Streams
 
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland KuhnReactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
Reactive Design Patterns: a talk by Typesafe's Dr. Roland Kuhn
 
Deep Dive into the Pulsar Binary Protocol - Pulsar Virtual Summit Europe 2021
Deep Dive into the Pulsar Binary Protocol - Pulsar Virtual Summit Europe 2021Deep Dive into the Pulsar Binary Protocol - Pulsar Virtual Summit Europe 2021
Deep Dive into the Pulsar Binary Protocol - Pulsar Virtual Summit Europe 2021
 
Netflix Data Pipeline With Kafka
Netflix Data Pipeline With KafkaNetflix Data Pipeline With Kafka
Netflix Data Pipeline With Kafka
 
Kafka Cluster Federation at Uber (Yupeng Fui & Xiaoman Dong, Uber) Kafka Summ...
Kafka Cluster Federation at Uber (Yupeng Fui & Xiaoman Dong, Uber) Kafka Summ...Kafka Cluster Federation at Uber (Yupeng Fui & Xiaoman Dong, Uber) Kafka Summ...
Kafka Cluster Federation at Uber (Yupeng Fui & Xiaoman Dong, Uber) Kafka Summ...
 
Bulletproof Kafka with Fault Tree Analysis (Andrey Falko, Lyft) Kafka Summit ...
Bulletproof Kafka with Fault Tree Analysis (Andrey Falko, Lyft) Kafka Summit ...Bulletproof Kafka with Fault Tree Analysis (Andrey Falko, Lyft) Kafka Summit ...
Bulletproof Kafka with Fault Tree Analysis (Andrey Falko, Lyft) Kafka Summit ...
 
Developing Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache KafkaDeveloping Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache Kafka
 
Kafka 0.8.0 Presentation to Atlanta Java User's Group March 2013
Kafka 0.8.0 Presentation to Atlanta Java User's Group March 2013Kafka 0.8.0 Presentation to Atlanta Java User's Group March 2013
Kafka 0.8.0 Presentation to Atlanta Java User's Group March 2013
 
Strata+Hadoop 2017 San Jose: Lessons from a year of supporting Apache Kafka
Strata+Hadoop 2017 San Jose: Lessons from a year of supporting Apache KafkaStrata+Hadoop 2017 San Jose: Lessons from a year of supporting Apache Kafka
Strata+Hadoop 2017 San Jose: Lessons from a year of supporting Apache Kafka
 
Sharing is Caring: Toward Creating Self-tuning Multi-tenant Kafka (Anna Povzn...
Sharing is Caring: Toward Creating Self-tuning Multi-tenant Kafka (Anna Povzn...Sharing is Caring: Toward Creating Self-tuning Multi-tenant Kafka (Anna Povzn...
Sharing is Caring: Toward Creating Self-tuning Multi-tenant Kafka (Anna Povzn...
 
Stream-Native Processing with Pulsar Functions
Stream-Native Processing with Pulsar FunctionsStream-Native Processing with Pulsar Functions
Stream-Native Processing with Pulsar Functions
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Let the alpakka pull your stream
Let the alpakka pull your streamLet the alpakka pull your stream
Let the alpakka pull your stream
 
Consumer offset management in Kafka
Consumer offset management in KafkaConsumer offset management in Kafka
Consumer offset management in Kafka
 
KafkaConsumer - Decoupling Consumption and Processing for Better Resource Uti...
KafkaConsumer - Decoupling Consumption and Processing for Better Resource Uti...KafkaConsumer - Decoupling Consumption and Processing for Better Resource Uti...
KafkaConsumer - Decoupling Consumption and Processing for Better Resource Uti...
 
Grokking TechTalk #24: Kafka's principles and protocols
Grokking TechTalk #24: Kafka's principles and protocolsGrokking TechTalk #24: Kafka's principles and protocols
Grokking TechTalk #24: Kafka's principles and protocols
 

Viewers also liked

Netty Notes Part 3 - Channel Pipeline and EventLoops
Netty Notes Part 3 - Channel Pipeline and EventLoopsNetty Notes Part 3 - Channel Pipeline and EventLoops
Netty Notes Part 3 - Channel Pipeline and EventLoops
Rick Hightower
 
Speedment - Reactive programming for Java8
Speedment - Reactive programming for Java8Speedment - Reactive programming for Java8
Speedment - Reactive programming for Java8
Speedment, Inc.
 
Hybrid project management methodology
Hybrid project management methodologyHybrid project management methodology
Hybrid project management methodology
David Robins
 
Asynchronous Data Processing
Asynchronous Data ProcessingAsynchronous Data Processing
Asynchronous Data Processing
Rahul Singh
 
Laimonas Lileika — Hybrid Project Management: Excellence Behind a Buzzword
Laimonas Lileika — Hybrid Project Management: Excellence Behind a BuzzwordLaimonas Lileika — Hybrid Project Management: Excellence Behind a Buzzword
Laimonas Lileika — Hybrid Project Management: Excellence Behind a Buzzword
AgileLAB
 
Hybrid approach for project management,9 10-2012
Hybrid approach for project management,9 10-2012Hybrid approach for project management,9 10-2012
Hybrid approach for project management,9 10-2012
Niranjan Nerlige V, CSM,CSP,PMI-ACP,SPC
 
SenchaCon 2016 - How to Auto Generate a Back-end in Minutes
SenchaCon 2016 - How to Auto Generate a Back-end in MinutesSenchaCon 2016 - How to Auto Generate a Back-end in Minutes
SenchaCon 2016 - How to Auto Generate a Back-end in Minutes
Speedment, Inc.
 
2016 Mastering SAP Tech - 2 Speed IT and lessons from an Agile Waterfall eCom...
2016 Mastering SAP Tech - 2 Speed IT and lessons from an Agile Waterfall eCom...2016 Mastering SAP Tech - 2 Speed IT and lessons from an Agile Waterfall eCom...
2016 Mastering SAP Tech - 2 Speed IT and lessons from an Agile Waterfall eCom...
Eneko Jon Bilbao
 
Notes on Netty baics
Notes on Netty baicsNotes on Netty baics
Notes on Netty baics
Rick Hightower
 
Introduction to Composer for Drupal
Introduction to Composer for DrupalIntroduction to Composer for Drupal
Introduction to Composer for Drupal
Luc Bézier
 
Management of Distributed Transactions
Management of Distributed TransactionsManagement of Distributed Transactions
Management of Distributed Transactions
Ankita Dubey
 
Applying both Agile and Waterfall in one project
Applying both Agile and Waterfall in one projectApplying both Agile and Waterfall in one project
Applying both Agile and Waterfall in one project
Maksym Dovgopolyi, PMP
 
WebSocket MicroService vs. REST Microservice
WebSocket MicroService vs. REST MicroserviceWebSocket MicroService vs. REST Microservice
WebSocket MicroService vs. REST Microservice
Rick Hightower
 
Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016
Ben Lesh
 
Apache AVRO (Boston HUG, Jan 19, 2010)
Apache AVRO (Boston HUG, Jan 19, 2010)Apache AVRO (Boston HUG, Jan 19, 2010)
Apache AVRO (Boston HUG, Jan 19, 2010)Cloudera, Inc.
 

Viewers also liked (15)

Netty Notes Part 3 - Channel Pipeline and EventLoops
Netty Notes Part 3 - Channel Pipeline and EventLoopsNetty Notes Part 3 - Channel Pipeline and EventLoops
Netty Notes Part 3 - Channel Pipeline and EventLoops
 
Speedment - Reactive programming for Java8
Speedment - Reactive programming for Java8Speedment - Reactive programming for Java8
Speedment - Reactive programming for Java8
 
Hybrid project management methodology
Hybrid project management methodologyHybrid project management methodology
Hybrid project management methodology
 
Asynchronous Data Processing
Asynchronous Data ProcessingAsynchronous Data Processing
Asynchronous Data Processing
 
Laimonas Lileika — Hybrid Project Management: Excellence Behind a Buzzword
Laimonas Lileika — Hybrid Project Management: Excellence Behind a BuzzwordLaimonas Lileika — Hybrid Project Management: Excellence Behind a Buzzword
Laimonas Lileika — Hybrid Project Management: Excellence Behind a Buzzword
 
Hybrid approach for project management,9 10-2012
Hybrid approach for project management,9 10-2012Hybrid approach for project management,9 10-2012
Hybrid approach for project management,9 10-2012
 
SenchaCon 2016 - How to Auto Generate a Back-end in Minutes
SenchaCon 2016 - How to Auto Generate a Back-end in MinutesSenchaCon 2016 - How to Auto Generate a Back-end in Minutes
SenchaCon 2016 - How to Auto Generate a Back-end in Minutes
 
2016 Mastering SAP Tech - 2 Speed IT and lessons from an Agile Waterfall eCom...
2016 Mastering SAP Tech - 2 Speed IT and lessons from an Agile Waterfall eCom...2016 Mastering SAP Tech - 2 Speed IT and lessons from an Agile Waterfall eCom...
2016 Mastering SAP Tech - 2 Speed IT and lessons from an Agile Waterfall eCom...
 
Notes on Netty baics
Notes on Netty baicsNotes on Netty baics
Notes on Netty baics
 
Introduction to Composer for Drupal
Introduction to Composer for DrupalIntroduction to Composer for Drupal
Introduction to Composer for Drupal
 
Management of Distributed Transactions
Management of Distributed TransactionsManagement of Distributed Transactions
Management of Distributed Transactions
 
Applying both Agile and Waterfall in one project
Applying both Agile and Waterfall in one projectApplying both Agile and Waterfall in one project
Applying both Agile and Waterfall in one project
 
WebSocket MicroService vs. REST Microservice
WebSocket MicroService vs. REST MicroserviceWebSocket MicroService vs. REST Microservice
WebSocket MicroService vs. REST Microservice
 
Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016Async Redux Actions With RxJS - React Rally 2016
Async Redux Actions With RxJS - React Rally 2016
 
Apache AVRO (Boston HUG, Jan 19, 2010)
Apache AVRO (Boston HUG, Jan 19, 2010)Apache AVRO (Boston HUG, Jan 19, 2010)
Apache AVRO (Boston HUG, Jan 19, 2010)
 

Similar to Reactive Java: Promises and Streams with Reakt (JavaOne Talk 2016)

Project Reactor Now and Tomorrow
Project Reactor Now and TomorrowProject Reactor Now and Tomorrow
Project Reactor Now and Tomorrow
VMware Tanzu
 
The value of reactive
The value of reactiveThe value of reactive
The value of reactive
Stéphane Maldini
 
The Value of Reactive
The Value of ReactiveThe Value of Reactive
The Value of Reactive
VMware Tanzu
 
20160609 nike techtalks reactive applications tools of the trade
20160609 nike techtalks reactive applications   tools of the trade20160609 nike techtalks reactive applications   tools of the trade
20160609 nike techtalks reactive applications tools of the trade
shinolajla
 
Vert.x for Microservices Architecture
Vert.x for Microservices ArchitectureVert.x for Microservices Architecture
Vert.x for Microservices Architecture
Idan Fridman
 
Reactive mesh
Reactive meshReactive mesh
Reactive mesh
Kalin Maldzhanski
 
Reactive programming with examples
Reactive programming with examplesReactive programming with examples
Reactive programming with examples
Peter Lawrey
 
Springone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and ReactorSpringone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and Reactor
Stéphane Maldini
 
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
Elixir Club
 
Reactive Applications with Apache Pulsar and Spring Boot
Reactive Applications with Apache Pulsar and Spring BootReactive Applications with Apache Pulsar and Spring Boot
Reactive Applications with Apache Pulsar and Spring Boot
VMware Tanzu
 
React gsg presentation with ryan jung & elias malik
React   gsg presentation with ryan jung & elias malikReact   gsg presentation with ryan jung & elias malik
React gsg presentation with ryan jung & elias malik
Lama K Banna
 
Reactive Qt - Ivan Čukić (Qt World Summit 2015)
Reactive Qt - Ivan Čukić (Qt World Summit 2015)Reactive Qt - Ivan Čukić (Qt World Summit 2015)
Reactive Qt - Ivan Čukić (Qt World Summit 2015)
Ivan Čukić
 
Reactors.io
Reactors.ioReactors.io
Reactors.io
Knoldus Inc.
 
How to debug slow lambda response times
How to debug slow lambda response timesHow to debug slow lambda response times
How to debug slow lambda response times
Yan Cui
 
Beyond fault tolerance with actor programming - Fabio Tiriticco - Codemotion ...
Beyond fault tolerance with actor programming - Fabio Tiriticco - Codemotion ...Beyond fault tolerance with actor programming - Fabio Tiriticco - Codemotion ...
Beyond fault tolerance with actor programming - Fabio Tiriticco - Codemotion ...
Codemotion
 
Beyond Fault Tolerance with Actor Programming
Beyond Fault Tolerance with Actor ProgrammingBeyond Fault Tolerance with Actor Programming
Beyond Fault Tolerance with Actor Programming
Fabio Tiriticco
 
Functional reactive programming
Functional reactive programmingFunctional reactive programming
Functional reactive programming
Araf Karsh Hamid
 
Reactive Card Magic: Understanding Spring WebFlux and Project Reactor
Reactive Card Magic: Understanding Spring WebFlux and Project ReactorReactive Card Magic: Understanding Spring WebFlux and Project Reactor
Reactive Card Magic: Understanding Spring WebFlux and Project Reactor
VMware Tanzu
 

Similar to Reactive Java: Promises and Streams with Reakt (JavaOne Talk 2016) (20)

Project Reactor Now and Tomorrow
Project Reactor Now and TomorrowProject Reactor Now and Tomorrow
Project Reactor Now and Tomorrow
 
The value of reactive
The value of reactiveThe value of reactive
The value of reactive
 
The Value of Reactive
The Value of ReactiveThe Value of Reactive
The Value of Reactive
 
20160609 nike techtalks reactive applications tools of the trade
20160609 nike techtalks reactive applications   tools of the trade20160609 nike techtalks reactive applications   tools of the trade
20160609 nike techtalks reactive applications tools of the trade
 
Akka (1)
Akka (1)Akka (1)
Akka (1)
 
Vert.x for Microservices Architecture
Vert.x for Microservices ArchitectureVert.x for Microservices Architecture
Vert.x for Microservices Architecture
 
Reactive mesh
Reactive meshReactive mesh
Reactive mesh
 
Reactive programming with examples
Reactive programming with examplesReactive programming with examples
Reactive programming with examples
 
Springone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and ReactorSpringone2gx 2014 Reactive Streams and Reactor
Springone2gx 2014 Reactive Streams and Reactor
 
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
Performance measurement methodology — Maksym Pugach | Elixir Evening Club 3
 
Reactive Applications with Apache Pulsar and Spring Boot
Reactive Applications with Apache Pulsar and Spring BootReactive Applications with Apache Pulsar and Spring Boot
Reactive Applications with Apache Pulsar and Spring Boot
 
React gsg presentation with ryan jung & elias malik
React   gsg presentation with ryan jung & elias malikReact   gsg presentation with ryan jung & elias malik
React gsg presentation with ryan jung & elias malik
 
Reactive Qt - Ivan Čukić (Qt World Summit 2015)
Reactive Qt - Ivan Čukić (Qt World Summit 2015)Reactive Qt - Ivan Čukić (Qt World Summit 2015)
Reactive Qt - Ivan Čukić (Qt World Summit 2015)
 
Reactors.io
Reactors.ioReactors.io
Reactors.io
 
How to debug slow lambda response times
How to debug slow lambda response timesHow to debug slow lambda response times
How to debug slow lambda response times
 
Beyond fault tolerance with actor programming - Fabio Tiriticco - Codemotion ...
Beyond fault tolerance with actor programming - Fabio Tiriticco - Codemotion ...Beyond fault tolerance with actor programming - Fabio Tiriticco - Codemotion ...
Beyond fault tolerance with actor programming - Fabio Tiriticco - Codemotion ...
 
Beyond Fault Tolerance with Actor Programming
Beyond Fault Tolerance with Actor ProgrammingBeyond Fault Tolerance with Actor Programming
Beyond Fault Tolerance with Actor Programming
 
Functional reactive programming
Functional reactive programmingFunctional reactive programming
Functional reactive programming
 
Building Web APIs that Scale
Building Web APIs that ScaleBuilding Web APIs that Scale
Building Web APIs that Scale
 
Reactive Card Magic: Understanding Spring WebFlux and Project Reactor
Reactive Card Magic: Understanding Spring WebFlux and Project ReactorReactive Card Magic: Understanding Spring WebFlux and Project Reactor
Reactive Card Magic: Understanding Spring WebFlux and Project Reactor
 

More from Rick Hightower

JParse Fast JSON Parser
JParse Fast JSON ParserJParse Fast JSON Parser
JParse Fast JSON Parser
Rick Hightower
 
Service Mesh Talk for CTO Forum
Service Mesh Talk for CTO ForumService Mesh Talk for CTO Forum
Service Mesh Talk for CTO Forum
Rick Hightower
 
Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)
Rick Hightower
 
Accelerate Delivery: Business Case for Agile DevOps, CI/CD and Microservices
Accelerate Delivery: Business Case for Agile DevOps, CI/CD and MicroservicesAccelerate Delivery: Business Case for Agile DevOps, CI/CD and Microservices
Accelerate Delivery: Business Case for Agile DevOps, CI/CD and Microservices
Rick Hightower
 
Accelerate Delivery: Business case for Agile DevOps, CI/CD and Microservices
Accelerate Delivery: Business case for Agile DevOps, CI/CD and MicroservicesAccelerate Delivery: Business case for Agile DevOps, CI/CD and Microservices
Accelerate Delivery: Business case for Agile DevOps, CI/CD and Microservices
Rick Hightower
 
Accelerate DevOps/Microservices and Kubernetes
Accelerate DevOps/Microservices and KubernetesAccelerate DevOps/Microservices and Kubernetes
Accelerate DevOps/Microservices and Kubernetes
Rick Hightower
 
Accelerate using DevOps and CI/CD.
Accelerate using DevOps and CI/CD.Accelerate using DevOps and CI/CD.
Accelerate using DevOps and CI/CD.
Rick Hightower
 
Netty Notes Part 2 - Transports and Buffers
Netty Notes Part 2 - Transports and BuffersNetty Notes Part 2 - Transports and Buffers
Netty Notes Part 2 - Transports and Buffers
Rick Hightower
 
Consul: Microservice Enabling Microservices and Reactive Programming
Consul: Microservice Enabling Microservices and Reactive ProgrammingConsul: Microservice Enabling Microservices and Reactive Programming
Consul: Microservice Enabling Microservices and Reactive Programming
Rick Hightower
 
The Java Microservice Library
The Java Microservice LibraryThe Java Microservice Library
The Java Microservice Library
Rick Hightower
 
Java JSON Benchmark
Java JSON BenchmarkJava JSON Benchmark
Java JSON Benchmark
Rick Hightower
 
MongoDB quickstart for Java, PHP, and Python developers
MongoDB quickstart for Java, PHP, and Python developersMongoDB quickstart for Java, PHP, and Python developers
MongoDB quickstart for Java, PHP, and Python developers
Rick Hightower
 
Mongo DB for Java, Python and PHP Developers
Mongo DB for Java, Python and PHP DevelopersMongo DB for Java, Python and PHP Developers
Mongo DB for Java, Python and PHP Developers
Rick Hightower
 

More from Rick Hightower (13)

JParse Fast JSON Parser
JParse Fast JSON ParserJParse Fast JSON Parser
JParse Fast JSON Parser
 
Service Mesh Talk for CTO Forum
Service Mesh Talk for CTO ForumService Mesh Talk for CTO Forum
Service Mesh Talk for CTO Forum
 
Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)
 
Accelerate Delivery: Business Case for Agile DevOps, CI/CD and Microservices
Accelerate Delivery: Business Case for Agile DevOps, CI/CD and MicroservicesAccelerate Delivery: Business Case for Agile DevOps, CI/CD and Microservices
Accelerate Delivery: Business Case for Agile DevOps, CI/CD and Microservices
 
Accelerate Delivery: Business case for Agile DevOps, CI/CD and Microservices
Accelerate Delivery: Business case for Agile DevOps, CI/CD and MicroservicesAccelerate Delivery: Business case for Agile DevOps, CI/CD and Microservices
Accelerate Delivery: Business case for Agile DevOps, CI/CD and Microservices
 
Accelerate DevOps/Microservices and Kubernetes
Accelerate DevOps/Microservices and KubernetesAccelerate DevOps/Microservices and Kubernetes
Accelerate DevOps/Microservices and Kubernetes
 
Accelerate using DevOps and CI/CD.
Accelerate using DevOps and CI/CD.Accelerate using DevOps and CI/CD.
Accelerate using DevOps and CI/CD.
 
Netty Notes Part 2 - Transports and Buffers
Netty Notes Part 2 - Transports and BuffersNetty Notes Part 2 - Transports and Buffers
Netty Notes Part 2 - Transports and Buffers
 
Consul: Microservice Enabling Microservices and Reactive Programming
Consul: Microservice Enabling Microservices and Reactive ProgrammingConsul: Microservice Enabling Microservices and Reactive Programming
Consul: Microservice Enabling Microservices and Reactive Programming
 
The Java Microservice Library
The Java Microservice LibraryThe Java Microservice Library
The Java Microservice Library
 
Java JSON Benchmark
Java JSON BenchmarkJava JSON Benchmark
Java JSON Benchmark
 
MongoDB quickstart for Java, PHP, and Python developers
MongoDB quickstart for Java, PHP, and Python developersMongoDB quickstart for Java, PHP, and Python developers
MongoDB quickstart for Java, PHP, and Python developers
 
Mongo DB for Java, Python and PHP Developers
Mongo DB for Java, Python and PHP DevelopersMongo DB for Java, Python and PHP Developers
Mongo DB for Java, Python and PHP Developers
 

Recently uploaded

LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
James Anderson
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 

Recently uploaded (20)

LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
Alt. GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using ...
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 

Reactive Java: Promises and Streams with Reakt (JavaOne Talk 2016)

  • 1. 1
  • 2. Reactive Java: Promises and Streams with Reakt Geoff Chandler and Rick Hightower 2
  • 3. Speaker Introduction Geoff Chandler (@SailorGeoff) Rick Hightower (@RickHigh) 3
  • 4. What is Reakt in 30 seconds! 4
  • 5. Reakt General purpose library for callback coordination and streams Implements JavaScript style Promises and adapts them to a MT world Can be used with Reactor pattern systems, actor system, event bus system, and traditional forms of async Java programming Lambda expression friendly 5
  • 6. Fluent Lambda Friendly Promise API 6
  • 8. Goals Small and focused Easy-to-use Lambda friendly Scalar async calls, and streams Fluent Evolve it (no change for the sake of change but get it right) Semantic versioning 8
  • 9. More Project Goals Should work with actor model MT model Reactor Pattern (event loop) Supports Async call coordination Complex call coordination and streams 9
  • 10. Problem: Async Coordination is Tricky Results can comeback on foreign threads Call several async services, one fails or times out? Now what? Need to combine results of several calls before you can respond to the caller What if a downstream service goes down? What if your async handler throws an exception? You can’t use a blocking future, or you will tie up the event handling thread How do you test async services using a standard unit test framework? 10
  • 11. Status We use it often. We like it. Integration libs for Guava, Vert.x, Netty (in the works), Kinesis, Cassandra, DynamoDB, etc. Write async call handling for Lokate, and Elekt QBit now uses it instead of its own callbacks and async coordination Version 3.1 has major stability improvements (a lot of work was done) Version 4 - Major update to simplify and refine interfaces (after JavaOne) Won’t change how it is used, but will clean up the interfaces and 11
  • 12. Open Source on GitHub - We use it 12
  • 13. How we got here. Why Promises? 13
  • 14. Implementations of Reactor Pattern Browser DOM model and client side JavaScript AWT/GTK+/Windows C API Twisted - Python Akka's I/O Layer Architecture Node.js - JavaScript Vert.x - (Netty) Multi-Reactor pattern Spring 5 Reactor 14
  • 15. Our experience with Async, Reactor Pattern, and Actors Worked with Actor system / high-speed messaging / PoCs (2011) Used Vert.x to handle large amount of traffic on less resources (2012) Wrote QBit to batch stream service calls to optimize thread-hand off and IO throughput (2013) Needed high-speed call coordination for OAuth rate limiter (2014) fronting many backend services Worked on QBit Reactor but interface was better than before but still too complicated Worked on many microservices in 12 factor cloud env - lots of async call coordination and circuit breaker - lots of retries (2015) 15
  • 16. Why async, responsive and reactive? Reactive Manifesto - what is it and why it matters Reactor Pattern - Most common form of reactive programming, adopts Promises Microservices Async programming prefered for resiliency Avoiding cascading failures (“synchronous calls considered harmful”) Async programming is key: How do you manages async call coordination? 16
  • 17. Why the Semantics of ES6 Promises? 17
  • 18. Reactor Pattern Reactor pattern: event-driven, handlers register for events, events can come from multiple sources, single-threaded system - for handling events handles multiple event loops Can aggregate events from other IO threads What is the most popular Reactor Pattern ecosystem? Oldest? Most 18
  • 19. Promise from most popular Reactor system AHA : This looks nice and makes sense JS client side most popular reactor pattern of all time What does JavaScript use to simplify async callback coordination? Promises! Node.js Most popular server-side reactor pattern, and growing What does JavaScript use to simplify async callback coordination? Promises! Reakt was born! 19
  • 20. AHA Moment! Wrote client libs in Java with Reakt Promises and ES6 (JavaScript) with/Promises Code looked very similar Semantics were same Slight syntactic differences “Wow!” That is clean Hard to look at old way 20
  • 22. Reakt Concepts Promise: Handler for registering events from an async call Callback: Handler for resolving responses to an async call (scalar async result) / Mostly internal Stream: Like a Callback but has N numbers or results (stream of results) Breaker: Async circuit breakers Expected: Results that could be missing Reactor: Replays callbacks on Actor, Verticle or event handler thread (event loop) repeating tasks, delay tasks Result: Async result, success, failure, result from a Callback or Stream 22
  • 24. Promise Concepts Like ES6 promises can be: Completed States: Resolved: callback/action relating to the promise succeeded Rejected: callback/action relating to the promise failed When a promise has been resolved or rejected it is marked completed Completed: callback/action has been fulfilled/resolved or rejected 24
  • 25. ES6 Promise vs Reakt 25
  • 26. Special concerns with Java MT JavaScript is single-threaded - Java is not. Three types of Reakt promises: Callback promises (async) (Promise) Blocking promises (for unit testing and legacy integration) (BlockingPromise) Replay promises (ReplayPromise) allow promises to be handled on the same thread as caller Works with Vert.x verticles, QBit service actors, other actors and even bus reactor (Netty) 26
  • 28. Handler methods then() - use handle result of async calls thenExpected() - use handle async calls whose result could be null thenSafe() - like then but handles exception from handler thenSafeExpected() - same as thenSafe but result could be null catchError() - handles an exception 28
  • 29. Promises.all Promises.all(promises) You create a promise whose then or catchError trigger (it resolves) when all promises passed async return (all resolve) If any promise fails, the all promise fails 29
  • 31. Promises.any Promise.any(promises) Creates promise that resolves or rejects as soon as one of the promises resolves 31
  • 34. Easy to integrate w/ async libs - reakt-vertx 34
  • 36. Reactor Manages callbacks (ReplayPromises) that execute in caller's thread (thread safe, async callbacks) Promise handlers that are triggered in caller’s thread Timeouts for async calls Manages tasks that run in the caller's thread Repeating tasks that run in a caller's thread one shot timed tasks that run in the caller's thread Adapts to event loop, Verticle, Actor 36
  • 37. Notable Reactor Methods addRepeatingTask(interval, runnable) add a task that repeats every interval runTaskAfter(afterInterval, runnable) run a task after an interval expires deferRun(runnable) run a task on this thread as soon as you can all(...) creates a all promise; resolves with Reactor (you can pass a timeout) any(...) create any promise with Reactor (you can pass a timeout) promise() creates a ReplayPromise so Reactor manages promise (you can pass a timeout) 37
  • 38. 38
  • 39. 39 Reactor, any, all, timeouts Promise to queue Promises to store todo in NoSQL tables
  • 41. Circuit Breaker Breaker is short for circuit breaker Wraps access to a service, resource, repo, connection, queue, etc. Tracks errors which can trigger the breaker to open Breaker is just an interface / contract Implementers can be creative in what is considered an open or broken breaker 41
  • 42. 42 Come to the lab tomorrow to See a full use case using Async circuit breakers
  • 45. Blocking promises Legacy integration Unit testing Prototypes Batch jobs that don’t need async (so you don’t have to have two libs) 45
  • 46. Unit test using blocking promise using invokeAsBlockingPromise then blockingGet 46
  • 48. Stream Handler for N results While a Callback and Promise is for one Result, a Stream is for N results Callback/Promise for Scalar returns Stream is for many returns Similar to Java 9 Flow, RxJava or Reactive Streams Java 8/9 lambda expression friendly (Fuller example as extra material on slide deck depending on time go to end of slide deck or just cover next two slides) 48
  • 50. streamResult.cancel(), streamResult.request(count) (part 2) 50 Fuller Examples In Hands-On Lab Come Tomorrow
  • 51. Example that combines Reakt: Reactor/Stream/Promises 51
  • 52. Example Recommendation Service Recommendation service Watch what user does, then suggest recommended items Recommendation service runs many recommendation engines per microservice 52
  • 53. Worked example will show 53 User recommendation service Delay giving recommendations to a user until that user is loaded from a backend service store Users are streamed in (uses streams) Stream comes in on foreign thread and we use reactor to move handler to service actor thread If user is already in service actor, then recommend a list of recommendations right away If user not in system, batch load user from backend service store Requests are batched to reduce IO overhead Users can come from many sources from service store (cache, disk cache, DB), and are delivered as soon as found in a continuous stream of user lists
  • 54. Async call recommendation engine if user present If not add user id to call batch, add to outstanding call for user. 54
  • 55. Every 50 ms check to see if the userIdsToLoad is greater than 0, If so request those users now. When a user is not found loadUserFromStoreService is called. If there are 100, outstanding requests, then load those users now. Listen to the userStoreService’s userStream 55
  • 56. Process the stream result. Populate the user map (or use a Simple cache with an expiry and a max number of users allowed to be in system). Since the user is now loaded, see if their are outstanding calls (promises) and resolve those calls. 56
  • 58. Next steps 1)Get rid of invoke and detect when a frame drops (let Geoff explain this one) 2)Simplify interface for Promise/Callback Reakt 4.0 a) We use semantic versioning, but even from version to version so far interfaces are fairly compatible for 97% of use cases 3)More reakt libs *** 4)Refine streaming interface 5)Add more support for Vert.x reakt a) Support streaming via Reakt 58
  • 60. Conclusion Reakt provides an easy-to-use lib for handling async callbacks It uses Promise concepts from ES6 which seem well thought out and natural We worked with many async libs and wrote a few our self, and really like the ES6 terminology and ease of use Since Java is MT and JavaScript is not there are some differences Java 8/9 lambda expression friendly Async call coordination can be difficult but all promises, any promises, reactor with replay promises and timeouts make it easier Reakt is evolving and we welcome feedback and contributions (bug 60
  • 63. Author Geoff Chandler Senior Director at a large Media Company. Works with Node.js, Cassandra, Mesos, QBit, EC2, and reactive programming. Major Contributor to QBit, Spring Boot, Reakt, and more. Creator of Lokate, ddp-client-java, guicefx, and various devops tools for gradle. 63
  • 64. Author Bio Rick Hightower Rick frequently writes about and develops high-speed microservices. He focuses on streaming, monitoring, alerting, and deploying microservices. He was the founding developer of QBit and Reakt as well as Boon. 64
  • 65. Worked example These are extra slides for a worked stream example 65
  • 66. Example Take from a real world scenario which gave birth to use using Vert.x, and later creating QBit and Reakt Example uses Streams, and Promises This is not the actual code from the actual project (this is just an example) 66
  • 67. Block diagram of a HSRM system we built 67
  • 68. 68
  • 69. Async call recommendation engine if user present If not add user id to call batch, add to outstanding call for user. 69
  • 70. Adding an outstanding call (promise) 70
  • 71. Every 50 ms check to see if the userIdsToLoad is greater than 0, If so request those users now. When a user is not found loadUserFromStoreService is called. If there are 100, outstanding requests, then load those users now. Listen to the userStoreService’s userStream 71
  • 72. Process the stream result. Populate the user map (or use a Simple cache with an expiry and a max number of users allowed to be in system). Since the user is now loaded, see if their are outstanding calls (promises) and resolve those calls. 72
  • 74. Streams vs Service Calls Microservices / RESTful services / SOA services REST / HTTP calls common denominator Even messaging can be request/reply Streams vs. Service Calls Level of abstraction differences, Calls can be streamed, Results can be streamed What level of abstraction fits the problem you are trying to solve Are streams an implementation details or a direct concept? 74
  • 75. Related projects QBit Java Microservice (built on top of Vert.x for IO) Using Reakt reactor to manage callbacks, REST and WebSocket services (WebSocket RPC) use Reakt Promises and Reakt Callbacks Lokate - service discovery lib for DNS-A, DNS-SRV, Consul, Mesos, Marathon Uses Reakt invokeable promises (Vert.x for IO) Elekt - leadership lib that uses tools like Consul to do leadership election (uses promises) Reakt-Guava - Reakt Bridge to Guava listable futures 75
  • 76. Promise Promises can be used for all manners of async programming not just Reactor Pattern You can use it with standard Java Lib Bridges for Guava, Vert.x and Cassandra QBit uses it (Service Actor/Microservices), Lokate (Discovery), 76
  • 77. Other Async Models Messaging (Golang, Erlang, RabbitMQ, JMS, Kafka) Actors (Erlang, Akka) Active Objects (Akka types actors, DCOM) Common problems when dealing with handling calls to services: Handling the call 77
  • 78. Reactor works with Works with Reactor Architecture (Vert.x, Spring Reactor ) Works with Actor model and Active Objects (Akka actors, Akka typed actor, QBit, etc.) ReplayPromises need a Reactor Reactor is an interface Replace it with one optimized for your environment Or manage ReplayPromises and tasks with something else like a Reactor 78
  • 79. Review Most of these Should be familiar to you 79

Editor's Notes

  1. These slides are from a talk we gave at JavaOne 2016 for work we did in the past, and open-source projects that we are working on.
  2. 10 seconds
  3. 10 seconds
  4. Give example of not small Looked at RXJava, Reactive Streams, Actors Used Vert.x extensively Not tied to QBit.
  5. The headline is the slide, briefly cover the concepts. Results can comeback on foreign threads If you need to call several services, what if one of them fails or times out? What if you need to combine the results of several calls before you can respond to the caller? What if a downstream service goes down? What if your async handler throws an exception? If you use a blocking future, you can tie up the event handling thread How do you test async services with a unit test framework?
  6. The best way to improve a lib is to use it. Many methods were added to simplify daily dev life. Scratching our own itches.
  7. Each slide in this section is to be covered quickly. No more than 30 seconds per slide.
  8. Geoff tells anecdotes about experience with ES6. Breaking a large monolithic Node.js app into microservices calling into services written in Java/Vert.x. Picked Vert.x to handle large amount of traffic on fewer boxes for in-memory service Vert.x + early QBit handled more load on 13 boxes than 2,000 boxes did for similar system Created stream/batch, service actor system to simplify Vert.x dev (circa 2012/2013) maximize throughput by minimizing IO and thread hand-off (QBit Java Microservices Lib) Trial by fire, Callback coordination rough Needed high-speed call coordination for OAuth rate limiter fronting many backend services Worked on QBit Reactor but interface was better than before but still too complicated 2016 - Worked on Vert.x / QBit project / Node.js project Started using Node.js / JavaScript promises for client libs Nice abstraction for dealing with async service calls JS Promises were just right We have been doing async callback coordination for some time. Using messaging, and handler ids, and streams, and reactor pattern, and all forms of async programming models. It is clunky. We tend to think about things as Future. We tend to think in a MT world not a reactor, async, streaming world. Promises are a nice abstraction to not just reactor pattern but many forms of Java async programming. Having written three or four async callback handlers systems and not really liking any of them per se, and seeing the similarities to JS Promise but also seeing the eloquence of async promises, it seemed to make sense to adopt the terminology of JavaScript promises and the simplicity of it. Picked Vert.x as our server to handle large amount of traffic on fewer boxes Vert.x + early QBit allowed us to handle more load on 13 boxes than 2000 boxes on similar system at same company Created stream/batch, service, actor system to simplify Vert.x dev (circa 2012/2013) and to maximize throughput by minimizing IO and thread hand-off (QBit Java Microservices Lib) - Trial by fire, Callback coordination rough. Needed to do high-speed call coordination for OAuth rate limiter fronting many backend services - Worked on QBit Reactor but interface was better than before but clunky 2016 - Worked on Vert.x / QBit project and started writing integration libs Started using Node.js / JavaScript promises Nice abstraction for dealing with async service calls
  9. The point of this slide and the next is to make the claim that streaming is not the only way to do reactive programming. The most common form of reactive programming is the reactor pattern / event loop, i.e., Browser DOM, Node.JS, Twisted and Vert.x. Streaming fits many problem domains but so do service calls which are also more common. Also streaming can be an implementation detail (as you can stream calls and stream responses). If streaming is not the only way to handle async programming and not even the most common, what / how to people do service style programming and what tools do they use. Node.js and Browser DOM JS are the two most common forms of async programming and they use Promises. Akka has promises, Netty has promises, Vert.x has async result which is similar and QBit had something like promises before Reakt. Reakt attempts to be separate from any particular implementation to focus on being a good promise lib for any sort of async programming in Java. From Microservices paper by Martin Fowler et al: “Synchronous calls considered harmful: Any time you have a number of synchronous calls between services you will encounter the multiplicative effect of downtime. Simply, this is when the downtime of your system becomes the product of the downtimes of the individual components. ...” http://martinfowler.com/articles/microservices.html
  10. “The reactor design pattern is an event handling pattern for handling service requests delivered concurrently to a service handler by one or more inputs. The service handler then demultiplexes the incoming requests and dispatches them synchronously to the associated request handlers.” https://en.wikipedia.org/wiki/Reactor_pattern “The Reactor pattern has been introduced in [Schmidt95] as a general architecture for event-driven systems. It explains how to register handlers for particular event types, and how to activate handlers when events occur, even when events come from multiple sources, in a single-threaded environment. In other words, the reactor allows for the combination of multiple event-loops, without introducing additional threads.” http://www.cs.vu.nl/~eliens/online/oo/I/2/reactor.html
  11. A good anecdote would be good here. Having multiple projects open. Loading the wrong one. Thinking it is the Java client when it was the JavaScript client. Wrote client libs in Java with Reakt Promises and ES6 (JavaScript) with Promises Code looked very similar Semantics were same Slight syntactic differences We were both “Wow!” That is clean It became hard to look at old way
  12. 10 seconds.. We cover this again in detail
  13. This has been adapted from this article on ES6 promises. A promise can be: fulfilled The callback/action relating to the promise succeeded rejected The callback/action relating to the promise failed pending The callback/action has not been fulfilled or rejected yet completed The callback/action has been fulfilled/resolved or rejected Java is not single threaded, meaning that two bits of code can run at the same time, so the design of this promise and streaming library takes that into account.
  14. JavaScript is single-threaded - You can make call, then register for callbacks and that is ok because call won’t be made until event loop moves on. Not so in Java! Java is MT to the core. Java is not single threaded, meaning that two bits of code can run at the same time, so the design of this promise and streaming library takes that into account. There are three types of promises: Callback promises Blocking promises (for testing and legacy integration) Replay promises (allow promises to be handled on the same thread as caller) Replay promises are the most like their JS cousins. Replay promises are usually managed by the Reakt Reactor and supports environments like Vert.x and QBit. See the wiki for more details on Replay promises. It is common to make async calls to store data in a NoSQL store or to call a remote REST interface or deal with a distributed cache or queue. Also Java is strongly typed so the library that mimics JS promises is going to look a bit different. We tried to use similar terminology where it makes sense. Events and Streams are great for things that can happen multiple times on the same object — keyup, touchstart, or event a user action stream from Kafka, etc. With those events you don't really care about what happened before when you attached the listener. But often times when dealing with services and data repositories, you want to handle a response with a specific next action, and a different action if there was an error or timeout from the responses. You essentially want to call and handle a response asynchronously and that is what promises allow. This is not our first time to bat with Promises. QBit has had Promises for a few years now. We just called them CallbackBuilders instead. We wanted to use more standard terminology and wanted to use the same terminology and modeling on projects that do not use QBit like Conekt, Vert.x, RxJava, and reactive streams. At their most basic level, promises are like event listeners except: A promise can only succeed or fail once. A promise cannot succeed or fail twice, neither can it switch from success to failure. Once it enters its completed state, then it is done.
  15. thenExpect and thenSafeExpect The handlers thenExpect and thenSafeExpect return a Reakt Expected instance. Expected is like Option in Java 8, it has methods like map, filter, etc. and adds methods ifEmpty, isEmpty. This gives a nice fluent API when you don't know if a successful return is null or not. then and thenSafeExpect The methods then and thenSafe async return the result that is not wrapped in an Expected object, i.e., the raw result. Use then and thenSafe when you know the async return will not be null. Use thenExpect and thenSafeExpect if the value could be null or if you want to map or filter the result. thenMap Use thenMap when a promise returns for example a List<Employee>, but you only want the first Employee. See Promise.thenMap for more details. safe thenSafe thenSafeExpect Unless you are using a reactor, custom Promises or blocking promises, the then* handlers will typically run in a foreign thread and if they throw an exception depending on the library, they could get logged in an odd way. If you think your handler could throw an exception (not the service you are calling but your handlers), then you might want to use thenSafe or thenSafeExpect. These will wrap your async then* handler code in a try/catch and pass the thrown exception to a ThenHandlerException to catchError. If your code ever hangs when making an async call, try using a thenSafe or thenSafeExpect. They ensure that any exceptions thrown in your handler don't get dropped by the system you are using, which could indicate a lack of understanding of the async lib you are using or that you are using it wrong. If it hangs, try thenSafe or thenSafeExpect. They help you debug async problems.
  16. We have all functionality with promises. You can create a promise that waits (async triggers) on all promises passed to it to be async returned. The Promise.all(list or array) method returns a promise that resolves when all of the promises have resolved, or rejects with the reason of the first passed promise that rejects.
  17. This example is from the lab. It saves a Todo item into two tables into cassandra. If either promise fails, the all promise fails. If they both succeed, the all promise succeeds. If every promise you pass to a promise is invokeable then the all promise is invokeable as well, and calling invoke on it will invoke all of the children promises.
  18. Promise.any(promises...) method returns a promise that resolves as soon as one of promises resolves. It will ignore errors from any of the other promises as long as they don’t all error. It is similar but different than Promises.race from JavaScript. Many JS libs have an any equiv. Promise.race does not seem as useful as Promsie.any, but we might add Promise.race as well.
  19. This is an example of adapting a Guava style future handling to Reakt so you can use fluent promises with Cassandra. Guava gets used by many libraries for its async support. Many NoSQL drivers use Guava, e.g., Cassandra. Guava is JDK 1.6 backwards compatible. Reakt provides composable promises that support lambda expressions, and a fluent API. This bridge allows you to use Reakt's promises, reactive streams and callbacks to have a more modern Java experience with libs like Cassandra and other libs that use Guava.
  20. The above shows adapting a Vert.x async handler to a Reakt promise. We used this quite a bit.
  21. Reactor is similar to QBit Reactor (but cleaner, 2nd attempt) or Vert.x Verticle context. The Reactor is a class that enables callbacks that execute in caller's thread (thread safe, async callbacks) tasks that run in the caller's thread repeating tasks that run in a caller's thread one shot after time period tasks that run in the caller's thread The reakt Reactor is a lot like the QBit Reactor or the Vert.x context. It allows you to enable tasks that run in that actors or verticles thread. The reakt Reactor creates replay promises. Replay promises execute in the same thread as the caller. They are "replayed" in the callers thread. QBit implements a service actor model (similar to Akka type actors), and Vert.x implements a Reactor model (like Node.js). QBit, for example ensures that all method calls are queued and handled by the service/actor thread. You can also use the QBit Reactor to ensure that callbacks happen on the same thread as the caller. This allows you callbacks to be thread safe. The Reakt Reactor is a drop in replacement for QBit Reactor except that the Reakt Reactor uses Reakt Promises, asyncResults and Callbacks. QBit 2 and Conekt will use Reakt's API and not its own. You can use the Reakt Reactor with RxJava, Vert.x, or Spring Reactor and other similar minded projects to manage repeating tasks, tasks, and callbacks on the same thread as the caller (which you do not always need to do). The Reactor is just an interface so you could replace it with an optimized version.
  22. Reactor Methods of note Here is a high level list of Reactor methods. addRepeatingTask(interval, runnable) add a task that repeats every interval runTaskAfter(afterInterval, runnable) run a task after an interval expires deferRun(Runnable runnable) run a task on this thread as soon as you can static reactor(...) create a reactor all(...) create a promise that does not async return until all promises async return. (you can pass a timeout) any(...) create a promise that does not async return until one of the promises async return. (you can pass a timeout) process process all tasks, callbacks. Here is the Reactor interface that can be implemented by anyone. Promise invokeWithReactor (shorthand) runas replay on reactor
  23. This might be a good slide to actually pull up the invokeWithReactor code and show what it is doing.
  24. This slide might make more sense now.
  25. A Breaker is short for Circuit Breaker. The idea behind the breaker is to wrap access to a service so that errors can be tracked and the circuit breaker can open if errors are exceeded. Like all things in Reakt there is an interface for Breaker that defines a contract but other implementations can get creative on how they detect the Breaker has been thrown.
  26. In this example we are using this with a database connect, but imagine this could be a downstream REST client or a downstream WebSocket client. It has been our experience, especially in cloud environments. That downstream clients can be restarted and they not only have to be reconnected to, but they may have to be relooked up in DNS or some other form of client discovery. They may have moved addresses entirely. @Override public Promise<Boolean> connect() { return invokablePromise(promise -> { serviceMgmt.increment("connect.called"); discoveryService.lookupService(cassandraURI).thenSafe(cassandraUris -> { serviceMgmt.increment("discovery.service.success"); final Builder builder = builder(); cassandraUris.forEach(cassandraURI1 -> builder.withPort(cassandraURI1.getPort()) .addContactPoints(cassandraURI1.getHost()).build()); futureToPromise(builder.build().connectAsync()) //Cassandra / Guava Reakt bridge. .catchError(error -> promise.reject("Unable to load initial session", error)) .then(sessionToInitialize -> buildDBIfNeeded(sessionToInitialize) .thenSafe(session -> { cassandraErrors.set(0); sessionBreaker = Breaker.operational(session, 10, theSession -> !theSession.isClosed() && cassandraErrors.incrementAndGet() > 25 ); promise.resolve(true); }) .catchError(error -> promise.reject( "Unable to create or initialize session", error) ).invokeWithReactor(reactor) ).invokeWithReactor(reactor); }).catchError(error -> serviceMgmt.increment("discovery.service.fail")).invokeWithReactor(reactor); }); }
  27. A BlockingPromise is very much like a Java Future. It is blocking. This is useful for unit testing and for legacy integration. Promises returns a blocking promise as follows: Blocking Promise /** * Create a blocking promise. * NOTE BLOCKING PROMISES ARE FOR LEGACY INTEGRATION AND TESTING ONLY!!! * After you create a promise you register its then and catchError and then you use it to * handle a callback. * * @param <T> type of result * @return new promise */ static <T> Promise<T> blockingPromise() { return new BlockingPromise<>(); }
  28. You could show what invokeAsBlockingProimse looks like. Show the actual code. The second code listing shows how to use an expected as well.
  29. Stream is a generic event handler for N results, i.e., a stream of results. This is a like a type of Callback for streaming results. While Callback can be considered for scalar results, a Stream is more appropriate for non-scalar results, i.e., Stream.onNext will get called many times. StreamResult is a result of an async operations with optional methods for cancel and request more items.
  30. Break it down
  31. Recently, Rick help develop many resilient, fault-tolerant microservices running in a Heroku clone based on Mesos in Scala and Java. He adapted QBit, microservice lib, so that when you drop in a service, it hooks into all of the 12 factor features that Orchard supports. QBit plugs into Orchard, port binding, DNS discovery, KPI stats, monitoring/distributed logging, health system, etc. Rick also wrote support for API gateway services via built-in Swagger support. This allows generation of service docs as well as REST clients for Python, Ruby, Java, Scala, etc. For the JVM, you also get WebSocket client which are auto generated runtime stubs which can invoke 500K method calls (request response) over WebSocket a second (per thread). Rick also wrote the OAuth rate limiter microservice which does OAuth rate limiting by application id and service load balancing for another online media services. Before that Rick wrote a 100 million-user in-memory content preference engine microservice for a large media company with custom NoSQL service store (2014) as part of this effort he wrote high speed JSON REST/WebSocket framework for reactive computing model based on Boon and Vert.x (and a disk batcher capable of writing 720 MB per second—the disk batcher was later used by Beats). Rick wrote over 150,000+ lines of open source code in 2013 – 2016. Rick also contributed to the reference implementations of Grid Computing and enterprise caches as well as being a member of several spec. committees (JSR-347, JSR-107, etc.) Rick is the primary author of Boon, SlumberDB and QBit. Rick is author of the best-selling book Java Tools for Extreme Programming (#1 SW development book on Amazon for 3 months) and other books. Rick also wrote a book on Python that covered programming and OO basics which was used as college text for introduction to programming and software development. Rick setup computer science programs at an elementary school and taught classes for three years. "Rick has the distinction of writing the single most popular article/series ever published on the Java technology zone." --Jenni Aloi, IBM DeveloperWorks. Rick also wrote a book on Java Web Development, which is the number one download on TheServerSide.com, and he wrote about NoSQL and scalability on InfoQ, and was the NoSQL editor for a short period of time. Prior to becoming a consultant, Rick helped create a startup that hosted 2,000 online stores on commodity hardware.
  32. The point of this slide and the previous is to make the claim that streaming is not the only way to do reactive programming. The most common form of reactive programming is the reactor pattern / event loop, i.e., Browser DOM, Node.JS, Twisted and Vert.x. Streaming fits many problem domains but so do service calls which are also more common. Also streaming can be an implementation detail (as you can stream calls and stream responses). If streaming is not the only way to handle async programming and not even the most common, what / how to people do service style programming and what tools do they use. Node.js and Browser DOM JS are the two most common forms of async programming and they use Promises. Akka has promises, Netty has promises, Vert.x has async result which is similar and QBit had something like promises before Reakt. Reakt attempts to be separate from any particular implementation to focus on being a good promise lib for any sort of async programming in Java.
  33. Works well with Reactor Architecture (Vert.x, Spring Reactor, ) Works well with Actor model and Active Objects (Akka actors, Akka typed actor, QBit, etc.) ReplayPromises need a Reactor (or something that fulfills that role) Reactor is just an interface so you can replace it with one optimized for your environment
  34. You can talk about changes in 4.0 and how we are simplifying the interface.