I have an azure function that takes in these parameters (source container, source filename, destination folder, and destination container) and unzips the source filename in the folder in the destination container. There are several actions in the Logic App workflow following the Azure Unzip action that are not completed because the Logic app would timeout after completing the unzipping due to the file size. So Azure function was revamped to be a durable function and I am trying to implement it into my Logic app via the polling action. According to this site, https://medium.com/@jeffhollan/calling-long-running-functions-from-logic-apps-6d7ba5044701, I can use the built-in Azure Functions action but I have no idea what the actual workflow should look like. I am looking for a step by step graphic demonstration on how to implement the durable function via the polling action pattern in my Logic App like depicted on this page, https://yourazurecoach.com/2018/08/19/perform-long-running-logic-apps-tasks-with-durable-functions/ (which shows how to implement it via the webhook action pattern). Any help would be greatly appreciated. Thanks in advance.
Asked
Active
Viewed 1,832 times
1 Answers
0
After you executing built-in Azure Functions in Logic APP, you will get 202 status code. Then you can handle your business in QueueTrigger.
You can have a look at this sample:
using System.IO;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.AspNetCore.Http;
using Microsoft.Azure.WebJobs.Host;
using Newtonsoft.Json;
using System.Threading;
using System.Net.Http;
using System;
namespace HttpToQueueWebhook
{
public static class HttpTrigger
{
[FunctionName("HttpTrigger")]
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();
}
public static HttpClient client = new HttpClient();
/// <summary>
/// Queue trigger function to pick up item and do long work. Will then invoke
/// the callback URL to have logic app continue
/// </summary>
[FunctionName("QueueTrigger")]
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" };
//handle your business here.
client.PostAsJsonAsync<ProcessResponse>(item.callbackUrl, result);
}
}
public class ProcessRequest
{
public string callbackUrl { get; set; }
public string data { get; set; }
}
public class ProcessResponse
{
public string data { get; set; }
}
}
More details, you can refer to this answer logic apps web hook to chalkboard API timeout error.

Steve Johnson
- 8,057
- 1
- 6
- 17