Try
↑ ↓ move↵ openesc close
In this lesson · topic 5 of 7
  1. 1. An order that spans four services
  2. 2. Steps, undos and the reverse order
  3. 3. Fail steps and watch readers see the middle
  4. 4. Atomic in the end, visible in the middle
  5. 5. One conductor or a chain of events
  6. 6. When the undo cannot be done
  7. 7. Compensation, isolation and coordination

Topic 5

One conductor or a chain of events

4 min read

Orchestration

One coordinator, the orchestrator, owns the saga. It sends a command to the first service, waits for the reply, then sends the next. On a failure it sends the undo commands. It stores its progress before each step, so after a crash it knows where it was and carries on.

The flow is in one place. You can read it, test it and ask where saga 17 is. The cost is a component to run and a command and a reply for every action. In the lab a saga took 7.9 messagesmeasured with orchestration and 4.0 messagesmeasured with choreography.

Choreography

No one owns the saga. The first service does its step and publishes an event. The next service reacts to that event, does its step and publishes another. A failure is an event too, and each service that has work to undo reacts to it.

There is no central part to fail, and services only need to know the events. The cost is that the flow exists only as the sum of the subscriptions. To see where a saga stands you must collect events from every service. Adding a step can create a cycle of events.

Choosing

Use choreography for a short flow of two or three services with a clear order. Use orchestration when the flow has branches, timeouts or many services, or when someone must be able to see and repair a stuck saga. Both give the same outcome here. Your choice sets how easy it is to see and change.

Predict first

Which is easier to answer with choreography than with orchestration?

Your progress is saved in this browser. Sign in to keep it on every device. Privacy · Terms