Created
May 12, 2018 14:28
-
-
Save kennetham/f498b24ccfea8e57c7c526df921151f3 to your computer and use it in GitHub Desktop.
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
#r "Microsoft.Azure.WebJobs.Extensions.DurableTask" | |
#r "Newtonsoft.Json" | |
using System.Net; | |
using System.Net.Http.Headers; | |
public static async Task<HttpResponseMessage> Run( | |
HttpRequestMessage req, | |
DurableOrchestrationClient starter, | |
string functionName, | |
TraceWriter log) | |
{ | |
// Function input comes from the request content. | |
dynamic eventData = await req.Content.ReadAsAsync<object>(); | |
string instanceId = await starter.StartNewAsync(functionName, eventData); | |
log.Info($"Started orchestration with ID = '{instanceId}'."); | |
var res = starter.CreateCheckStatusResponse(req, instanceId); | |
res.Headers.RetryAfter = new RetryConditionHeaderValue(TimeSpan.FromSeconds(10)); | |
return res; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment