SlideShare une entreprise Scribd logo
1  sur  54
#XeOneDay
Evento realizzato
grazie al supporto di
welcome to the
(state) machine
It’s all right, I know where you’ve been
mauroservienti
Mauro Servienti
All I want to do when I wake up in
the morning is…
(cit. Rosanna, Toto, Toto IV)
mauroservienti
mauroservienti
buy ticket(s)
stage dive… :-)
mauroservienti
All what they want to do is…
mauroservienti
mauroservienti
display available tickets
reserve ticket(s)
charge my credit card
deal with insurance
ship ticket(s)
deal with their stuff
mauroservienti
sometimes order doesn’t matter
sometimes it does!
mauroservienti
Process Manager
Connecting the dots…
mauroservienti
Tickets Selection
Credit Card
Gateway/ACL
Orders Manager
Checkout request
AuthorizeCard
request/response
Reservation
Gateway/ACL
ConfirmTickets
request/response
Credit Card
Gateway/ACL
ChargeCard
request/response
Insurance
Gateway/ACL
TicketsInsurance
request/response
Shipping
Gateway/ACL
Shiptickets
request/response
2-phase commit (kind-of)
…
mauroservienti
Reservation
Gateway/ACL
SelectTickets
request/response
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
mauroservienti
mauroservienti
like a Punch Card, a Process Manager owns the process
Ticket(s)
Stuff…
Insurance
mauroservienti
Process Managers, a source of coupling
•Violates Single Responsibility Principle
•Contention/Performance Bottleneck
•Conflicting Changes/Merge Conflicts
•Single Unit of Deployment
•Single Point of Failure
mauroservienti
user mental model
tends to be UI driven
mauroservienti
there is no Spoon Orders Manager
mauroservienti
chop
up
mauroservienti
Autonomy
Collaborative Domains
mauroservienti
sagas autonomy in
collaborative domains
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
reserve with the theater
charge my credit card
deal with insurance
ship tickets
deal with their stuff
mauroservienti
reservation
finance
insurance
shipping
stuff
mauroservienti
Shipping
Finance
Tickets Ordering Saga
mauroservienti
ReservationOrder Checked-out
Payment Authorized
Order Created
Payment Succeeded
Available Tickets
Select tickets
Shopping Cart
Proceed to checkout
workflow
workflow
workflow
Shipping
Finance
Tickets Ordering Saga
mauroservienti
ReservationOrder Checked-out
Payment Authorized
Order Created
Payment Succeeded
Available Tickets
Select tickets
Shopping Cart
Proceed to checkout
Policy
Policy
Policy
Shipping
Finance
mauroservienti
Reservation
Available Tickets
Select tickets
Shopping Cart
Proceed to checkout
Policy
Policy
Policy
Order Checked-out
Payment Authorized
Order Created
Payment Succeeded
Pivotal Events
mauroservienti
Let’s open the black box
Shipping
ReservationPayment
Gateway
Finance
Finance
Initiate Payment
Authorize Card
Courier
Gateway
Tickets Ordering Saga
mauroservienti
Available Tickets
Select tickets
Reservation
Shopping Cart
Proceed to checkout
Reservation
Order Checked-out
Payment Authorized
Order CreatedFinance
Payment
Gateway
Charge Card
Payment Succeeded Delivery Pick-up
Order Shipped
multiple workflows,
each providing
compensating
actions for every
step of the
workflow where it
can fail
mauroservienti
Shipping
ReservationPayment
Gateway
Finance
Finance
Initiate Payment
Authorize Card
Courier
Gateway
Tickets Ordering Saga
mauroservienti
Available Tickets
Select tickets
Reservation
Shopping Cart
Proceed to checkout
Reservation
Order Checked-out
Payment Authorized
Order CreatedFinance
Payment
Gateway
Charge Card
Payment Succeeded Delivery Pick-up
Order Shipped
Payment
Gateway
Finance
Finance
Initiate Payment
Authorize Card
Payment Policy
mauroservienti
Order Checked-out
Payment Authorized
Finance
Payment
Gateway
Charge Card
Payment Succeeded
Payment
Gateway
Finance
Finance
Initiate Payment
Authorize Card
Payment Policy
mauroservienti
Order Checked-out
Payment Authorized
48hrs to release money
Payment
Gateway
Finance
Finance
Initiate Payment
Authorize Card
Payment Policy
mauroservienti
Order Checked-out
Payment Authorized
Finance
Payment
Gateway
Charge Card
Payment Succeeded
48hrs to release money
Payment
Gateway
Release Money
Reserved?N
Y
Do nothing… Reservation
Order Created
48hrs later…
New requirement
• A ticket must be purchased within 10 minutes
mauroservienti
Shipping
ReservationPayment
Gateway
Finance
Finance
Initiate Payment
Authorize Card
Courier
Gateway
Tickets Ordering Saga
mauroservienti
Available Tickets
Select tickets
Reservation
Shopping Cart
Proceed to checkout
Reservation
Order Checked-out
Payment Authorized
Order CreatedFinance
Payment
Gateway
Charge Card
Payment Succeeded Delivery Pick-up
Order Shipped
Reservation
Reservation Policy
mauroservienti
Available Tickets
Select tickets
Reservation Tickets Reserved
10’ to purchase
Reservation
Release Tickets
N
Y
Do nothing…
Checked-out?Reservation Expired
Shipping
ReservationPayment
Gateway
Finance
Finance
Initiate Payment
Authorize Card
Courier
Gateway
Tickets Ordering Saga
mauroservienti
Available Tickets
Select tickets
Reservation Tickets Added to Cart Reservation
Shopping Cart
Proceed to checkout
Reservation
Order Checked-out
Payment Authorized
Order CreatedFinance
Payment
Gateway
Charge Card
Payment Succeeded Delivery Pick-up
Order Shipped
10’ to purchase
48hrs to release money
New requirement
• 12-hours delivery SLA with our customers
• if the default shipping courier doesn't respond
• contact another one to deliver the package
mauroservienti
Shipping
ReservationPayment
Gateway
Finance
Finance
Initiate Payment
Authorize Card
Courier
Gateway
Shipping Policy
mauroservienti
Available Tickets
Select tickets
Reservation Tickets Added to Cart Reservation
Shopping Cart
Proceed to checkout
Reservation
Order Checked-out
Payment Authorized
Order CreatedFinance
Payment
Gateway
Charge Card
Payment Succeeded Delivery Pick-up
Order Shipped
10’ to purchase
48hrs to release money
Shipping
Order Shipped
…
First Courier
Gateway
Pick-up Request
Shipping
Shipping
Second Courier
Gateway
Pick-up Request
Shipping
Shipping
Have we received a response?
Shipment Failed
…
mauroservienti
8hrs timeout
Shipping Policy
Have we received a response?
?
2hrs escalation timeout
N
N?Y
Y
Concurrency
1. Pick-up request to 1st courier
2. 8 hours go by
3. No response yet
4. Pick-up request to 2nd courier
5. 2nd courier replies
6. 1st courier replies…Ooops
mauroservienti
mauroservienti
It’s a business problem
Sagas (a different point of view)
OrderId ShippingId ShippingStatus Etc
12 1337 Delivered …
58 1338 Pending …
Orders table
Reservation Shipping Finance
Id TicketId
12 ABC
58 ACD
Reservations table
OrderId Address
12 Haifa, Israel
58 Rotterdam, Holland
Shipping table
OrderId Status
12 Paid
58 Overdue
Invoices table
VS
mauroservienti
Sagas (a different point of view)
Reservation Shipping Finance
Id TicketId
12 ABC
58 ACD
Reservations table
OrderId Address
12 Haifa, Israel
58 Rotterdam, Holland
Shipping table
OrderId Status
12 Paid
58 Overdue
Invoices table
mauroservienti
Each service can evolve independently
Sagas
•Business Process is distributed
•No overarching Process Manager
•Respect Single Responsibility Principle
•Independent scale out
•Simpler/not conflicting evolution
•Independent Units of Deployment
mauroservienti
Every year is getting shorter never seem to find the time…
Sagas Demo
bit.ly/xe-state-machine
Udi Dahan about Sagas
go.particular.net/xe-state-machine
mauroservienti
Demos: bit.ly/xe-state-machine
Videos: go.particular.net/xe-state-machine
Pitfalls
• Monitor the (distributed) state
mauroservienti
Demos: bit.ly/xe-state-machine
Videos: go.particular.net/xe-state-machine
Pitfalls
• Monitor the (distributed) state
• There is no such thing as orchestration
• Sagas spanning multiple services
mauroservienti
Demos: bit.ly/xe-state-machine
Videos: go.particular.net/xe-state-machine
Takeaways
• Boundaries are key to success
• Finding boundaries is the hardest part
mauroservienti
Demos: bit.ly/xe-state-machine
Videos: go.particular.net/xe-state-machine
Takeaways
• Boundaries are key to success
• Behaviors define how to designs processes
• Follow the coupling, not the data
• Identify processes and chop them up by “service”
mauroservienti
Demos: bit.ly/xe-state-machine
Videos: go.particular.net/xe-state-machine
Takeaways
• Boundaries are key to success
• Behaviors define how to designs processes
• Use Delayed Messaging to model time
• Simplifies making decisions in an async world
mauroservienti
@mauroservienti | #EDDD
Mauro Servienti
Solution Architect @ Particular Software
the makers of NServiceBus
mauro.servienti@particular.net
@mauroservienti
//github.com/mauroservienti
//milestone.topics.it
mauroservienti
@mauroservienti | #EDDD
Demos: bit.ly/xe-state-machine
Videos: go.particular.net/xe-state-machine
mauroservienti

