Skip to main content
PreparationZone Logo
PrepZone

Saga Choreography with Domain Events

OrderPlaced → ReserveInventory → ChargePayment → ShipOrder — compensating events on failure.

Pass checkpoint below

Why this matters

  • VaultCommerce checkout: OrderPlaced → ReserveInventory → PaymentAuthorized → OrderConfirmed; failures emit ReleaseInventory.
  • No central orchestrator — Kafka topics are the workflow bus.
  • Each step must be idempotent; saga state inferred from event history.
  • Contrast with orchestration (Temporal/Camunda) in system design discussions.
OrderPlaced
InventoryReserved
PaymentCaptured
PaymentFailed → ReleaseInventoryCompensate
Each service listens and publishes domain events. Failure triggers compensating events on the same log.

Happy path choreography

order-service publishes OrderPlaced. inventory-service reserves, publishes InventoryReserved. payment-service charges, publishes PaymentCaptured. shipping-service listens to PaymentCaptured. Each service owns its topic subscriptions and compensations.

Key points

  • Choreography — distributed workflow via events, no central coordinator
  • Compensating event — undo partial work (ReleaseInventory)
  • Saga — multi-step business transaction across services
  • Eventual consistency — saga completes asynchronously
  • Orchestration alternative — central state machine driving steps

The rest of this guide is part of Pro

Free covers every fresher guide in full. Pro unlocks Senior, Staff and Architect guides across every track.

Still to come · 2 sections

  • Compensating transactions
  • VaultCommerce rollout checklist

Test yourself

Answer these before moving on — recall is what makes it stick.