Glossary

Saga Pattern

Saga is a pattern for managing distributed transactions without 2PC. A long business transaction is broken into a sequence of local transactions. Each local transaction publishes an event or message. On failure, compensating transactions are executed.

Two types

Example: order placement

CreateOrder → ReserveInventory → ProcessPayment → ShipOrder
  if ProcessPayment fails:
    → ReleaseInventory (compensating)
    → CancelOrder (compensating)

Challenges

Compensating transactions are not always possible (a sent message cannot be unsent). Saga provides Eventual Consistency, not ACID. Debugging is harder than with a regular transaction.