Choreography: Services React to Events and Pass the Work Along
Choreography runs a multi-step process across services with no central boss. Each service reacts to an event, does its part, and announces what it did.
In short
Choreography runs a multi-step process across services with no central boss: each service reacts to an event, does its part, and announces what it did.
10 min readFree
What You Will Learn
Some business tasks take several steps, and each step lives in a different small service. Placing an online order is one example. It may need payment, a stock check, a delivery driver and a tracking screen. Choreography is one way to run such a task. In it, no single service is in charge. Each service waits for an event, does its own job, and then announces what it did. The next service hears that announcement and acts. This lesson explains how the pattern works, what it costs, and how to make it safe.
Key words
- Service
- A small program that does one job, such as taking payments or assigning drivers.
- Event
- A short record that says something has happened, such as an order being placed.
- Publish
- Send an event out so that other services can hear about it.
- Subscribe
- Tell the system which events a service wants to hear and react to.
- Message broker
- A shared middle program that receives events and delivers them to the services that subscribed.
- Workflow
- A series of steps that together finish one business task.
- Orchestration
- The other main style, where one central controller tells each service what to do next.
- Coupling
- How much one part of a system depends on another. Low coupling means fewer dependencies.
- Idempotent
- Safe to repeat. Running the same action twice has the same effect as running it once.
- Correlation ID
- A label, such as an order number, that every event in one business run carries.
- Compensating action
- A step that undoes work an earlier step already completed.
How Does Choreography Work?
In choreography, the steps of a process are linked by events instead of by commands from a boss. A service finishes its job and publishes a new event. Other services that care about that event react, do their own work, and publish their own events. The chain keeps going until the task is done. Microsoft's Azure Architecture Center lists choreography as one of the two common ways to build a saga, which is a multi-step business process spread over several services. The other way is orchestration.
What Does Each Service Know?
Its own step
It knows how to do one job, such as taking payment or assigning a driver.
The events it listens for
It names the events that should wake it up and start its work.
The events it sends out
It names the new events it publishes when its job ends.
No service holds the full map of the workflow. The whole process exists only as the sum of these small agreements.
Worked Example: A Food Order
This example is a made-up design for a food delivery app like Uber Eats. It shows the idea at work. It does not claim to describe how that company builds its own system. Follow one order from start to finish.
- 1
Customer places the order
The order service saves the order and publishes an OrderPlaced event. It does not know which services will react.
- 2
Restaurant accepts
The restaurant service hears OrderPlaced, accepts the order, and publishes OrderAccepted.
- 3
Courier is assigned
The courier-dispatch service hears OrderAccepted, picks a driver, and publishes DriverAssigned.
- 4
Tracking screen updates
The notification service hears these events and updates the customer's tracking screen.
- 5
Nobody coordinates
No service told the others to start. Each one reacted to a fact. If you want to change one step, you change only the service that listens to it.
Running the Idea in Python
The sample below copies the food order flow in a few lines. The list called events stands in for the broker. The while loop delivers each event to every handler. No handler calls another handler by name.
# the list acts as a stand-in for the broker
events = []
def publish(name, order_id):
events.append((name, order_id))
def restaurant(name, order_id):
if name == 'OrderPlaced':
publish('OrderAccepted', order_id)
def courier(name, order_id):
if name == 'OrderAccepted':
publish('DriverAssigned', order_id)
def tracking(name, order_id):
print(order_id, 'screen shows', name)
handlers = [restaurant, courier, tracking]
publish('OrderPlaced', 'order-42')
i = 0
while i < len(events):
name, order_id = events[i]
for handler in handlers:
handler(name, order_id)
i += 1
Output
order-42 screen shows OrderPlaced order-42 screen shows OrderAccepted order-42 screen shows DriverAssigned
Read the output. The three lines appear in the order the events were published. The restaurant and courier handlers never mention each other, and the tracking handler never asks for a status.
How Does Choreography Compare with Orchestration?
The other common style is orchestration. In orchestration, a central controller, often called an orchestrator, tells each service what to do next and keeps track of where the process stands. Both styles are valid. Each one buys certain strengths and accepts certain costs.
What You Gain
Loose coupling
Services depend on event names, not on each other's addresses or code. You can add or remove a listener without editing the sender.
Independent deployment
A team can release its service without waiting for a central flow to change.
No single point of failure
The process does not stop just because one central controller went down. The work is spread across the services.
What Gets Harder
Seeing the whole flow
The process map lives across many services, not in one file, so nobody sees the full path at a glance.
Tracing and debugging
When an order gets stuck, you must follow events through several logs to find the cause. Some teams find this slow and error-prone under pressure.
Changing the flow
A new step can break a listener somewhere else. The workflow gets harder to follow as the chain grows.
Cyclic dependencies
Service A waits for an event from B while B waits for an event from A. This loop can stall the whole process.
Testing is also harder. To try one full run, you usually need every service running at once.
Tip
Choreography is not the same as having no flow at all. The flow still exists. It is just spread across the services. Write it down in a shared document so that people can find it.
When Does Choreography Fit?
Choreography suits simple workflows with few participants. Two or three services that run in a clear order, with no complex timing rules, are a good match. Writers on this topic often say that choreography is good enough for short flows. When a flow has many steps, branches, deadlines, or several undo steps, orchestration is usually easier to watch and control.
Tip
Ask two questions. How many services take part? Would you need to see the whole flow on one screen to fix a problem? If the answers are many services and yes, consider orchestration.
Making Choreography Safe
Choreography works well only when a few habits are in place. Three matter most: correlation IDs, idempotent handlers, and compensating actions. A handler is the code that reacts to one event.
Correlation IDs
A correlation ID is a label that every event in one business run carries. For an order, it might be the order number. Without it, the logs from five services show five unrelated lines. With it, you can search for one ID and see the whole run. Microsoft's guidance on idempotent consumers points out that a correlation value refers to a group of related messages, so it should not be used as the key that tells a repeat from a new message.
Tip
Add the correlation ID to the very first event. If the first step leaves it out, the later steps cannot be linked back to the order.
Idempotent Handlers
Because a broker may deliver the same event twice, each handler should be idempotent. That means seeing the same event again gives the same result as seeing it once. Microsoft's guidance describes the usual method: keep a record of the events already handled, and skip any event that is already in that record.
- 1
Read the event's unique ID
Take an ID that stays the same on every redelivery. An ID that changes each time would hide the repeat.
- 2
Check the record of past work
Look up that ID in a store of events the service has already handled.
- 3
Skip a repeat
If the ID is already there, do nothing more and report success.
- 4
Save the work and the ID together
If the ID is new, do the work and record the ID in one transaction. A transaction is a group of changes that all succeed or all fail, so the two can never drift apart.
Compensating Actions
A compensating action is an event that undoes work an earlier step already did. Microsoft's saga guidance says that when a step fails, compensating steps reverse the changes made by the steps that finished before it. Choreography has no controller to roll the process back, so each service must be able to undo its own change when a later event reports a failure. The full rules for undo design are outside this lesson.
Check Yourself
Try these two short scenarios. Each one needs the ideas above to answer.
Quick check
An online shop's checkout runs three services in order: payment, then inventory, then shipping. Each service reacts to the event the one before it published. Payment succeeds and publishes PaymentTaken. Inventory then finds the item is out of stock. With choreography, what should happen next?
Quick check
A courier service handles OrderAccepted by assigning a driver. After a network timeout, the broker delivers OrderAccepted a second time. The service already assigned a driver for that order. What should the handler do with the second copy?
Key Takeaways
No central boss
Services react to events, do their own part, and publish the next event. No controller runs the whole flow.
Easy to start, hard to watch
The design suits small, simple flows. As the flow grows, it becomes harder to trace, debug and change.
Make it safe first
Use correlation IDs, idempotent handlers, and compensating actions before you rely on the flow in production.
Sources
- Saga Design Pattern, Azure Architecture Center (Microsoft Learn)
- Idempotent Consumer Pattern, Azure Architecture Center (Microsoft Learn)
- To choreograph or orchestrate your saga, that is the question (Temporal blog)
- Saga Orchestration vs. Choreography: Making the Right Trade-off in Event-Driven Systems (blog)
- Choreography pattern (designpattern.fyi)
- Saga: Choreography vs Orchestration (Medium article)
- Saga choreography vs orchestration (Jeroen Herczeg blog)
- Grasp course: Saga Choreography vs. Orchestration
Last updated on 18 November 2026
Related lessons
- System designPublisher/Subscriber: Announce Events Once and Let Many Services Listen
- System designEvent Sourcing: Store Every Change as an Event and Rebuild State From It
- UI/UX basicsEvent-driven Process Chain (EPC): Map Events and Functions in Order
- System designEvent-Driven: Announce What Happened and Let Other Parts React
Learn with me
Every lesson is free. I add new ones as I learn. Have a question, or want help with your own work? Book a short call.