Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.