0

I am using Azure Function V1 c#. I have a time triggered azure function which is checking for some data in my database every second. If the data is found I want to perform some operation on it. This operation can take 30 seconds to 5 minutes depending on the operations happening on it.

  1. When I my time triggered function gets data and starts performing operation on it. Time triggered function is not getting executed again until first operation is completed. So, even if time triggered function is scheduled to be executed every second, it is not getting executed for next 30 seconds if the operation in previous iteration took 30 seconds. How can I solve it?

  2. Can I call some other azure function from current time triggered function that can take care of that 30 sec. running operation and my time triggered function runs smoothly every second?

  3. How can I call another azure function (Custom Function) from current time triggered function?

Thanks,

Yash
  • 356
  • 1
  • 5
  • 22

1 Answers1

0

You may need to consider logic apps for this scenario. Logic Apps are serverless workflow offering from Azure. Use recurrence trigger to schedule the job (http call) and it will trigger the azure function regardless. https://learn.microsoft.com/en-us/azure/connectors/connectors-native-recurrence

If you want to trigger any external function you may use httpclient. Azure Functions call http post inside function

Imran Arshad
  • 3,794
  • 2
  • 22
  • 27
  • Thank you Imran. Thanks for support. So you means to call another function from my time triggered azure function, I have to create another one as HttpTriggered. Correct? – Yash Dec 25 '18 at 06:09
  • Yes Yash, and call the webhook of Function B from Function A. Make sure not to wait for response from Function B, else you would be stuck with the same issue. The other way of achieving it in the same function itself is to have a parallel thread running inside the function which does the long operation for you, but it's always better to divide responsibilities across functions. Thanks. – Abhirup Guha Dec 25 '18 at 09:28
  • Hi Yash. Not sure why would you need time triggered function now. simply create Http triggered function and move your Db operation logic from Time triggered function to http triggered. You need to schedule this http triggered function into logic apps to run every sec . the logic app will not wait for http triggered function response and will kick off new http triggered function in parallel regardless. – Imran Arshad Dec 25 '18 at 16:57
  • 1
    You can also follow Durable Azure function pattern to achieve your requirement. Here is brief document provided by microsoft for durable azure function. https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-overview – Harish Apr 03 '19 at 14:38