I have a set of APIs developed using Azure Functions (stateless), the backend for this API is Microsoft graph. The number of APIs called per day is ~2000, at peak we have observed 5 requests per second. The control flow is as below,
Gateway (On premises) -> Azure Function (Stateless) -> Graph API call via. SDK with retries
Once in a while the Graph APIs throttle the requests (Gateway timeout, too many retries); the use of Graph SDK with automatic retries does not seem to help from reliability perspective. To ensure reliability i have considered below possible solutions,
- Azure Durable functions: Durable function allows for storing state and supports retry. The incoming api payload will be passed as parameter to Orchestrator function, thus storing its state. The CallActivityWithRetryAsync can be used to retry perhaps with longer interval (exponential backoff).
- Use Azure storage queues: Change the implementation to Gateway (On premises) -> Azure Function -> Storage Queue -> Queue triggered Function -> Graph API.
I am preferring use of Durable function, as state management and retry comes out of the box. However, i have not seen from my readings Durable functions being used in the above defined context. All solutions that i have read is to use Queues, Queue triggered functions for integration use cases.
It would helpful if someone who has experience with this kind of integration to suggest on the recommended solution.