Search code examples
azureazure-queuesazure-triggers

process azure queue based on timer and on queue length


I want to run a function when my azure queue reaches x length or has not been looked at for y minutes. ie: I have a queue myQueue, which a webhook is adding messages to. I want to process the queue if it reaches X messages in length or if it hasn't been processed for Y minutes (this is incase there are less than X messages sat in queue). Am I missing something obvious? I can see queue triggers, but that is for every message that enters queue (I think?) or timer triggers that will do my time part but not a mix. Any ideas?


Solution

  • The Queue Trigger is to trigger a function whenever a message arrives into a queue. There's no 'batch' queue trigger, so you either work with a time trigger that runs every x seconds and check for the queue length and start processing, or you live with the original queue trigger.