7. 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
8. 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
9. 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
24. 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
25. Now it is easy to change the process flow
@berndruecker
30. Example
Order Payment
If the credit
card was
rejected, the
customer can
provide new
details
Credit
Card
Retrieve
Payment
Rejected
Rejected
@berndruecker
31. 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
38. 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
42. 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
43. 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
44. 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
60. 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
61. Want to learn more?
https://learning.oreilly.com/get-learning/?code=PPAER20