Replace a cross-service ACID transaction with a sequence of local transactions plus compensating actions to undo on failure.
Plain English: you can't run one database transaction across multiple microservices. A saga breaks a multi-step operation (reserve seat, charge card, send ticket) into separate local steps, and if a later step fails, it runs 'undo' actions (refund the card, release the seat) for the earlier ones. It's how you fake a transaction across services.
A pattern for managing data consistency across multiple services without a distributed ACID transaction. A saga is a sequence of local transactions, each in a single service; each step has a corresponding compensating transaction that semantically undoes it. If any step fails, the saga executes the compensations for the already-completed steps in reverse, leaving the system in a consistent (rolled-back) state.
Microservices each own their database, so a single business operation spanning several of them can't use one BEGIN/COMMIT, since there's no shared transaction. Two-phase commit across services exists but is slow, locks resources, and couples availability to every participant. Sagas provide consistency without distributed locks: each service commits locally and independently, and failure is handled by compensating actions rather than a global rollback.
Two coordination styles. Choreography: each service listens for events and emits the next one ('SeatReserved' → Payment service charges → 'PaymentFailed' triggers seat release). No central coordinator; simple for short flows, tangled for long ones. Orchestration: a central orchestrator explicitly tells each service what to do and what to compensate, tracking saga state. On failure at step N, the orchestrator (or the event chain) invokes compensating transactions for steps N-1…1 in reverse. Compensations must be idempotent and semantic ('refund' rather than literal rollback, since the original commit is permanent).
Hold seat → charge card → issue ticket as a saga; a payment timeout triggers compensation that releases the held seat
Hold dates → authorize payment → confirm booking; if any step fails, compensations release the hold and void the authorization
Multi-step charge flows (authorize, capture, notify) use compensating actions (void/refund) when a downstream step fails