You are implementing an Azure Durable Functions workflow in C# to handle a human approval process with a -hour escalation timeout. Order the steps in the sequence they occur during a successful execution where a manager approves the request within the -hour window.
- 1The orchestrator function calls a notification activity function, creates a durable timer task using CreateTimer, and creates an event listener task using WaitForExternalEvent.
- 2The orchestrator function awaits Task.WhenAny on the timer task and the event listener task, which yields execution and saves the current orchestration state to Azure Storage.
- 3An external client function receives the user's action and calls RaiseEventAsync on the durable orchestration client to deliver the event payload to the orchestrator.
- 4The orchestrator function is awakened, replays its execution history to rebuild state, evaluates that the external event task has completed, and cancels the active timer task.
- 5The orchestrator function calls a final activity function to process the approval outcome and completes the orchestration.
Answer
The correct sequence of events is: the orchestrator sets up the timer and event listener tasks, yields execution using Task.WhenAny to persist state, receives the external event raised by the client function, wakes up to replay history and cancel the timer, and finally executes the activity to process the decision.
The correct sequence begins with the orchestrator defining the approval notification and wait tasks. Next, it yields control by awaiting Task.WhenAny, which saves state. A client function then raises the event using the orchestration client. The orchestrator wakes up, replays state to recognize the event completion, cancels the timer, and finally executes the final approval activity.
Step-by-Step Solution
Key Concept
Orchestrating human interaction patterns and managing state lifecycle in Azure Durable Functions
Estimated Time:1m 30s