public async Task Run([QueueTrigger("queue-name", Connection = "AzureWebJobsStorage")] Message message, ILogger log) { log.LogInformation($"C# Queue trigger function processed: {message}"); var table = await _cloudStorageProvider.GetCloudTable().ConfigureAwait(false); await table.ExecuteAsync(TableOperation.InsertOrMerge( new Result(message.RequestId, message.Request.A + message.Request.B))); }
public async Task <IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "get", Route = "result/{requestId}")] HttpRequest httpRequest, string requestId, ILogger logger) { logger.LogInformation("C# HTTP trigger function processed a request."); var table = await _cloudStorageProvider.GetCloudTable().ConfigureAwait(false); var getOperation = TableOperation.Retrieve <Result>("default", requestId); var tableResult = await table.ExecuteAsync(getOperation); var result = (Result)tableResult.Result; if (result == null) { return(new NotFoundResult()); } return(new OkObjectResult(new { Sum = result.Sum })); }