Stateless all the thing, they say. In the last few years we’ve been brainwashed: design stateless systems, otherwise they cannot scale, they cannot be highly available, and they are hard to maintain and evolve. In a nutshell stateful is bad. However complex software systems need to do collaborative processing, that is stateful by definition. Stateless myth busted! Collaborative domains deal with long business transactions and need to interact with distributed resources. The traditional distributed transactions approach, even if tempting, is a time bomb. This is when Sagas come into play. Sagas allow to model complex collaborative domains without the need for distributed transactions and/or orchestration across multiple resources. Join Mauro on a journey that aims to disclose what sagas are, how they can be used to model a complex collaborative domain, and what role they play when it comes to designing systems with failure and eventual consistency in mind. (It’s all right, I know we’re you’ve been)
22. @mauroservienti
Process Manager (a different point of view)
New requirement: collect tickets at the venue
OrderId ShippingId ShippingStatus Etc
12 1337 Delivered …
58 1338 Pending …
Orders table
23. @mauroservienti
Process Managers: Source of coupling
•Single Point of Failure
•Violates Single Responsibility Principle
•Contention/Performance Bottleneck
•Conflicting Changes/Merge Conflicts
•Single Unit of Deployment
•Data exchange across boundaries
33. @mauroservienti
New requirement
• 12-hours delivery SLA with our customers
• if the default shipping courier doesn't respond
• contact another one to deliver the package
35. @mauroservienti
Shipping
Order Shipped
…
First Courier
Gateway
Pick-up Request
8-hours timeout
Shipping
Have we received a response?
Shipping
Yes
No
Second Courier
Gateway
Pick-up Request
Shipping
Shipping Policy
2-hours escalation timeout
Shipping
Have we received a response?
Yes No Shipment Failed
…
38. @mauroservienti
Sagas (a different point of view)
OrderId ShippingId ShippingStatus Etc
12 1337 Delivered …
58 1338 Pending …
Orders table
Sales Shipping Finance
Id ProductId
12 ABC
58 ACD
Orders table
OrderId Address
12 Haifa, Israel
58 Rotterdam, Holland
Shipping table
OrderId Status
12 Paid
58 Overdue
Invoices table
VS
39. @mauroservienti
Sagas
•Business Process is distributed
•No overarching Process Manager
•Respect Single Responsibility Principle
•Independent scale out
•Simpler/not conflicting evolution
•Independent Units of Deployment
41. @mauroservienti
Takeaways
• Boundaries are key to success
• Mental model can badly influence design
• Users/Business analysts tend to think in term
of data presentation
42. @mauroservienti
Takeaways
• Boundaries are key to success
• Mental model can badly influence design
• Behaviors define how to designs processes
• Group data that change together
• Follow the coupling
• Identify processes and chop them up by “service”
43. @mauroservienti
Takeaways
• Boundaries are key to success
• Mental model can badly influence design
• Behaviors define how to designs processes
• Use Delayed Messaging to model time
• Simplifies making decisions in an async world
44. @mauroservienti | #EDDD
Mauro Servienti
Solution Architect @ Particular Software
the makers of NServiceBus
mauro.servienti@particular.net
@mauroservienti
//milestone.topics.it
Let me tell that you of that time when {the vendor I cannot name} gifted me with a nice {flat x86 device with a very thin keyboard}
{the story}
It’s obvious that there are two very different point of views here.