0
votes

Trying out samples for Azure Logic App with Azure Web-API running for more than 2 minutes(as HTTP request timeouts within 120sec)
As azure functions have time limitation of 5 minutes to max 10 minutes, i have created the following Azure Web-API(for now just added delay)

    [HttpPost]
    [Route("api/Values/subscribe")]
    public async Task<HttpResponseMessage> SubscribeAsync([FromBody]SubscriptionData subscriptionData)
    {
        TimeSpan ts = TimeSpan.FromMinutes(3);
        await Task.Delay(ts);
        return Request.CreateResponse(HttpStatusCode.OK);
    }

    [HttpPost]
    [Route("api/Values/unsubscribe")]
    public HttpResponseMessage Unsubscribe([FromBody]SubscriptionData subscriptionData)
    {
        return Request.CreateResponse(HttpStatusCode.OK);
    }

have added the following HTTP web-hook action in my Logic App HttpWebhook but this to returns BadRequest. Http request failed: the timeout was reached.
also tried with the Web API synchronous but that to dint work.

1
You actually need to implement the webhook pattern in your Web API. This means you need to store the callback uri from the subscribe request so that you can use to invoke your logic app on demand. Logic App timeout to synchronous requests is 2 minutes, hence the subscribe request fails (i.e. the response to subscribe request must be produced within 2 minutes)Szymon Wylezol

1 Answers

0
votes

As mentioned by Szymon, you need to implement the Webhook Subscribe and Unsubscribe pattern of Logic Apps as shown in the picture below.

Webbhook Subscribe and Unsubscribe pattern of Logic Apps

The detailed explanation of this implementation can be found here: https://www.mexia.com.au/correlation-identifier-pattern-on-logic-apps/

HTH