Lost in transaction? - JAX London...If your transaction involves 2 to 4 steps, choreography might be...
Transcript of Lost in transaction? - JAX London...If your transaction involves 2 to 4 steps, choreography might be...
![Page 1: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/1.jpg)
@berndruecker
Lost in transaction?
Strategies to manage consistencyin distributed systems
![Page 2: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/2.jpg)
@berndruecker
![Page 3: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/3.jpg)
Order
OrderLine Item
Customer
Customer
Address
orderIdcustomerIdchargeId…
customerId…
productIdprice…
Charge
Charge
Order
chargeIdamountpaymentProvidertransactionId…
Aggregate
Entity
Value Object
Reference by identity@berndruecker
![Page 4: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/4.jpg)
Order
OrderLine Item
orderIdcustomerIdchargeId…
productIdprice… Order
Charge
Charge
chargeIdamountpaymentProvidertransactionId… Create
Charge
Mark order as
paid
All ornothing+
@berndruecker
![Page 5: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/5.jpg)
ACID
AtomicityConsistencyIsolationDurability
@berndruecker
![Page 6: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/6.jpg)
Aggregates = Consistency Boundaries
Order
OrderLine Item
orderIdcustomerIdchargeId…
productIdprice… Order
Charge
Charge
chargeIdamountpaymentProvidertransactionId…
You can do ACID within here
Or here
But not a joinedACID transaction!
@berndruecker
![Page 7: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/7.jpg)
Aggregates = Consistency Boundaries
Order
OrderLine Item
orderIdcustomerIdchargeId…
productIdprice… Order
Charge
Charge
chargeIdamountpaymentProvidertransactionId…
Own DB / autonomous technology decisionsAPI-drivenScalability…
@berndruecker
![Page 8: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/8.jpg)
Aggregates = Consistency Boundaries
Order
OrderLine Item
orderIdcustomerIdchargeId…
productIdprice… Order
Charge
Charge
chargeIdamountpaymentProvidertransactionId…
Own DB / autonomous technology decisionsAPI-drivenScalability…
@berndruecker
![Page 9: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/9.jpg)
Boundaries need to be designed carefully
Charge
chargeIdamountpaymentProvidertransactionId…
Order
OrderLine Item
orderIdcustomerIdchargeId…
productIdprice…Order
@berndruecker
![Page 10: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/10.jpg)
But no implicit constraints!
Order
OrderLine Item
orderIdcustomerIdchargeId…
productIdprice… Order
Charge
Charge
chargeIdamountpaymentProvidertransactionId…
Joined DB transaciton
@berndruecker
![Page 11: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/11.jpg)
There is two-phase commit (XA)!!
TXCoordinator
ResourceManagers
PreparePhase
CommitPhase
@berndruecker
![Page 12: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/12.jpg)
Pat Helland
“
Distributed Systems Guru Worked at Amazon, Microsoft & Salesforce
@berndruecker
![Page 13: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/13.jpg)
Pat Helland
Grown-Ups Don’t Use Distributed Transactions
“
Distributed Systems Guru Worked at Amazon, Microsoft & Salesforce
@berndruecker
![Page 14: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/14.jpg)
Starbucks does not use two phase commithttps://www.enterpriseintegrationpatterns.com/ramblings/18_starbucks.html
Photo by John Ingle
@berndruecker
![Page 15: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/15.jpg)
Eric BrewerAtomicityConsistencyIsolationDurability
http://pld.cs.luc.edu/courses/353/spr11/notes/brewer_keynote.pdf @berndruecker
![Page 16: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/16.jpg)
That means
Do A
Do B
Temporarilyinconsistent
Eventuallyconsistentagain
t
Consistent
LocalACID
LocalACID
1 aggregate1 (micro-)service1 program1 resource
Violates „I“ of ACID
@berndruecker
![Page 17: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/17.jpg)
„Building on Quicksand“ Paper
ACID2.0Pat Helland
@berndruecker
![Page 18: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/18.jpg)
AssociativeCommutativeIdempotentDistributed2.0
(a + b) + c = a + (b + c)
a + b = b + a
f(x) = f( f(x) )
„Building on Quicksand“ Paper
Pat Helland
@berndruecker
![Page 19: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/19.jpg)
Distributed@berndruecker
![Page 20: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/20.jpg)
Distributed systems @berndruecker
![Page 21: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/21.jpg)
Network problems
CreditCard
Paymentcharge
@berndruecker
![Page 22: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/22.jpg)
Strategy: retry
CreditCard
Payment
Charge Credit CardcardNumber
amount
Charge Credit CardcardNumber
amounttransactionId
Not idempotent
Idempotent
has to be idempotent
charge
@berndruecker
![Page 23: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/23.jpg)
Photo by pixabay, available under Creative Commons CC0 1.0 license.
@berndruecker
![Page 24: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/24.jpg)
Requirement: Idempotency of services!
Photo by pixabay, available under Creative Commons CC0 1.0 license.
@berndruecker
![Page 25: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/25.jpg)
Requirement: Idempotency of services!
Photo by Chr.Späth, available under Public Domain.
@berndruecker
![Page 26: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/26.jpg)
Distributed systems @berndruecker
![Page 27: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/27.jpg)
It is impossible todifferentiate certain
failure scenarios:
Independant ofcommunication style!
Service Provider
Client
@berndruecker
![Page 28: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/28.jpg)
Strategy: Cleanup
CreditCard
Paymentcharge
Make sure it isnot charged!
Cancel chargecardNumber
amounttransactionId
Raisepayment failed
@berndruecker
![Page 29: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/29.jpg)
Distributed systems @berndruecker
![Page 30: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/30.jpg)
Some communication challengesrequire state.
@berndruecker
![Page 31: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/31.jpg)
Strategy: Stateful retry
CreditCard
Paymentcharge
@berndruecker
![Page 32: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/32.jpg)
Strategy: Stateful retry
CreditCard
Paymentcharge
Make sure it isnot charged!
@berndruecker
![Page 33: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/33.jpg)
Warning:Contains Opinion
![Page 35: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/35.jpg)
Payment
Stateful retry
CreditCardREST
@berndruecker
![Page 36: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/36.jpg)
Stateful retry & cleanup
CreditCard
PaymentREST
Cancelcharge
@berndruecker
![Page 37: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/37.jpg)
Architecture
Infrastructure
Application
Domain
WorkflowEngine
@berndruecker
![Page 38: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/38.jpg)
Architecture
Infrastructure
Application
Domain
WorkflowEngine
@berndruecker
Lightweight Open SourceBPMN
![Page 39: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/39.jpg)
Live hacking
https://github.com/flowing/flowing-retail/tree/master/rest
@berndruecker
![Page 40: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/40.jpg)
Embedded Engine Example (Java)
https://blog.bernd-ruecker.com/architecture-options-to-run-a-workflow-engine-6c2419902d91
@berndruecker
![Page 41: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/41.jpg)
A relatively common pattern
Service(e.g. Go)
Rabbit
RDMS
1. Receive
4. Send additional events
2. Business Logic
3. Send response? ACK
@berndruecker
![Page 42: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/42.jpg)
„Can this handle 15k requests per second?“
@berndruecker
![Page 43: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/43.jpg)
![Page 44: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/44.jpg)
and
ACID?
![Page 45: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/45.jpg)
@berndruecker
![Page 46: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/46.jpg)
@berndruecker
![Page 47: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/47.jpg)
Compensation – the classical example
Sagabookhotel
bookcar
bookflight
cancelhotel
cancelcar
1. 2. 3.
5.6.
In case of failuretrigger compensations
booktrip
![Page 48: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/48.jpg)
2 alterntive approaches: choreography & orchestration
@berndruecker
![Page 49: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/49.jpg)
Event-driven choreography
Hotel
Flight
Car
Trip
Tripbooked
Flightbooked
Triprequested
Hotelbooked
Carbooked
Requesttrip
@berndruecker
![Page 50: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/50.jpg)
Event-driven choreography
Hotel
Flight
Car
Trip
Tripfailed
Triprequested
Hotelbooked
Carbooked
Requesttrip
Flightfailed
Car canceled
Hotel canceled
Perform undo(cancel car booking)
Perform undo(cancel hotel)
@berndruecker
![Page 51: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/51.jpg)
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
![Page 52: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/52.jpg)
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
![Page 53: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/53.jpg)
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
![Page 54: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/54.jpg)
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 RosaCouchbase
https://blog.couchbase.com/saga-pattern-implement-business-transactions-using-microservices-part/
@berndruecker
![Page 55: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/55.jpg)
Implementing changes in the process
Hotel
Flight
Car
Trip
Tripfailed
Triprequested
Hotelbooked
Carbooked
Requesttrip
Flightfailed
Car canceled
Hotel canceled
We have a new basic agreementwith the car rental agency and can cancel for free within 1 hour
– do that first!
@berndruecker
![Page 56: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/56.jpg)
Implementing changes in the process
Hotel
Flight
Car
Trip
Tripfailed
Triprequested
Hotelbooked
Carbooked
Requesttrip
Flightfailed
Car canceled
Hotel canceled
You have to adjust all services and redeploy at the same time!
We have a new basic agreementwith the car rental agency and can cancel for free within 1 hour
– do that first!
@berndruecker
![Page 57: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/57.jpg)
What we wanted
Photo by Lijian Zhang, available under Creative Commons SA 2.0 License and Pedobear19 / CC BY-SA 4.0
@berndruecker
![Page 58: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/58.jpg)
Orchestration
Hotel
Flight
Car
Trip
Tripbooked
Requesttrip
Bookhotel
Hotelbooked
Carbooked
Flightbooked
Book car
Bookflight
@berndruecker
![Page 59: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/59.jpg)
Orchestration
Hotel
Flight
Car
Trip
Tripbooked
Requesttrip
Bookhotel
Hotelbooked
Carbooked
Flightbooked
Book car
Bookflight
We have a new basic agreementwith 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
![Page 60: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/60.jpg)
Describe orchestration with BPMN
Trip
Tripbooked
Requesttrip
@berndruecker
![Page 61: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/61.jpg)
The workflow is domain logic as part of the service
Trip
@berndruecker
![Page 62: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/62.jpg)
The workflow is domain logic as part of the service
Trip
Payment
Payment could be onestep in the Trip Saga
@berndruecker
![Page 63: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/63.jpg)
Caitie McCaffrey | @caitie
@berndruecker
![Page 64: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/64.jpg)
Graphical models?
@berndruecker
![Page 65: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/65.jpg)
Clemens VastersArchitect at Microsoft
http://vasters.com/archive/Sagas.html
@berndruecker
![Page 66: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/66.jpg)
Clemens VastersArchitect at Microsoft
http://vasters.com/archive/Sagas.html
@berndruecker
![Page 67: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/67.jpg)
Clemens VastersArchitect at Microsoft
http://vasters.com/archive/Sagas.html
@berndruecker
![Page 68: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/68.jpg)
BPMNBusiness Process
Model and Notation
ISO Standard
@berndruecker
![Page 69: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/69.jpg)
Living documentation for long-running behaviour
@berndruecker
![Page 70: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/70.jpg)
Visual HTML reports for test cases
@berndruecker
![Page 71: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/71.jpg)
BizDevOps
@berndruecker
![Page 72: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/72.jpg)
Fancy a DSL? Just do it!
https://github.com/berndruecker/flowing-trip-booking-saga
The visual getauto-generated…
@berndruecker
![Page 73: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/73.jpg)
Thoughts on the state machine | workflow engine market
@berndruecker
![Page 74: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/74.jpg)
Thoughts on the state machine | workflow engine market
OSS Workflow orOrchestration Engines
Stack Vendors,Pure Play BPMS
Low Code Platforms
Homegrown frameworksto scratch an itch
Integration Frameworks
Cloud Offerings
Uber, Netflix, AirBnb, ING, … AWS Step Functions, Azure Durable Functions, …
Camunda, Zeebe, jBPM, Activiti, Mistral, …
PEGA, IBM, SAG, …
Apache Airflow, Spring Data Flow, …
Apache Camel, Balerina, …
Data Pipelines
@berndruecker
![Page 75: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/75.jpg)
Does it support stateful operations?
Does it support the necessary flow logic?
Does it support BizDevOps?
Does it scale?
@berndruecker
![Page 76: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/76.jpg)
My personal pro-tip for a shortlist ;-)
OSS Workflow orOrchestration Engines
Stack Vendors,Pure Play BPMS
Low Code Platforms
Homegrown frameworksto scratch an itch
Integration Frameworks
Cloud Offerings
Data Pipelines
Camunda & Zeebe
@berndruecker
![Page 77: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/77.jpg)
Recap
• Aggregates = Consistency boundaries• Grown ups don‘t use distributed transactions
but eventual consistency• Idempotency is super important• Some consistency challenges require state• Stateful retry & cleanup• Saga / Compensation
@berndruecker
![Page 78: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/78.jpg)
Thank you!
@berndruecker
![Page 79: Lost in transaction? - JAX London...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](https://reader034.fdocuments.us/reader034/viewer/2022042323/5f0e07d57e708231d43d4630/html5/thumbnails/79.jpg)
[email protected]@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/