You are developing a serverless order processing workflow using Azure Durable Functions. The workflow is initiated via an HTTP request, performs a payment processing activity, and then runs a receipt generation activity.
Arrange the execution and execution replay events of the Durable Functions runtime in the correct sequential order from the arrival of the initial client request to the execution of the second activity.
- 1The client function is triggered by an HTTP request, calls the Durable Client binding to start the orchestration, and returns an HTTP 202 response containing status check endpoints.
- 2The orchestrator function begins execution, writes a start event to the history table, and schedules the first activity function (payment processing) using an awaited call.
- 3The orchestrator function yields execution (enters a suspended state) to save resources, while the runtime assigns the payment processing activity to an execution worker.
- 4The payment processing activity completes, its output is logged in the Azure Storage history table, and a message is queued to resume the orchestrator.
- 5The orchestrator function wakes up and replays from the beginning, pulling the payment processing result from history instead of re-running the activity, then schedules the receipt generation activity.
Answer
The correct sequence begins with the client function initiating the orchestrator and returning a response, followed by the orchestrator starting and scheduling the first activity. The orchestrator then yields execution while the activity runs. After the activity completes and logs its output to history, the orchestrator wakes up, replays from the beginning, retrieves the activity output from history, and schedules the second activity.
The correct sequence mirrors the fundamental event-sourcing and execution replay design of Durable Functions. The workflow is started by a client function returning status endpoints. Then, the orchestrator begins, schedules the first activity, and yields. When the activity finishes, its outcome is recorded in Azure Storage, triggering the orchestrator to wake up, replay from the beginning using history, and proceed to the next activity.
Step-by-Step Solution
Key Concept
Replay mechanism and event sourcing in Azure Durable Functions