You are developing a workflow to process monthly customer billing reports using Azure Durable Functions in a C# (.NET Isolated process) environment. You need to write an HTTP-triggered function that starts a new instance of the orchestrator function named BillingReportOrchestrator and returns a standard HTTP 202 response containing the status check URI. Which code segment should you use?
- [Function("StartBillingReport")]
public static async Task<HttpResponseData> Run(
[HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestData req,
[DurableClient] DurableTaskClient client)
{
string instanceId = await client.ScheduleNewOrchestratorInstanceAsync("BillingReportOrchestrator");
return client.CreateCheckStatusResponse(req, instanceId);
}Answer - B[Function("StartBillingReport")]
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestMessage req,
[DurableClient] IDurableOrchestrationClient client)
{
string instanceId = await client.StartNewAsync("BillingReportOrchestrator");
return client.CreateCheckStatusResponse(req, instanceId);
} - C[Function("StartBillingReport")]
public static async Task<HttpResponseData> Run(
[HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestData req,
[DurableClient] DurableTaskClient client)
{
string instanceId = await client.StartNewAsync("BillingReportOrchestrator");
return client.CreateCheckStatusResponse(req, instanceId);
} - D[Function("StartBillingReport")]
public static async Task<HttpResponseData> Run(
[HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestData req,
[OrchestrationClient] DurableTaskClient client)
{
string instanceId = await client.ScheduleNewOrchestratorInstanceAsync("BillingReportOrchestrator");
return client.CreateCheckStatusResponse(req, instanceId);
}
Answer
The correct code segment binds to a DurableTaskClient instance using the [DurableClient] attribute, schedules the execution using client.ScheduleNewOrchestratorInstanceAsync, and yields the status endpoints with client.CreateCheckStatusResponse using HttpResponseData.
In C# .NET Isolated process functions, the modern Durable Functions extension shifts to using DurableTaskClient to manage orchestrations. To schedule a workflow, the ScheduleNewOrchestratorInstanceAsync method is called. The HTTP payload handles input/output using HttpRequestData and HttpResponseData, and status URL payloads are generated via CreateCheckStatusResponse.
Step-by-Step Solution
Key Concept
Azure Durable Functions .NET Isolated Worker Client Bindings
Estimated Time:1m 30s