Skip to content
Mermaid templates

Saga Pattern (Mermaid Sequence)

Distributed transaction with compensating actions.

Template previewMermaid
Rendering…

Make it your own.

sequenceDiagram
  participant O as Order
  participant P as Payment
  participant I as Inventory
  participant S as Shipping
  O->>P: Reserve payment
  P-->>O: ok
  O->>I: Reserve stock
  I-->>O: ok
  O->>S: Schedule shipment
  S-->>O: failed
  O->>I: Compensate (release stock)
  O->>P: Compensate (refund)