Created
March 14, 2018 01:02
-
-
Save paulbatum/761f5ad72e896360533926ccffa2c918 to your computer and use it in GitHub Desktop.
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.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
using Microsoft.Azure.WebJobs; | |
using Microsoft.Azure.WebJobs.Extensions.Http; | |
using Microsoft.Azure.WebJobs.Host; | |
namespace FunctionApp14 | |
{ | |
public static class MyFunctions | |
{ | |
[FunctionName("Orchestrator")] | |
public static async Task<HttpResponseMessage> Orchestrator( | |
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]HttpRequestMessage req, | |
[Queue("queue1", Connection = "AzureWebJobsStorage")] IAsyncCollector<string> output1, | |
[Queue("queue2", Connection = "AzureWebJobsStorage")] IAsyncCollector<string> output2, | |
TraceWriter log) | |
{ | |
log.Info("Sleeping..."); | |
await Task.Delay(3000); | |
await output1.AddAsync("test1"); | |
await output2.AddAsync("test2"); | |
return req.CreateResponse(HttpStatusCode.OK); | |
} | |
[FunctionName("QueueFunction1")] | |
public static async Task Run1([QueueTrigger("queue1", Connection = "AzureWebJobsStorage")]string myQueueItem, TraceWriter log) | |
{ | |
await Task.Delay(5000); | |
log.Info($"C# Queue trigger function processed: {myQueueItem}"); | |
} | |
[FunctionName("QueueFunction2")] | |
public static async Task Run2([QueueTrigger("queue2", Connection = "AzureWebJobsStorage")]string myQueueItem, TraceWriter log) | |
{ | |
await Task.Delay(5000); | |
log.Info($"C# Queue trigger function processed: {myQueueItem}"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment