You are developing a serverless workflow using Azure Durable Functions. You need to sequence the execution and replay steps of a basic orchestration that starts, runs a single activity function, and completes. Move the events to the correct order in which they occur during this execution lifecycle.
- 1The client function calls StartNewAsync (or equivalent SDK start method) to initiate a new orchestrator instance.
- 2The orchestrator function executes until it reaches an await call to an activity function, scheduling that activity in the queue.
- 3The orchestrator function yields control, suspends execution, and checkpoints its progress to the storage provider.
- 4The scheduled activity function executes on an available worker and stores its completion result in the history provider.
- 5The orchestrator function is re-triggered, replays the history from the beginning to restore state, and continues past the completed activity.
Answer
The correct order of events is: client function initiates the orchestrator instance, the orchestrator executes and schedules the activity function, the orchestrator yields control and suspends execution, the activity function executes and stores its result, and the orchestrator replays history to restore state and continue.
The correct order follows the standard Durable Functions event sourcing replay pattern: the client initiates the orchestrator; the orchestrator executes, schedules the activity, and yields control; the activity executes on a worker; and finally, the orchestrator wakes up, replays history, and continues execution with the activity result.
Step-by-Step Solution
Key Concept
The execution replay lifecycle of Durable Functions ensures state persistence and scalability by suspending and reconstructing the orchestrator state from execution history.