Functions.Templates/Templates/DurableFunctionsHttpStart-CSharp/run.csx (15 lines of code) (raw):
#r "Microsoft.Azure.WebJobs.Extensions.DurableTask"
#r "Newtonsoft.Json"
using System.Net;
using Microsoft.Azure.WebJobs.Extensions.DurableTask;
public static async Task<HttpResponseMessage> Run(
HttpRequestMessage req,
IDurableOrchestrationClient starter,
string functionName,
ILogger log)
{
// Function input comes from the request content.
dynamic eventData = await req.Content.ReadAsAsync<object>();
// Pass the function name as part of the route
string instanceId = await starter.StartNewAsync(functionName, eventData);
log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
return starter.CreateCheckStatusResponse(req, instanceId);
}