A package delivery dispatch system is implemented using Azure Durable Functions. The workflow assigns a driver, waits up to 30 minutes for the driver to accept the assignment via an external event, and dispatches the delivery if accepted. The driver accepts the assignment 10 minutes after it is assigned.
How does the Durable Task Framework execute and replay the orchestrator function to complete this workflow? Order the execution and replay events chronologically from the initial start of the orchestrator to its completion.
- 1The orchestrator starts, executes the AssignDriver activity, finds no history for it, schedules the activity, and yields control.
- 2The orchestrator restarts, replays AssignDriver from history, schedules the DriverResponse external event and the 30-minute timer, and yields control.
- 3The orchestrator restarts, replays history, processes the received DriverResponse event, cancels the timer, schedules the DispatchDelivery activity, and yields control.
- 4The orchestrator restarts, replays all historical events, reads the completed DispatchDelivery result from history, and finishes execution.
Answer
The correct chronological order of execution and replay events is: first, the orchestrator starts and schedules the AssignDriver activity; second, it restarts, replays, and schedules both the external event and the timer; third, it restarts upon receiving the external event, cancels the timer, and schedules DispatchDelivery; finally, it restarts, replays all events, and completes execution.
The correct sequence mirrors the stateful replay model of Azure Durable Functions. The orchestrator never blocks; instead, it executes sequentially until it encounters an await, at which point it schedules the activity or event, yields, and shuts down. When the scheduled task completes, the orchestrator is awakened, replays the execution history to rebuild the local state, and continues to the next step.
Step-by-Step Solution
Key Concept
Durable Functions execution lifecycle, determinism, and event/timer orchestration