Orchestration & choreography
Orchestration brings sequence decisions together in one coordinator. Choreography distributes reactions to events via participating building blocks.
- CoordinatorCentral expiration decision.
- ChoreographyReactions distribute the flow.
- Summary of flowsVisibility versus distribution.
Context
Why this is important
Where process knowledge lies, determines who is asked for changes and errors. If it is scattered, the overall process is difficult to see. Compensation of a distributed sequence handles the saga.
This building block compares two forms of sequence control. For compensations of a distributed sequence see saga.
At a glance · Central control or choreography
Delay knowledge for reservation and payment
Variant: Warehouse and payment are independent services. The team compares an order orchestration with an event-driven choreography; the payment provider remains external.
This is how you read the picture
- Coordinator In the case of orchestration, the order bears the marking “Expiry knowledge sits here”.
- Choreography In choreography, payment responds to Reserved and Warehouse to Rejected Payment.
- Summary of flows The key figure flow chart: distributed in the coordinator visibly opposite over event contracts.
- carries the flowOrderCoordinator: Workflow knowledge sits here
- ParticipantsInventoryReserved on command
- ParticipantsPaymentPaying on orders
Visible in the coordinatorSummary of flows
Benefits & limitations
Helps if:
- A flow with several steps and error states receives a centrally traceable sequence through orchestration.
- A process coordinator stores progress and the next step to provide authoritative status information.
- Autonomous reactions of the participants distribute the control via choreography.
Boundaries
- A central coordinator becomes additional runtime and change dependency; its availability and state migration must be secured.
- Distributed choreography makes overall progress difficult to see; correlation and status aggregation are necessary.
- Orchestration does not provide global atomicity; Saga and Partial Failures address compensation and unknown outcomes.
In practice
- Record permissible steps, transitions and those responsible for the process. A central controller stores the progress and decides based on explicit answers.
- Make state transitions permanent and resumable. After restarting, the process must neither forget a confirmed step nor double-run a step uncontrollably.
- Choose orchestration or choreography according to change and diagnostic needs. Saga describes distributed local steps; Partial Failures addresses unknown outcomes.
Read the detailed explanation
Orchestration records process progress at a controlling point and selects the next step from responses and failure states. Choreography distributes decisions among participants that react to events.
Central control makes status and ordering easier to query but introduces another dependency. Distributed reactions reduce central control while making the overall path harder to see. Both approaches need durable progress and failure states.
Saga organises distributed local changes and possible compensations; Partial Failures explains why process state must represent unknown outcomes.
Check your understanding
Test yourself in three stages
ReadingCheck in the picture
Who Reacts to PaymentRejected in Choreography?
View the solution with justification
The camp. It releases the reservation itself.
ApplyingTransferred to a new situation
The order should change: first payment, then reservation. Where is the effort smaller?
View the solution with justification
In the case of orchestration: the coordinator is changed. In choreography, several reactions must be coordinated.
EvaluateWeighing an alternative
The team wants to choose choreography instead of orchestration. How do you weigh up?
View the solution with justification
Choreography loosely couples services over events, but makes the overall process more difficult to see. Orchestration bundles the workflow knowledge in one place, but gives the coordinator more responsibility.
Explore further
These building blocks continue the thoughts of this page.
References
- microservices.io · Saga (opens in new tab)Explains local transactions and business compensations.
- Microsoft · Saga (opens in new tab)Compares choreography and orchestration in distributed transactions.
- Martin Fowler · What do you mean by Event-Driven? (opens in new tab)Differentiates event notification, state transfer and event sourcing.