5 exercises — Learn saga pattern vocabulary: choreography vs orchestration, compensating transactions, and partial failure.
0 / 5 completed
1 / 5
A saga in distributed systems is used to:
Sagas replace distributed transactions (2PC) in microservices. Each saga step is a local transaction; if a step fails, compensating transactions undo the completed steps. The saga maintains business consistency without locking across services.
2 / 5
In a choreography saga, coordination happens because:
Choreography sagas are event-driven: 'OrderPlaced' triggers PaymentService, which emits 'PaymentProcessed', triggering ShippingService, etc. There is no orchestrator — services are decoupled and react to events.
3 / 5
What is a compensating transaction?
Because local transactions are already committed when a later step fails, you can't use database rollback. Instead, a compensating transaction explicitly undoes the business effect — e.g., 'RefundPayment' compensates for 'ChargeCustomer'.
4 / 5
Your team says: "We chose an orchestration saga here to make the flow visible." What is an advantage of orchestration sagas?
Orchestration sagas centralise the flow in a coordinator (often a state machine). This makes the saga's logic visible and traceable — but introduces coupling to the orchestrator and a potential single point of failure.
5 / 5
Fill in the blank: "The payment step succeeded, but the inventory reservation failed, so we need to ___ the payment."
When a later saga step fails, you 'compensate' (undo) the steps that already completed. 'We need to compensate the payment' means executing a 'RefundPayment' compensating transaction.