Soru

Zorluk: KolayImplement Durable Functions

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.

  1. 1The client function receives the HTTP request and starts a new instance of the orchestrator function.
  2. 2The orchestrator function begins execution and calls the ValidateOrder activity function.
  3. 3The orchestrator function awaits the activity and goes to sleep while ValidateOrder runs.
  4. 4The orchestrator function wakes up, receives the output of ValidateOrder, and calls the ProcessPayment activity function.

Cevap

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.

Adım Adım Çözüm

1
Trigger the workflow through the client function.
An orchestrator instance is created.
Client functions act as entry points to start orchestrations.
2
Begin orchestrator execution and invoke the first activity.
The ValidateOrder activity is scheduled.
The orchestrator controls the workflow and schedules activities sequentially.
3
Await the scheduled activity.
The orchestrator goes to sleep.
Orchestrators are suspended during active tasks to avoid unnecessary resource consumption.
4
Replay the orchestrator upon activity completion.
The next activity is called.
Azure Durable Functions replay orchestrator functions to resume execution state from history.

Anahtar Kavram

Durable Functions Chaining Execution Lifecycle
Bu soruyu puanla