Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
@mauroservienti
welcome to the
(state) machine
It’s all right, I know where you’ve been
@mauroservienti
All I want to do when I wake up in
the morning is…
(cit. Rosanna, Toto, Toto IV)
@mauroservienti
@mauroservienti
tickets web site
buy a ticket
stage dive… :-)
@mauroservienti
All what they want to do is…
@mauroservienti
@mauroservienti
display available tickets
reserve with the theater
charge my credit card
deal with insurance
ship tickets
...
@mauroservienti
sometimes order doesn’t matter
sometimes it does!
@mauroservienti
spot the
@mauroservienti
my ticket
Warehouse
Insurance
@mauroservienti
issuesOwnership is lost
@mauroservienti
@mauroservienti
chop
up
@mauroservienti
@mauroservienti
@mauroservienti
The (state) machine
ticket ordering process
@mauroservienti
reserve with the theater
charge my credit card
deal with insurance
ship tickets
deal with their stuff
The ...
@mauroservienti
reservation
payment
insurance
shipping
stuff
The (state) machine
@mauroservienti
Process Manager
Connecting the dots…
@mauroservienti
Credit Card
Gateway/ACL
Orders Manager
Checkout request
Block off money
request/response
Reservation
Gatew...
@mauroservienti
like a Punch Card, a
Process Manager
owns the process
@mauroservienti
Process Manager (a different point of view)
New requirement: collect tickets at the venue
OrderId Shipping...
@mauroservienti
Process Managers: Source of coupling
•Single Point of Failure
•Violates Single Responsibility Principle
•C...
@mauroservienti
user mental model
tends to be UI driven
@mauroservienti
there is no Spoon Orders Manager
@mauroservienti
Autonomy
Collaborative Domains
@mauroservienti
Sagas
@mauroservienti
multiple workflows,
each providing
compensating
actions for every
step of the workflow
where it can fail
@mauroservienti
multiple workflows,
each providing
compensating
actions for every
step of the workflow
where it can fail
@mauroservienti
multiple workflows,
each providing
compensating
actions for every
step of the workflow
where it can fail
@mauroservienti
Shipping
Insurance
Finance
Reservation
1-day timeout to release money
Payment
Gateway
Finance
Order Checke...
@mauroservienti
Shipping
Insurance
Finance
Reservation
1-day timeout to release money
Payment
Gateway
Finance
Order Checke...
@mauroservienti
New requirement
• 12-hours delivery SLA with our customers
• if the default shipping courier doesn't respo...
@mauroservienti
Shipping
Insurance
Finance
Reservation
1-day timeout to release money
Payment
Gateway
Finance
Order Checke...
@mauroservienti
Shipping
Order Shipped
…
First Courier
Gateway
Pick-up Request
8-hours timeout
Shipping
Have we received a...
@mauroservienti
Payment
Policy
Shipping
Policy
Reservation
Policy
Seats Reserved
Payment Succeeded
Release money
Order Che...
@mauroservienti
Payment
Policy
Customer Care
…
Reservation
Policy
Payment Failed
Order Checked-out
fail
Happy path and not...
@mauroservienti
Sagas (a different point of view)
OrderId ShippingId ShippingStatus Etc
12 1337 Delivered …
58 1338 Pendin...
@mauroservienti
Sagas
•Business Process is distributed
•No overarching Process Manager
•Respect Single Responsibility Prin...
@mauroservienti
Takeaways
• Boundaries are key to success
• Finding boundaries is the hardest part
@mauroservienti
Takeaways
• Boundaries are key to success
• Mental model can badly influence design
• Users/Business analy...
@mauroservienti
Takeaways
• Boundaries are key to success
• Mental model can badly influence design
• Behaviors define how...
@mauroservienti
Takeaways
• Boundaries are key to success
• Mental model can badly influence design
• Behaviors define how...
@mauroservienti | #EDDD
Mauro Servienti
Solution Architect @ Particular Software
the makers of NServiceBus
mauro.servienti...
@mauroservienti | #EDDD
Thank you!
Upcoming SlideShare
Loading in …5
×

1

Share

Download to read offline

Welcome to the (state) machine @ Crafted Software

