Saga Lab
Place an order that needs four services to agree, with no shared transaction to hold it together. Make a step fail and watch the saga undo the steps that already happened, then add the problems real systems have: a missing refund, duplicate messages, a compensation that fails.
Background: Saga, Transactional Outbox, Idempotent Consumer.
Run these in order
Watch the happy path
Load it. Each step is a local transaction in one service. No lock is held across services, so between steps other requests can see the order as pending.
Fail the last step
Shipping finds no courier. The saga undoes what already happened, newest first: refund, release the item, cancel the order. Shipping itself has nothing to undo.
Forget a compensation
Payment has no refund step. Everything else is undone, but the customer has paid for a cancelled order. Every step that changes something needs its undo designed up front.
Deliver messages twice
Brokers deliver at least once, so duplicates happen. Without idempotent handlers the refund runs twice and the item is released twice. Then tick “Handlers ignore duplicates”. Cancelling is safe either way: setting a status twice changes nothing.
Let a compensation fail
The refund times out and nobody retries. The orchestrator stops, leaving the order pending and the item reserved until a person steps in. Tick “Retry failed compensations”: compensations must be retried until they succeed.
Compare with choreography
Switch the coordination to choreography and rerun the timeout. Each service reacts to events on its own, so the others still undo their steps. But no service knows the saga as a whole is stuck, which is why choreography needs good tracing.
This lab simplifies reality on purpose. Messages arrive in order and nothing runs in parallel. Real sagas also have to handle other requests that read half-finished data (for example, stock that is reserved but not yet paid for), messages that arrive out of order, and timeouts where a step's result is unknown. Frameworks such as Temporal, Camunda and AWS Step Functions handle the retries and saga state for orchestration.