You are implementing a simple Durable Functions chaining workflow in C# to process a customer order. The workflow consists of an HTTP-triggered client function, an orchestrator function, and two activity functions: `ValidateOrder` and `ProcessPayment`.
Arrange the steps in the correct order of execution, starting from when a client submits an order.
- 1The client function receives the HTTP request and starts a new instance of the orchestrator function.
- 2The orchestrator function begins execution and calls the ValidateOrder activity function.
- 3The orchestrator function awaits the activity and goes to sleep while ValidateOrder runs.
- 4The orchestrator function wakes up, receives the output of ValidateOrder, and calls the ProcessPayment activity function.
Answer
The correct sequence begins with the client function receiving the HTTP request and starting the orchestrator. Next, the orchestrator begins execution and calls the ValidateOrder activity. The orchestrator then awaits the activity and goes to sleep while ValidateOrder runs. Finally, the orchestrator wakes up, receives the output, and calls the ProcessPayment activity.
In a Durable Functions workflow, execution begins with the client function starting the orchestrator. The orchestrator runs until it reaches an await statement for an activity, at which point it schedules the activity and goes to sleep. Once the activity completes, the orchestrator is woken up (replayed) to retrieve the result and proceed to the next step in the chain.
Step-by-Step Solution
Key Concept
Durable Functions Chaining Execution Lifecycle