Example #1
0
        public static void Run([QueueTrigger("process")] ProcessRequest item, TraceWriter log)
        {
            log.Info($"C# Queue trigger function processed: {item.data}");
            Thread.Sleep(TimeSpan.FromMinutes(3));
            ProcessResponse result = new ProcessResponse {
                data = "some result data"
            };

            client.PostAsJsonAsync <ProcessResponse>(item.callbackUrl, result);
        }
Example #2
0
        public static IActionResult Run(
            [HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequest req,
            TraceWriter log,
            [Queue("process")] out ProcessRequest process)
        {
            log.Info("Webhook request from Logic Apps received.");

            string  requestBody = new StreamReader(req.Body).ReadToEnd();
            dynamic data        = JsonConvert.DeserializeObject(requestBody);
            string  callbackUrl = data?.callbackUrl;

            //This will drop a message in a queue that QueueTrigger will pick up
            process = new ProcessRequest {
                callbackUrl = callbackUrl, data = "some data"
            };
            return(new AcceptedResult());
        }