Choreography vs Orchestration
Choreography vs Orchestration
When a workflow spans multiple components and EDA is the communication mechanism, two patterns for coordinating the steps: choreography (each component reacts to events) and orchestration (a central coordinator drives the steps).
Choreography
Each component subscribes to relevant events and emits its own. The workflow is emergent: no one component owns it.
Order: emits OrderPlaced
v
Stock: subscribes to OrderPlaced
reserves stock
emits StockReserved (or StockReservationFailed)
v
Payment: subscribes to StockReserved
charges payment
emits PaymentCaptured (or PaymentFailed)
v
Shipping: subscribes to PaymentCaptured
creates shipment
emits ShipmentCreated
No one component knows the whole flow. Each only knows its own input and output events.
Properties:
- Components fully decoupled.
- Easy to add new reactions (new subscriber).
- Hard to trace ("where does the flow go after PaymentCaptured?").
- Failure handling distributed and tricky.
Orchestration
A central coordinator (the orchestrator, or process manager, or saga coordinator) calls each step and reacts to results.
class PlaceOrderSaga:
def __init__(self, stock, payment, shipping):
self._stock = stock
self._payment = payment
self._shipping = shipping
async def execute(self, order_id: UUID):
try:
await self._stock.reserve(order_id)
await self._payment.capture(order_id)
await self._shipping.create(order_id)
except PaymentFailed:
await self._stock.release(order_id)
raise
except ShippingFailed:
await self._payment.refund(order_id)
await self._stock.release(order_id)
raise
The orchestrator owns the workflow; participants own their step.
Properties:
- Flow is explicit and centralised.
- Easy to trace and debug.
- Adding a step touches the orchestrator.
- Orchestrator becomes a single point of complexity.
Side-by-side
| Choreography | Orchestration | |
|---|---|---|
| Coupling | Low (events only) | Medium (orchestrator knows participants) |
| Flow visibility | Hidden (across subscribers) | Explicit (in orchestrator) |
| Adding a participant | New subscriber | Modify orchestrator |
| Compensation | Distributed (each step compensates) | Centralised (orchestrator triggers) |
| Debuggability | Hard | Easy |
| Failure isolation | Each step independent | Orchestrator is a failure point |
| Best for | 2-3 step workflows; truly independent reactions | 4+ step workflows; complex compensation |
When to choose choreography
- The flow is 2-3 steps and reactions are independent.
- Components are owned by different teams that want full independence.
- You want easy extension: "team X wants to react to OrderPlaced -> fine, subscribe".
When to choose orchestration
- The flow has 4+ ordered steps with explicit compensation.
- You need visibility into where a given saga is in its lifecycle.
- The flow has branching based on intermediate results.
- One team owns the flow end-to-end.
Anti-patterns
- Choreography for everything. Becomes "causal soup": dozens of subscribers reacting to dozens of events; no one knows the flow.
- Orchestration for everything. Reintroduces tight coupling that EDA was supposed to remove.
- Implicit orchestration. Subscribers that fire in a specific order, with no explicit coordinator. You have orchestration without admitting it — and no place to put compensation.
- Synchronous orchestrator over a network of services. Distributed monolith. Use async + persistence instead.
The middle ground
Most systems use choreography for independent reactions (notifications, logging, projections) and orchestration for explicit workflows (place-order, refund, onboarding). Not a competition — choose per workflow.
A practical saga implementation
When orchestration is needed, persist the saga state so it survives restarts:
saga table:
saga_id | order_id | step | status | payload | updated_at
The orchestrator is a state machine that:
- Reads sagas in "pending" state.
- For each, runs the next step.
- Updates state. Loop.
If the process crashes mid-saga, on restart it picks up where it left off. Compensation runs from the persisted state, not from in-memory variables.