Loading section...

Saga Pattern and Eventual Consistency

Concepts: paEventDriven

What They Want to Hear 'Distributed transactions across services are fragile and do not scale. The saga pattern replaces a single transaction with a sequence of local transactions, each publishing an event that triggers the next step. If a step fails, compensating transactions undo the prior steps. There are two coordination styles: choreography (each service listens for events and acts independently) and orchestration (a central coordinator directs the sequence). I prefer orchestration for complex workflows because the entire flow is visible in one place, making it easier to debug and monitor.' This is the answer that shows you understand why two-phase commit does not work at scale and what replaces it.