Compare Saga Orchestration versus Saga Choreography for complex distributed workflows.
β Interview Prompt: Compare Saga Choreography (event-driven, decentralized, high coupling risk) vs Saga Orchestration (centralized orchestrator, explicit state machine).
Evaluating Saga implementation paradigms:
| Feature | Saga Choreography | Saga Orchestration |
|---|---|---|
| Control | Decentralized; microservices listen & emit events | Centralized Saga Orchestration State Machine |
| Coupling | Services must know events of other services | Services only know the central Orchestrator |
| Visibility | Difficult to trace complex 10+ step workflows | Centralized state machine provides 100% workflow visibility |
| Ideal For | Simple 2-3 step microservice workflows | Complex enterprise multi-step business transactions |
Code Implementation Example
// Saga Orchestrator State Machine (Temporal / AWS Step Functions)
export async function paymentWorkflowOrchestrator(ctx: WorkflowContext) {
await ctx.executeStep('reserveInventory');
await ctx.executeStep('processPayment');
await ctx.executeStep('shipOrder');
}Use Saga Choreography for simple 2-step event flows, and Saga Orchestration for complex multi-step business workflows.