Skip to the guide

Multi-step workflows: orchestration, sagas and durable execution

AdvancedPattern5 pages

Building an extension takes a string of trades: the bricklayer, the roofer, the electrician, the plasterer. A general contractor runs it from a site diary, writing what she's about to book, booking it, then noting it's done, and if the roofer doesn't turn up she phones again the next day. Plastering goes last, because plaster can't be undone. If she's off sick, a colleague carries on from the diary's last line. On a small job the trades can leave each other notes instead, but then nobody notices when one never comes.

The extension is one order, each trade a step another service performs, and the contractor an orchestrator: a workflow engine such as Temporal, or a saga table you own. The diary is the workflow's durable history, phoning again is a retry with backoff, and plaster is the pivot, after which steps only go forward. The colleague is durable execution resuming from the history on another worker, and the notes between trades are choreography, each service reacting to the last one's event. Interviewers ask this wherever an order touches several services, and listen for who owns a step that never finishes. The move: give each multi-step flow one owner that records every step before the next, retries steps under idempotency keys, keeps a deadline on each, and compensates in reverse before the pivot.