A finite-state machine makes an execution flow explicit as states and transitions triggered by events. It has an initial state and one or more final states; states can have entry and exit actions, and transitions can have actions. Modeling a saga orchestrator this way makes its design, implementation, and testing easier. section 10.2.2
Create Order Saga
The orchestrator maps forward and compensating transactions to states such as CREATING_ORDER, RESERVING_CREDIT, and REJECTING_ORDER. Each working state has an entry action that invokes a participant, with transitions reflecting the operation’s possible outcomes. Final states record whether the order was approved, rejected, or failed to be created. section 10.2.2
Figure 10.10 The state machine model for the Create Order Saga
Follow the working states, outcome transitions, and final states of the Create Order Saga. section 10.2.2
The execution mechanism determines what actions and events mean in practice. In either approach, the orchestrator must maintain durable saga instance state, including application data passed between participants. section 10.2.2 section 10.2.4 section 10.2.5
Two execution approaches are:
- Asynchronous messaging: entry actions send commands, and replies trigger transitions. A transactional outbox sends commands, while an idempotent consumer detects and discards duplicate replies. section 10.2.4
- Synchronous request/response: entry actions make HTTP requests, and responses trigger transitions. If communication fails without a response, the machine remains in its state until a timeout triggers a transition back to that state and retries the request. An idempotency token helps the participant handle duplicates. section 10.2.5
Figure 10.16 The state machine for a saga orchestrator that invokes the participants using HTTP. HTTP responses trigger state machines. If there’s a communication failure, the state is unchanged and a transition to the same state occurs after a timeout.
See how HTTP responses and retry timeouts drive transitions in the synchronous version. section 10.2.5
For an orchestration-based saga, use the model to make participant calls, outcomes, and recovery paths explicit. An orchestration framework such as Eventuate Platform or Temporal is a likely implementation choice; understanding the underlying state machine still helps when evaluating how it works. section 10.2.2 section 10.2.5












