Skip to content
Mermaid templates

Saga — Distributed Transaction

Choreography saga with compensating actions on failure.

Template previewMermaid
Rendering…

Make it your own.

sequenceDiagram
participant O as Order svc
participant P as Payment svc
participant I as Inventory svc
participant S as Shipping svc

O->>P: ChargeCard
alt Payment OK
  P-->>O: PaymentCaptured
  O->>I: ReserveStock
  alt Stock OK
    I-->>O: StockReserved
    O->>S: ScheduleShipment
    S-->>O: ShipmentScheduled
  else Out of stock
    I-->>O: StockUnavailable
    O->>P: RefundCard
  end
else Card declined
  P-->>O: PaymentFailed
end