Skip to content

Instantly share code, notes, and snippets.

@paulbatum
Created March 14, 2018 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulbatum/761f5ad72e896360533926ccffa2c918 to your computer and use it in GitHub Desktop.
Save paulbatum/761f5ad72e896360533926ccffa2c918 to your computer and use it in GitHub Desktop.
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