Download to read offline

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)

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Welcome to the (state) machine @ Crafted Software

  1. 1. @mauroservienti welcome to the (state) machine It’s all right, I know where you’ve been
  2. 2. @mauroservienti All I want to do when I wake up in the morning is… (cit. Rosanna, Toto, Toto IV)
  3. 3. @mauroservienti
  4. 4. @mauroservienti tickets web site buy a ticket stage dive… :-)
  5. 5. @mauroservienti All what they want to do is…
  6. 6. @mauroservienti
  7. 7. @mauroservienti display available tickets reserve with the theater charge my credit card deal with insurance ship tickets deal with their stuff
  8. 8. @mauroservienti sometimes order doesn’t matter sometimes it does!
  9. 9. @mauroservienti spot the
  10. 10. @mauroservienti my ticket Warehouse Insurance
  11. 11. @mauroservienti issuesOwnership is lost
  12. 12. @mauroservienti
  13. 13. @mauroservienti chop up
  14. 14. @mauroservienti
  15. 15. @mauroservienti
  16. 16. @mauroservienti The (state) machine ticket ordering process
  17. 17. @mauroservienti reserve with the theater charge my credit card deal with insurance ship tickets deal with their stuff The (state) machine
  18. 18. @mauroservienti reservation payment insurance shipping stuff The (state) machine
  19. 19. @mauroservienti Process Manager Connecting the dots…
  20. 20. @mauroservienti Credit Card Gateway/ACL Orders Manager Checkout request Block off money request/response Reservation Gateway/ACL Reservation request/response Credit Card Gateway/ACL Charge credit card request/response Insurance Gateway/ACL Tickets Insurance request/response Shipping Gateway/ACL Ship tickets request/response 2-phase commit / timeout …
  21. 21. @mauroservienti like a Punch Card, a Process Manager owns the process
  22. 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. 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
  24. 24. @mauroservienti user mental model tends to be UI driven
  25. 25. @mauroservienti there is no Spoon Orders Manager
  26. 26. @mauroservienti Autonomy Collaborative Domains
  27. 27. @mauroservienti Sagas
  28. 28. @mauroservienti multiple workflows, each providing compensating actions for every step of the workflow where it can fail
  29. 29. @mauroservienti multiple workflows, each providing compensating actions for every step of the workflow where it can fail
  30. 30. @mauroservienti multiple workflows, each providing compensating actions for every step of the workflow where it can fail
  31. 31. @mauroservienti Shipping Insurance Finance Reservation 1-day timeout to release money Payment Gateway Finance Order Checked-out Initiate Payment Policy Finance Hold money Venue Gateway Reserve seats Seats Reserved Payment Gateway Charge money Payment Succeeded Order Shipped …whatever … Courier Gateway Pick-up Request Tickets Ordering Saga
  32. 32. @mauroservienti Shipping Insurance Finance Reservation 1-day timeout to release money Payment Gateway Finance Order Checked-out Initiate Payment Policy Finance Hold money Venue Gateway Reserve seats Seats Reserved Payment Gateway Charge money Payment Succeeded Order Shipped …whatever … Courier Gateway Pick-up Request Payment Policy Tickets Ordering Saga
  33. 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
  34. 34. @mauroservienti Shipping Insurance Finance Reservation 1-day timeout to release money Payment Gateway Finance Order Checked-out Initiate Payment Policy Finance Hold money Venue Gateway Reserve seats Seats Reserved Payment Gateway Charge money Payment Succeeded Order Shipped …whatever … Courier Gateway Pick-up Request Tickets Ordering Saga
  35. 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 …
  36. 36. @mauroservienti Payment Policy Shipping Policy Reservation Policy Seats Reserved Payment Succeeded Release money Order Checked-out fail 1-day timeout to release money Happy path and not so happy path :)
  37. 37. @mauroservienti Payment Policy Customer Care … Reservation Policy Payment Failed Order Checked-out fail Happy path and not so happy path :)
  38. 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. 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
  40. 40. @mauroservienti Takeaways • Boundaries are key to success • Finding boundaries is the hardest part
  41. 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. 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. 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. 44. @mauroservienti | #EDDD Mauro Servienti Solution Architect @ Particular Software the makers of NServiceBus mauro.servienti@particular.net @mauroservienti //milestone.topics.it
  45. 45. @mauroservienti | #EDDD Thank you!
  • AngeloGiuffredi

    Dec. 18, 2018

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)

Views

Total views

145

On Slideshare

0

From embeds

0

Number of embeds

0

Actions

Downloads

5

Shares

0

Comments

0

Likes

1

×