Process Manager
A stateful orchestrator that coordinates long-running distributed processes by reacting to events and sending commands.
A process manager is a stateful orchestrator that coordinates a long-running distributed process. It reacts to events, decides what should happen next, sends commands, and keeps track of everything.
The key difference from a saga is that a process manager maintains state. It knows which steps have completed, which are pending, and what to do if something fails. A saga, by contrast, is stateless: each step just reacts to the previous event without tracking the overall progress.
In practice, a process manager looks like this:
- An event arrives (e.g., "ShowTicketBooked").
- The process manager loads its current state from the database.
- Based on the state, it decides what command to send next (e.g., "BookFlightTicket").
- It updates its state and waits for the next event.
If a step fails, the process manager knows exactly which steps succeeded and can trigger the right compensating actions in reverse order.
Process managers are the right choice when the workflow has multiple steps, branching logic, or requires tracking partial progress. For simple two-step flows, choreography (direct event reactions without a coordinator) is usually enough. Orchestration adds overhead, so use it only when complexity justifies the cost.