Contenu connexe

Similaire à Welcome to the (state) machine @ Xe One Day Enterprise Applications

Innovators simply smart-integrated ver 5
Innovators   simply smart-integrated ver 5Innovators   simply smart-integrated ver 5
Innovators simply smart-integrated ver 5
walkthis
 
Heropay_Ultimate-guide-booklet_Final
Heropay_Ultimate-guide-booklet_FinalHeropay_Ultimate-guide-booklet_Final
Heropay_Ultimate-guide-booklet_Final
Adam J. Rebolloso
 

Similaire à Welcome to the (state) machine @ Xe One Day Enterprise Applications (12)

eCommerce payments overview
eCommerce payments overvieweCommerce payments overview
eCommerce payments overview
 
Payment gateway[1].pptx
Payment gateway[1].pptxPayment gateway[1].pptx
Payment gateway[1].pptx
 
Check-out & settlement procedure in hotel front office
Check-out &  settlement procedure in hotel front officeCheck-out &  settlement procedure in hotel front office
Check-out & settlement procedure in hotel front office
 
Online reservation
Online reservationOnline reservation
Online reservation
 
Checkout & Settlement Process (updated on August 18, 2020)
Checkout & Settlement Process (updated on August 18, 2020)Checkout & Settlement Process (updated on August 18, 2020)
Checkout & Settlement Process (updated on August 18, 2020)
 
