Forum Discussion
How to start Azure queue processing by multiple WebJob instances when time constant expired or queue
Hello Andrei_R ,
To ensure safe processing of BatchQueue when you have multiple instances of your WebJob, you can use Azure Functions to schedule the processing. Here are the steps you can follow:
Create an Azure Function that is triggered by a timer. Set the interval of the timer to the value of the TimeInterval you mentioned.
In the Azure Function, check the length of the BatchQueue. If the length is greater than MaxLength, trigger the processing of the BatchQueue.
To ensure safe processing when you have multiple instances of your WebJob, you can use a distributed lock service like Azure Redis Cache. You can acquire a lock before processing the BatchQueue to ensure that only one instance of the WebJob is processing the BatchQueue at any given time.
After processing the BatchQueue, release the lock.
By using Azure Functions and a distributed lock service like Azure Redis Cache, you can ensure safe processing of the BatchQueue when you have multiple instances of your WebJob.
I hope this helps! Let me know if you have any further questions.
Kind regards,
Luke Madden