-
-
Save TsuyoshiUshio/365e5ce453d02a3f707635feeb513c8d to your computer and use it in GitHub Desktop.
Durable Function sample for Azure Portal
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
{ | |
"bindings": [ | |
{ | |
"name": "helloContext", | |
"type": "activityTrigger", | |
"direction": "in" | |
} | |
], | |
"disabled": false | |
} |
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
{ | |
"bindings": [ | |
{ | |
"name": "context", | |
"type": "orchestrationTrigger", | |
"direction": "in" | |
} | |
], | |
"disabled": false | |
} |
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
{ | |
"bindings": [ | |
{ | |
"authLevel": "anonymous", | |
"name": "req", | |
"type": "httpTrigger", | |
"direction": "in", | |
"route": "orchestrators/{functionName}", | |
"methods": [ | |
"post" | |
] | |
}, | |
{ | |
"name": "$return", | |
"type": "http", | |
"direction": "out" | |
}, | |
{ | |
"name": "starter", | |
"type": "orchestrationClient", | |
"direction": "in" | |
} | |
], | |
"disabled": false | |
} |
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" | |
public static string Run(DurableActivityContext helloContext) | |
{ | |
string name = helloContext.GetInput<string>(); | |
return $"Hello {name}!"; | |
} |
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" | |
public static async Task<List<string>> Run(DurableOrchestrationContext context) | |
{ | |
var outputs = new List<string>(); | |
outputs.Add(await context.CallFunctionAsync<string>("E1_SayHello", "Tokyo")); | |
outputs.Add(await context.CallFunctionAsync<string>("E1_SayHello", "Seattle")); | |
outputs.Add(await context.CallFunctionAsync<string>("E1_SayHello", "London")); | |
// returns ["Hello Tokyo!", "Hello Seattle!", "Hello London!"] | |
return outputs; | |
} |
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; | |
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}'."); | |
return starter.CreateCheckStatusResponse(req, instanceId); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Durable Functions / Samples . I write a code for Azure Portal.