Face to Face Banking - Money Withdraw Transaction- Service Blue Print - Taxon...
Face to Face Banking - Money Withdraw Transaction- Service Blue Print - Taxon...Face to Face Banking - Money Withdraw Transaction- Service Blue Print - Taxon...
Face to Face Banking - Money Withdraw Transaction- Service Blue Print - Taxon...
 
payment gateway for tech support
payment gateway for tech supportpayment gateway for tech support
payment gateway for tech support
 
Innovators simply smart-integrated ver 5
Innovators   simply smart-integrated ver 5Innovators   simply smart-integrated ver 5
Innovators simply smart-integrated ver 5
 
Payment process Manager
Payment  process  ManagerPayment  process  Manager
Payment process Manager
 
Hotel fo front office cashiering procedure
Hotel fo front office cashiering procedureHotel fo front office cashiering procedure
Hotel fo front office cashiering procedure
 
Credit Cards Navision Processor
Credit Cards Navision ProcessorCredit Cards Navision Processor
Credit Cards Navision Processor
 
Heropay_Ultimate-guide-booklet_Final
Heropay_Ultimate-guide-booklet_FinalHeropay_Ultimate-guide-booklet_Final
Heropay_Ultimate-guide-booklet_Final
 

Plus de Mauro Servienti

Plus de Mauro Servienti (20)

Designing a ui for microservices @ .NET Day Switzerland 2019
Designing a ui for microservices @ .NET Day Switzerland 2019Designing a ui for microservices @ .NET Day Switzerland 2019
Designing a ui for microservices @ .NET Day Switzerland 2019
 
