SlideShare a Scribd company logo
@berndruecker
How State Helps you to
Stay Reactive
Orchestration, Conversations and
the Saga Pattern
Setting the scene. Example
Checkout
Payment
Inventory
Shipment
@berndruecker
Order
Placed
Payment
Received
Goods
Shipped
Notification
Event-driven & Reactive
@berndruecker
Checkout
Payment
Inventory
Shipment
But there is also trouble in reactive land!
Event chains that
implement processes
How to implement
long running behavior
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order
placed
Payment
received
Goods
shipped
Goods
fetched
@berndruecker
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order
placed
Payment
received
Goods
shipped
Goods
fetched
@berndruecker
The danger is that it's very easy to make
nicely decoupled systems with event
notification, without realizing that you're
losing sight of that larger-scale flow, and
thus set yourself up for trouble in future
years.
https://martinfowler.com/articles/201701-event-driven.html
@berndruecker
The danger is that it's very easy to make
nicely decoupled systems with event
notification, without realizing that you're
losing sight of that larger-scale flow, and
thus set yourself up for trouble in future
years.
https://martinfowler.com/articles/201701-event-driven.html
@berndruecker
The danger is that it's very easy to make
nicely decoupled systems with event
notification, without realizing that you're
losing sight of that larger-scale flow, and
thus set yourself up for trouble in future
years.
https://martinfowler.com/articles/201701-event-driven.html
@berndruecker
Phil Calcado at QCon NYC 2019
Notification
Checkout
Payment
Inventory
Shipment
Pinball Machine Architecture
„What the hell
just
happened?“
@berndruecker
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Order
placed
Payment
received
Goods
shipped
Goods
fetched
Fetch the goods
before the
payment
@berndruecker
Peer-to-peer event chains
Checkout
Payment
Inventory
Shipment
Fetch the goods
before the
payment
Goods
fetched
Order
placed
Payment
received
Goods
shipped
@berndruecker
What we wanted
Photo by Lijian Zhang, under Creative Commons SA 2.0 License and Wikimedia Commons / CC BY-SA 4.0
@berndruecker
Choreography
Order
Decide about responsibility
Checkout
Payment
Inventory
ShipmentPayment
received
Order
placed
Retrieve
payment
@berndruecker
Order
Decide about responsibility
Checkout
Payment
Inventory
ShipmentPayment
received
Order
placed
Retrieve
payment
@berndruecker
This is
choreography
This is
orchestration
Order
Decide about responsibility
Checkout
Payment
Inventory
Shipment
Order
placed
Retrieve
payment
It can still be messaging!
@berndruecker
Order
Checkout
Payment
Inventory
Shipment
Stateful orchestration
This orchestration
requires state
@berndruecker
Long running behavior
Warning:
Contains Opinion
@berndruecker
mail@berndruecker.io
@berndruecker
http://berndruecker.io/
Bernd Ruecker
Co-founder and
Chief Technologist of
Camunda
Order
Checkout
Payment
Inventory
Shipment
@berndruecker
Glue code (e.g. Java)
https://github.com/berndruecker/flowing-
retail/blob/master/kafka/java/order-
zeebe/src/main/java/io/flowing/retail/kafka/or
der/flow/FetchGoodsAdapter.java
Using a workflow engine
Workflow Engine
Scheduler
Durable State
Glue Code Whatever you
need…
Workflow Definition
Workflow Engine:
Is stateful
Can wait
Can retry
Can escalate
Can compensate
Provides visibility
Now it is easy to change the process flow
@berndruecker
Long Running Capabilities
Solve Problems
Long
Running
Technical
Process
Automation
Long Running Capabilities
Solve Problems
Long
Running
Technical
Business
Process
Automation
Example
Order Payment
Credit
Card
Retrieve
Payment
@berndruecker
Example
Order Payment
Credit
Card
Retrieve
Payment
Rejected
@berndruecker
Example
Order Payment
If the credit
card was
rejected, the
customer can
provide new
details
Credit
Card
Retrieve
Payment
Rejected
Rejected
@berndruecker
Payment
failed
Who is responsible?
Order Payment
If the credit
card was
rejected, the
customer can
provide new
details
Credit
Card
Retrieve
Payment
Rejected
Payment
received
@berndruecker
Payment
failed
Long running services
Order Payment
Credit
Card
Retrieve
Payment
Rejected
Payment
received
@berndruecker
Long running services
Order Payment
Credit
Card
@berndruecker
Extending Payment Options
@berndruecker
Extending Payment Options
begin commit
{local TX}
Customer Credit Service
begin commit
{local TX}
Credit Card Service
@berndruecker
Distributed transactions using compensation *
Compensation
@berndruecker
Long Running Capabilities
Solve Problems
Long
Running
Technical
Business
Transactions,
Saga
Process
Automation
Compensation – the classical example
Saga
book
hotel
book
car
book
flight
cancel
hotel
cancel
car
1. 2. 3.
5.6.
In case of failure
trigger compensations
book
trip
2 alterntive approaches: choreography & orchestration
@berndruecker
Event-driven choreography
Hotel
Flight
Car
Trip
Trip
booked
Flight
booked
Trip
requested
Hotel
booked
Car
booked
Request
trip
@berndruecker
Event-driven choreography
Hotel
Flight
Car
Trip
Trip
failed
Trip
requested
Hotel
booked
Car
booked
Request
trip
Flight
failed
Car
canceled
Hotel
canceled
Perform undo
(cancel car booking)
Perform undo
(cancel hotel)
@berndruecker
If your transaction involves 2 to 4 steps,
choreography might be a very good fit.
However, this approach can rapidly become confusing
if you keep adding extra steps in your transaction
as it is difficult to track which services listen to
which events. Moreover, it also might add a cyclic
dependency between services as they have to
subscribe to one another’s events.
Denis Rosa
Couchbase
https://blog.couchbase.com/saga-pattern-implement-business-transactions-using-microservices-part/
@berndruecker
Implementing changes in the process
Hotel
Flight
Car
Trip
Trip
failed
Trip
requested
Hotel
booked
Car
booked
Request
trip
Flight
failed
Car
canceled
Hotel
canceled
We have a new basic agreement
with the car rental agency and
can cancel for free within 1 hour
– do that first!
@berndruecker
Implementing changes in the process
Hotel
Flight
Car
Trip
Trip
failed
Trip
requested
Hotel
booked
Car
booked
Request
trip
Flight
failed
Car
canceled
Hotel
canceled
You have to adjust all services and redeploy at the same time!
We have a new basic agreement
with the car rental agency and
can cancel for free within 1 hour
– do that first!
@berndruecker
Orchestration
Hotel
Flight
Car
Trip
Trip
booked
Request
trip
Book
hotel
Hotel
booked
Car
booked
Flight
booked
Book
car
Book
flight
@berndruecker
Orchestration
Hotel
Flight
Car
Trip
Trip
booked
Request
trip
Book
hotel
Hotel
booked
Car
booked
Flight
booked
Book
car
Book
flight
We have a new basic agreement
with the car rental agency and
can cancel for free within 1 hour
– do that first!
You have to adjust one service and redeploy only this one!
@berndruecker
Describe orchestration with BPMN
Trip
Trip
booked
Request
trip
@berndruecker
Code examples
https://github.com/berndruecker/trip-booking-saga-java
https://github.com/berndruecker/trip-booking-saga-serverless
https://github.com/berndruecker/flowing-trip-booking-saga-c-sharp
@berndruecker
The workflow is domain logic as part of the service
Trip
@berndruecker
The workflow is domain logic as part of the service
Trip
Payment
Payment could be one
step in the Trip Saga
@berndruecker
Graphical models?
@berndruecker
Clemens Vasters
Architect at Microsoft
http://vasters.com/archive/Sagas.html
Clemens Vasters
Architect at Microsoft
http://vasters.com/archive/Sagas.html
BPMN
Business Process
Model and Notation
ISO Standard
@berndruecker
Living documentation for long-running behaviour
@berndruecker
Visual HTML reports for test cases
@berndruecker
BizDevOps
@berndruecker
Consistency decisions
need to be elevated
to the business level!
Long Running Capabilities
Solve Problems
Long
Running
Technical
Business
Transactions,
Saga
Visibility
Process
Automation
Recap
• You need capabilities for long running behavior for
technical and business reasons
• Workflow engines are a great fit – make sure you use a
developer friendly one
• Balance Orchestration (coordination) and choreography
(reactive)
@berndruecker
Want to learn more?
https://learning.oreilly.com/get-learning/?code=PPAER20
Thank you!
@berndruecker
mail@berndruecker.io
@berndruecker
https://berndruecker.io
https://medium.com/berndruecker
https://github.com/berndruecker
https://www.infoq.com/articles/events-
workflow-automation
Contact:
Slides:
Blog:
Code:
https://www.infoworld.com/article/3254777/
application-development/
3-common-pitfalls-of-microservices-
integrationand-how-to-avoid-them.html
https://thenewstack.io/5-workflow-automation-
use-cases-you-might-not-have-considered/

More Related Content

PDF
Moving beyond request reply - designing smarter APIs
PDF
Monitoring and Orchestration of your Microservices Landscape with Kafka and Z...
PDF
JCon 2021 - Loosely or lousily coupled
PDF
Complex event flows in distributed systems (QCon London 2019)
PDF
Kafka Summit 2020: If an event is published to a topic and no one is around t...
PDF
GOTOpia 2020 - Balancing Choreography and Orchestration
PDF
2019 - Lost in transaction
PDF
Automating Processes in Modern Architectures
Moving beyond request reply - designing smarter APIs
Monitoring and Orchestration of your Microservices Landscape with Kafka and Z...
JCon 2021 - Loosely or lousily coupled
Complex event flows in distributed systems (QCon London 2019)
Kafka Summit 2020: If an event is published to a topic and no one is around t...
GOTOpia 2020 - Balancing Choreography and Orchestration
2019 - Lost in transaction
Automating Processes in Modern Architectures

What's hot (19)

PDF
AWS Community Summit London 2019 - Lost in transaction
PDF
Apache Kafka Meets Workflow Engines | Bernd Ruecker, Camunda
PDF
Lost in transaction - Strategies to deal with (in)consistency in distributed ...
PDF
OOP 2021 - Leverage the full potential of your hipster architecture
PDF
DDD Europe 2019: Lost in transaction
PDF
Webinar: Monitoring & Orchestrating Your Microservices Landscape using Workfl...
PDF
Long running processes in DDD
PDF
Kafka Summit 2018: Monitoring and Orchestration of Your Microservices Landsca...
PDF
2020 10-08 measuring-qualityinproduction
PDF
How to build observability into a serverless application
PDF
2020 06-03 cukenfest-bdd-and-sl_os
PDF
Observability - Experiencing the “why” behind the jargon (FlowCon 2019)
PDF
Testing & deploying Microservices GeeCon 2014
PDF
Principles of Microservices - NDC 2014
PDF
Rip It Up - The Microservice Organisation
PDF
Hiding The Lead: Coupling, cohesion and microservices
PDF
Migrating existing monolith to serverless in 8 steps
PDF
Zeebe 0.20.0 Release Webinar - July 22, 2019
PDF
Deploying and Scaling Microservices
AWS Community Summit London 2019 - Lost in transaction
Apache Kafka Meets Workflow Engines | Bernd Ruecker, Camunda
Lost in transaction - Strategies to deal with (in)consistency in distributed ...
OOP 2021 - Leverage the full potential of your hipster architecture
DDD Europe 2019: Lost in transaction
Webinar: Monitoring & Orchestrating Your Microservices Landscape using Workfl...
Long running processes in DDD
Kafka Summit 2018: Monitoring and Orchestration of Your Microservices Landsca...
2020 10-08 measuring-qualityinproduction
How to build observability into a serverless application
2020 06-03 cukenfest-bdd-and-sl_os
Observability - Experiencing the “why” behind the jargon (FlowCon 2019)
Testing & deploying Microservices GeeCon 2014
Principles of Microservices - NDC 2014
Rip It Up - The Microservice Organisation
Hiding The Lead: Coupling, cohesion and microservices
Migrating existing monolith to serverless in 8 steps
Zeebe 0.20.0 Release Webinar - July 22, 2019
Deploying and Scaling Microservices
Ad

Similar to Reactive Summit 2020 - How state helps you to stay reactive (20)

PDF
Serverless Days 2019 - Lost in transaction
PDF
JAX 2017 talk: Orchestration of microservices
PPTX
Event Driven Architecture
PPTX
Microservices Coordination using Saga
PDF
Camunda Con Live 2020 Keynote - Microservice Orchestration and Integration
PPTX
Event Driven Microservices architecture
PDF
GotoChgo 2019: Not Just Events: Developing Asynchronous Microservices
PDF
JUG Amsterdam - Orchestration of microservices
PDF
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
PDF
GopherCon UK 2018 - Orchestration of microservices
PDF
Serverless London 2019 - Coordination of Serverless Functions
PDF
JUG Frankfurt - Orchestration of microservices
PDF
Saga pattern and event sourcing with kafka
PDF
Bernd Rücker - Lost in transaction? Strategies to manage consistency in serve...
PDF
Complex Event Flows in Distributed Systems (Bernd Ruecker, Camunda) Kafka Sum...
PDF
Saturn 2018: Managing data consistency in a microservice architecture using S...
PDF
Mucon: Not Just Events: Developing Asynchronous Microservices
PPTX
Events & Microservices
PDF
Communication between (micro-)services - Bernd Rücker - Codemotion Amsterdam ...
PPTX
Paul Lungu: Microservices Integration: Challenges and Solutions - Camunda Day...
Serverless Days 2019 - Lost in transaction
JAX 2017 talk: Orchestration of microservices
Event Driven Architecture
Microservices Coordination using Saga
Camunda Con Live 2020 Keynote - Microservice Orchestration and Integration
Event Driven Microservices architecture
GotoChgo 2019: Not Just Events: Developing Asynchronous Microservices
JUG Amsterdam - Orchestration of microservices
iSAQB Software Architecture Gathering 2023: How Process Orchestration Increas...
GopherCon UK 2018 - Orchestration of microservices
Serverless London 2019 - Coordination of Serverless Functions
JUG Frankfurt - Orchestration of microservices
Saga pattern and event sourcing with kafka
Bernd Rücker - Lost in transaction? Strategies to manage consistency in serve...
Complex Event Flows in Distributed Systems (Bernd Ruecker, Camunda) Kafka Sum...
Saturn 2018: Managing data consistency in a microservice architecture using S...
Mucon: Not Just Events: Developing Asynchronous Microservices
Events & Microservices
Communication between (micro-)services - Bernd Rücker - Codemotion Amsterdam ...
Paul Lungu: Microservices Integration: Challenges and Solutions - Camunda Day...
Ad

