Which Durable function works to call multiple functions that originally used Http Trigger function

Anonymous
2022-01-04T20:26:46.813+00:00

I am trying to use a Durable Function to call multiple Functions which calls Http Trigger with separate paging (due to API).
For example: 1st function would indicate paging (with row of 1- 8000 data).
2nd function would indicate paging (with row of 8001-16000 data) etc.

Which durable function should I use?
I am indicating URL on the bottom for reference:
https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-overview?tabs=csharp

I am wondering whether I should use Function chaining (Pattern #1) or Async HTTP APIs (Pattern #3) or something else.
When I tried Function chaining, I am not sure how to get the output in JSON and pass to HttpRequestMessage in the req.

Bottom is code of "HttpStart":

   {  
       [FunctionName("Function1_HttpStart")]  
            public static async Task<HttpResponseMessage> HttpStart(  
                [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequestMessage req,  
                [DurableClient] IDurableOrchestrationClient starter,  
                ILogger log)  

    {  
        // Function input comes from the request content.  
        string instanceId = await starter.StartNewAsync("Function1", null);  
        log.LogInformation($"Started orchestration with ID = '{instanceId}'.");  
        return starter.CreateCheckStatusResponse(req, instanceId);  
    }  
    }  

Should I use URL from HttpStart (statusQueryGetUri), and pull data from there?

Bottom is URL and image from there (regards to: statusQueryGetUri):
https://www.c-sharpcorner.com/article/durable-functions-patterns-async-http-apis/
162363-image.png

BTW, based on this URL, it mentioned about using Async HTTP APIs, but it gives an illustration of using Chaining function, so I am confused.

Thanks.
Justin

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,353 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Pramod Valavala 20,591 Reputation points Microsoft Employee
    2022-01-06T09:19:44.983+00:00

    @KingJava Assuming the API handles concurrent requests, you would want to implement the fan-out/fan-in pattern and given the asynchronous nature of the HTTP Starter Function, yes, you would have to use the statusQueryGetUri to get the result through polling.

    One alternative you could try is to use the WaitForCompletionOrCreateCheckStatusResponseAsync method instead of the CreateCheckStatusResponse, which makes the starter function to wait the configured timeout and return a response if the orchestration is complete before that, otherwise returning the regular 202.

    Also, since your activity is just to make an HTTP request, you could consider using the Durable HTTP APIs which allows you to save on some code to maintain.