You are designing a serverless document approval workflow using Azure Durable Functions in C# (.NET Isolated). The orchestrator must pause and wait for an external manager approval event named 'ApprovalReceived' for up to 72 hours. If the event is received, the workflow proceeds; if 72 hours elapse without the event, the workflow runs an escalation activity function.
Which two of the following code steps or architectural decisions must you implement to meet these requirements? (Select two.)
- Use context.CreateTimer to define the timeout and context.WaitForExternalEvent<bool>("ApprovalReceived") for the approval, then await them using Task.WhenAny.Answer
- Determine the expiration timestamp by adding the timeout duration to context.CurrentUtcDateTime rather than using DateTime.UtcNow.Answer
- CImplement Task.Delay(TimeSpan.FromHours(72)) within the orchestrator function to pause execution deterministically.
- DDeploy the Function App to an App Service Dedicated plan because the Consumption plan has a 10-minute maximum execution limit that prevents workflows from lasting 72 hours.
Answer
To implement the human interaction pattern with a timeout, you must use context.CreateTimer alongside context.WaitForExternalEvent and await them via Task.WhenAny. Additionally, to maintain determinism within the orchestrator, you must use context.CurrentUtcDateTime instead of DateTime.UtcNow for date-time calculations.
The correct actions are using context.CreateTimer and context.WaitForExternalEvent with Task.WhenAny to wait for whichever happens first, and using context.CurrentUtcDateTime to ensure deterministic execution. Combining the two tasks allows the orchestrator to resume when either the manager approves or the 72-hour limit is reached. Using the orchestrator's built-in date-time property ensures the replay engine gets the same timestamp on every execution.
Step-by-Step Solution
Key Concept
Durable Functions Orchestration Constraints and Human Interaction Pattern