Azure functions: A way to trigger other Azurefunction in a http-trigger azure function?
I need a reliable way after getting a short notification in AzureFunction1 save it fast and then trigger another Azurefunction for analysing the data and doing other stuff dependig on the anysis.
I search for a way sending an request to azure function 2 let Azure function 2 start but will not block ending AzureFunction1. I though a PATCH HTTP-request should be used for something.
[FunctionName("HttpTriger1")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post",Route = null)] HttpRequest req,
ExecutionContext context,
ILogger log)
I extended the request from get, post to get, post, patch, but i don't know how I can anwser the request with 204 as Update Request for Graph APi do it.
I don't know if the is a good way, but time trigger are 2 complex and very difficult to handle reliable - i tried it.
So if there is another way for my problem, please make other proposals.
My requirements are:
- azFunc2 should started shortly after AzFunc1
- azFunc2 could runner seconds or more and in very rare worst-case more than 1 hour (worst case could be determined and exited an moving to midnight run or something ) so normal execution time will second till a minute
- azurefunction1 will be called near 2000 times / day
I hope someone can help me.
Thanks
Solution 1:
I search for a way sending an request to azure function 2 let Azure function 2 start but will not block ending AzureFunction1.
I would have F1 put a message on an Azure Storage Queue and have a queue triggered Azure Function F2 process those messages independently from F1.
Other reliable options could be using an Azure Service Bus or Azure Event Grid triggered F2.
azFunc2 could runner seconds or more and in very rare worst-case more than 1 hour (worst case could be determined and exited an moving to midnight run or something ) so normal execution time will second till a minute
Do mind that the maximum runtime is 10 minutes on a consumption plan! See these docs for your options.