public static async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req, ILogger log, [Queue("greeting-creation-requests")] IAsyncCollector <CreateGreetingRequest> outputQueue) { string jsonContent = await req.ReadAsStringAsync(); CreateGreetingRequest data = JsonConvert.DeserializeObject <CreateGreetingRequest>(jsonContent); await outputQueue.AddAsync(data); log.LogInformation($"Added {data} to queue"); return(new OkResult()); }
public static string Run([QueueTrigger("greeting-creation-requests")] CreateGreetingRequest input, ILogger log, DateTimeOffset insertionTime, string id) { log.LogInformation($"C# Queue trigger function processed: {input}"); log.LogInformation($"Insertion time: {insertionTime}"); log.LogInformation($"Id: {id}"); var greetingRequest = new GreetingRequest { Number = input.Number, Message = $"Hi {input.FirstName}" }; return(JsonConvert.SerializeObject(greetingRequest)); }