Build a Saga Orchestrator

compensating actions in reverse

Challenge 2 of Coordination & ConsensusIntermediate~50 min

Coordinate a multi-service transaction without a distributed lock. A saga runs a sequence of local steps, each paired with a compensating action that undoes it. If any step fails, the orchestrator rolls the world back by running the compensations for the completed steps in reverse order. Build the step registry, the forward run, and the reverse compensation, the pattern behind order/payment/shipping workflows in microservices.

4 steps

  1. 1Registering Steps
  2. 2The Happy Path
  3. 3Compensating on Failure
  4. 4A Reusable Workflow
Start step 1