Saga Pattern
Saga Pattern — A distributed workflow pattern that decomposes a long business operation into local transactions with semantic compensation for failures.
Chain of Local Transactions
A saga splits a long workflow into local transactions that commit independently. Completion of one step triggers the next; if a later step fails, compensating operations can move earlier effects toward an acceptable business state.
This avoids holding distributed resources for the entire workflow and normally provides eventual rather than immediate global consistency.
Orchestration vs Choreography
With orchestration, a coordinator decides which step runs next. With choreography, services advance the flow by reacting to events. The approaches differ in coupling, observability and debugging behavior.
Compensation Is Not Rollback
A compensating action is not equivalent to rolling back a database transaction. An email, external payment or physical action may be impossible to erase. Compensation is semantic recovery.
When steps can be delivered or executed more than once, Idempotency must also be designed explicitly.