We have a requirement to create a timer per request.
It will be based on Azure PaaS.
Basically, we have a function that receives requests, each request contains an unique identifier and its status of our systems.
Say we have system process statuses A - B - C and D.
And it takes 2 minutes for a request to move from A - D.
We want to ensure a request is not stuck in between A - D.
When the status A of the request is received in the function app, we need to create a timer with 3 mins, if D status doesn't come to the function app for the same unique identifier within 3 mins, the timer will get fired and then send an alert to someone.
Now if D status arrives within 3 minutes, we just kill the timer.
We will get around 50,000 distinctive requests per day. So we need to create timers and kill timers or timers get triggered a bit.
How best achieve this in Azure?
The first option we think is function app timer.
The second option we think is EventGrid timeout (dead-letter). But an issue for this option seems not being able to kill messages within EventGrid, unless when EventGrid sends messages to dead-letter queue, we intercept and ignore.
Anyone has any ideas please?
Concurrency and scalability are important aspects for this requirement too.
Thank you in advance,
I think you might want to look into durable functions https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-overview?tabs=in-process%2Cnodejs-v3%2Cv1-model&pivots=csharp
You either chain your Functions or just wait for the event (status feedback) and if this not arrives, go into a timeout. Can look like this:
context.WaitForExternalEvent<bool>("FuncAProcessCompleted", timespan.FromMinutes(3));
https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-external-events?tabs=csharp
If you don't want to adapt durable, have a look at scheduled messages https://learn.microsoft.com/en-us/azure/service-bus-messaging/message-sequencing#scheduled-messages
Basically you could schedule a message and then cancle it, when the status arrives. If it not arrives, the message will be activated and you can react on it with another function.