【问题标题】:Triggering an Azure Function that takes more than 2 minutes to run from logic appsTriggering an Azure Function that takes more than 2 minutes to run from logic apps
【发布时间】:2022-12-01 14:14:38
【问题描述】:

I am trying to trigger an Azure Function from Logic Apps. Running the Azure function takes more than 2 minutes as it is reading a file from a location, converts it to another format and then writes it to a different location. The problem is that the Logic Apps is creating a request, waits for 2 minutes to get a response, but this response doesn't come because the function is not finishing that fast. So the logic app assumes there is an error and recreates the request.

I read in the documentation that there is no way to increase the timeout period. I tried creating two threads in the azure function. One returns 202 http status code to the logic app, and the other one would remain as a daemon and keeps running. But the file doesn't seem to be copied.

Does anyone have any idea how could this be achieved?

【问题讨论】:

  • Do you need the response for anything? Since you tried with 202, I guess you don't really care about the result "right now", and thus, could just queue the actual work in a different trigger, e.g. with a queue and have a QueueTrigger doing the actual conversion work.

标签: python azure-functions azure-logic-apps


【解决方案1】:

Continue the work on another logic app.

Just change your logic app to return Accepted/OK response and calls the function. The function does the work and after it finishes (or fails) it calls another logic app where it continues the work (or deal with the error).

【讨论】:

    【解决方案2】:

    I agree with @Mocas, and also you can make your logic apps response to asynchronous behavior as below:

    So, this waits for the response to be 202 status and then this steps completes.

    Reference:

    Running the Azure function takes more than 2 minutes as it is reading a file from a location, converts it to another format and then writes it to a different location.

    Or you can Create event grid as When an event occurs as below:

    So, when you complete the process of converting then send it to a storage account and this event fires when blob gets created and after this you can do your rest of work.

    【讨论】:

      猜你喜欢
      • 2022-12-01
      • 2022-12-02
      • 2022-04-20
      • 1970-01-01
      • 2016-03-03
      • 1970-01-01
      • 2022-01-22
      • 2017-01-08
      • 1970-01-01
      相关资源
      最近更新 更多