All our aggregates are wrong @ NDC Copenhagen 2019
All our aggregates are wrong @ NDC Copenhagen 2019All our aggregates are wrong @ NDC Copenhagen 2019
All our aggregates are wrong @ NDC Copenhagen 2019
 
Be like water, my friend @ Agile for Innovation 2019
Be like water, my friend @ Agile for Innovation 2019Be like water, my friend @ Agile for Innovation 2019
Be like water, my friend @ Agile for Innovation 2019
 
Microservices architecture is it the right choice to design long-living syste...
Microservices architecture is it the right choice to design long-living syste...Microservices architecture is it the right choice to design long-living syste...
Microservices architecture is it the right choice to design long-living syste...
 
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
Titles, abstracts, and bio matter... oh my! @ Global Diversity CFP Day 2019
 
Living organizations, particular software @ do IT Better Parma
Living organizations, particular software @ do IT Better ParmaLiving organizations, particular software @ do IT Better Parma
Living organizations, particular software @ do IT Better Parma
 
PO is dead, long live the PO - Italian Agile Day 2018
PO is dead, long live the PO - Italian Agile Day 2018PO is dead, long live the PO - Italian Agile Day 2018
PO is dead, long live the PO - Italian Agile Day 2018
 
Design a UI for your Microservices @ Do IT Better
Design a UI for your Microservices @ Do IT BetterDesign a UI for your Microservices @ Do IT Better
Design a UI for your Microservices @ Do IT Better
 
Microservices and pineapple on pizza what do they have in common - dos and ...
Microservices and pineapple on pizza   what do they have in common - dos and ...Microservices and pineapple on pizza   what do they have in common - dos and ...
Microservices and pineapple on pizza what do they have in common - dos and ...
 
All our aggregates are wrong (ExploreDDD 2018)
All our aggregates are wrong (ExploreDDD 2018)All our aggregates are wrong (ExploreDDD 2018)
All our aggregates are wrong (ExploreDDD 2018)
 
Designing a ui for microservices
Designing a ui for microservicesDesigning a ui for microservices
Designing a ui for microservices
 
Po is dead, long live the po
Po is dead, long live the poPo is dead, long live the po
Po is dead, long live the po
 
Shipping code is not the problem, deciding what to ship it is!
Shipping code is not the problem, deciding what to ship it is!Shipping code is not the problem, deciding what to ship it is!
Shipping code is not the problem, deciding what to ship it is!
 
GraphQL - Where are you from? Where are you going?
GraphQL - Where are you from? Where are you going?GraphQL - Where are you from? Where are you going?
GraphQL - Where are you from? Where are you going?
 
Dall'idea al deploy un lungo viaggio che passa per git flow e semver
Dall'idea al deploy   un lungo viaggio che passa per git flow e semverDall'idea al deploy   un lungo viaggio che passa per git flow e semver
Dall'idea al deploy un lungo viaggio che passa per git flow e semver
 
Progettare una UI per i Microservices
Progettare una UI per i MicroservicesProgettare una UI per i Microservices
Progettare una UI per i Microservices
 
The road to a Service Oriented Architecture is paved with messages
The road to a Service Oriented Architecture is paved with messagesThe road to a Service Oriented Architecture is paved with messages
The road to a Service Oriented Architecture is paved with messages
 
La via verso SOA è lastricata di messaggi
La via verso SOA è lastricata di messaggiLa via verso SOA è lastricata di messaggi
La via verso SOA è lastricata di messaggi
 
Implementare il single sign on con IdentityServer
Implementare il single sign on con IdentityServerImplementare il single sign on con IdentityServer
Implementare il single sign on con IdentityServer
 
How we daily manage and work in a dispersed company: Particular Software
How we daily manage and work in a dispersed company: Particular SoftwareHow we daily manage and work in a dispersed company: Particular Software
How we daily manage and work in a dispersed company: Particular Software
 

Dernier

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 

Dernier (20)

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 

Welcome to the (state) machine @ Xe One Day Enterprise Applications

Notes de l'éditeur

  1. Ritmo tribale Litfiba
  2. 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.
  3. Quick detour on the overall complexity
  4. No scatter/gather Too many messages
  5. No scatter/gather Too many messages