You are developing a data synchronization solution using Azure Durable Functions. The solution must implement the Monitor pattern to periodically poll the status of an external import process until it finishes.
Arrange the steps in the correct chronological order of execution for a single complete loop of the monitoring workflow, starting from the client request.
- 1The HTTP-triggered client function starts a new orchestrator instance and returns an HTTP 202 response with status query endpoints.
- 2The orchestrator function calls the status-checking activity function for the first time.
- 3The orchestrator function creates a durable timer to schedule a wake-up after determining that the import is still running.
- 4The Durable Functions runtime wakes up the orchestrator function and replays execution history to restore the orchestrator's state.
- 5The orchestrator function calls the status-checking activity function a second time, receives a completion status, and terminates.
Answer
The correct sequence of events starts with the HTTP client initiating the orchestration ('client_start'), followed by the orchestrator querying the initial status via an activity ('first_poll'). Since the status is incomplete, the orchestrator sets a durable timer ('timer_scheduled'). Upon timer expiration, the runtime replays the history to restore the orchestrator state ('history_replay'). Finally, the orchestrator resumes, performs the final poll, and completes the workflow ('final_poll').
The correct sequence mirrors the stateful replay architecture of Durable Functions implementing the Monitor pattern. The client initiates the process, creating the instance. The orchestrator calls the activity function for the first status. If incomplete, it creates a durable timer and shuts down. When the timer fires, the runtime restarts the orchestrator, replaying history to reach the current state. Finally, the orchestrator executes the next step, calls the activity again, finds the task complete, and terminates.
Step-by-Step Solution
Key Concept
Monitor Pattern in Azure Durable Functions