More from Bernd Ruecker (20)

PDF
QCon London: Mastering long-running processes in modern architectures
PDF
WeAreDevelopers Live 2024 - Mastering long-running processes in modern archit...
PDF
JCon Live 2023 - Lice coding some integration problems
PDF
JFall - Process Oriented Integration
PDF
CamundaCon NYC 2023 Keynote - Shifting into overdrive with process orchestration
PDF
JavaLand 2023 - Process Oriented Integration
PDF
CraftConf: Surviving the hyperautomation low code bubbl
PDF
Mastering Data for Higher Business Impact - at Commerzbank Innovation Summit
PDF
Camunda Chapter Hamburg - Surviving the hyperautomation low code bubble
PDF
Loosely or lousily coupled - Understanding communication patterns in microser...
PDF
CamundaCon 2022 Keynote: The Process Orchestration Journey
PDF
JAX 2022 - Loosely or lousily coupled
PDF
JFS 2021 - The Process Automation Map
PDF
CamundaCon 2021 Keynote :From Human Workflow to High-Throughput Process Autom...
PDF
Kafka Summit 2021 - Apache Kafka meets workflow engines
PDF
Process Automation Forum April 2021 - Practical Process Automation
PDF
Micronaut Webinar 2021 - Process Automation Introduction
PDF
Webinar "Communication Between Loosely Coupled Microservices"
PDF
CamundaCon 2020 Keynote - The Return of Process Automation
PDF
Destination Automation: Automating Processes in Modern Hipster Architectures
QCon London: Mastering long-running processes in modern architectures
WeAreDevelopers Live 2024 - Mastering long-running processes in modern archit...
JCon Live 2023 - Lice coding some integration problems
JFall - Process Oriented Integration
CamundaCon NYC 2023 Keynote - Shifting into overdrive with process orchestration
JavaLand 2023 - Process Oriented Integration
CraftConf: Surviving the hyperautomation low code bubbl
Mastering Data for Higher Business Impact - at Commerzbank Innovation Summit
Camunda Chapter Hamburg - Surviving the hyperautomation low code bubble
Loosely or lousily coupled - Understanding communication patterns in microser...
CamundaCon 2022 Keynote: The Process Orchestration Journey
JAX 2022 - Loosely or lousily coupled
JFS 2021 - The Process Automation Map
CamundaCon 2021 Keynote :From Human Workflow to High-Throughput Process Autom...
Kafka Summit 2021 - Apache Kafka meets workflow engines
Process Automation Forum April 2021 - Practical Process Automation
Micronaut Webinar 2021 - Process Automation Introduction
Webinar "Communication Between Loosely Coupled Microservices"
CamundaCon 2020 Keynote - The Return of Process Automation
Destination Automation: Automating Processes in Modern Hipster Architectures

Recently uploaded (20)

PDF
Empathic Computing: Creating Shared Understanding
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
MYSQL Presentation for SQL database connectivity
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
cuic standard and advanced reporting.pdf
PPTX
A Presentation on Artificial Intelligence
PDF
Encapsulation theory and applications.pdf
Empathic Computing: Creating Shared Understanding
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Unlocking AI with Model Context Protocol (MCP)
MYSQL Presentation for SQL database connectivity
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Advanced methodologies resolving dimensionality complications for autism neur...
Building Integrated photovoltaic BIPV_UPV.pdf
Understanding_Digital_Forensics_Presentation.pptx
NewMind AI Monthly Chronicles - July 2025
Network Security Unit 5.pdf for BCA BBA.
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
“AI and Expert System Decision Support & Business Intelligence Systems”
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Encapsulation_ Review paper, used for researhc scholars
Chapter 3 Spatial Domain Image Processing.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
cuic standard and advanced reporting.pdf
A Presentation on Artificial Intelligence
Encapsulation theory and applications.pdf

Reactive Summit 2020 - How state helps you to stay reactive