Skip to content

Instantly share code, notes, and snippets.

@gled4er
gled4er / Sub-Orchestrator
Created November 28, 2017 05:52
Sub-Orchestrator
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
namespace DurableFunc
{
public static class HelloWorld
{
[FunctionName("HelloWorld")]
@gled4er
gled4er / local.settings.json
Created November 28, 2017 05:21
local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"AzureWebJobsDashboard": "UseDevelopmentStorage=true",
"WeatherApiKey": {Weather-API-Key},
"OrchestrationClientUri": "http://localhost:7071/api/orchestrators/",
"MaxExecutionTime": "3000",
"ExecutionPeriod": "100"
}
@gled4er
gled4er / Sync Response Orchestration Client
Created November 28, 2017 05:11
Sync Response Orchestration Client
[FunctionName("SyncResponseClient")]
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Function, methods: "post", Route = "orchestrator/{functionName}")] HttpRequestMessage req,
[OrchestrationClient] 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);
@gled4er
gled4er / Sync Response Service
Created November 28, 2017 05:03
Sync Response Service
public async Task<object> ProvideOutput(OrchestrationClientResponse clientResponse, ExecutionDetails executionDetails, TraceWriter log)
{
object result = null;
using (var httpClient = new HttpClient())
{
for (var i = 0; i < executionDetails.Iterations; i++)
{
Thread.Sleep(executionDetails.IterationPeriod);
string statusCheck;
@gled4er
gled4er / gist:e7d6c06c7fdd0a1940fed1750838538f
Created November 28, 2017 04:55
Sync Response Function
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using System.Configuration;
using DurableFunc.Model;
using DurableFunc.Services;
using DurableFunc.Utils;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;