Durable Functions: HttpTrigger function which is used to start an orchestration function.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Net.Http; | |
using System.Threading.Tasks; | |
using Microsoft.Azure.WebJobs; | |
using Microsoft.Azure.WebJobs.Extensions.Http; | |
using Microsoft.Azure.WebJobs.Host; | |
namespace DurableFunctionsDemo | |
{ | |
public static class HttpStart | |
{ | |
[FunctionName("HttpStart")] | |
public static async Task<HttpResponseMessage> Run( | |
[HttpTrigger(AuthorizationLevel.Function, "post", Route = "orchestration/{functionName}")]HttpRequestMessage req, | |
[OrchestrationClient]DurableOrchestrationClient orchestrationClient, | |
string functionName, | |
TraceWriter log) | |
{ | |
log.Info("HttpStart triggered."); | |
dynamic eventData = await req.Content.ReadAsAsync<object>(); | |
string instanceId = await orchestrationClient.StartNewAsync(functionName, eventData); | |
log.Info($"Started orchestration with ID = '{instanceId}'."); | |
return orchestrationClient.CreateCheckStatusResponse(req, instanceId); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment