Order Saga — Orchestration with Compensation

Order Saga — Orchestration with Compensation A sequence diagram generated by Archify. POST /orders 202 PENDING ReserveStock ReserveStock StockReserved ChargePayment ChargePayment PaymentFailed ReleaseStock ReleaseStock StockReleased order REJECTED (notify) Start Happy steps Compensate Client · checkout · Sequence participant Client checkout Order service · saga orchestrator · Sequence participant Order service saga orchestrator Broker · commands + replies · Sequence participant Broker commands + replies Inventory · reservations · Sequence participant Inventory reservations Payments · charges · Sequence participant Payments charges Shipping · shipments · Sequence participant Shipping shipments Legend request return security async trace

Orchestration

  • • One component owns the saga state machine
  • • Each step is a local transaction in one service

Compensation

  • • A failed step triggers semantic undo of completed steps
  • • Compensations must be idempotent and retryable

Delivery

  • • Commands and replies go through the outbox
  • • Consumers deduplicate by message ID