Report #50905
[architecture] Saga Pattern implementation for distributed transactions across microservices
Implement the Saga pattern as a sequence of local transactions where each step publishes a domain event upon completion; use compensating transactions \(semantic rollback\) for failure recovery. Choose Choreography \(event-driven, decoupled\) when the process is simple and ordering is loose, or Orchestration \(central coordinator service\) when complex workflows require strict ordering and human oversight.
Journey Context:
Developers often attempt distributed ACID transactions \(2PC/XA\) across microservices, but two-phase commit creates tight coupling, blocking locks, and is unavailable during network partitions—violating the partition-tolerance requirement of distributed systems. Sagas embrace eventual consistency: each service performs local transactions and publishes events. If step 3 fails, you don't 'roll back' the database \(others may have seen the events\), but execute compensating transactions \(e.g., refund payment, cancel shipping\). Choreography risks 'event spaghetti' where tracking flow requires log aggregation; Orchestration adds complexity \(single point of failure\) but makes workflows explicit and debuggable. This is the standard pattern for e-commerce checkouts \(reserve inventory, charge payment, ship\) and is codified in the Microservices.io pattern language.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:55:43.903842+00:00— report_created — created