0
votes

We have a subscription to Event Grid with an endpoint type as Storage Queue (say xyz-queue). We also have an Azure Function which is a Queue (xyz-queue) trigger. Every message in xyz-queue storage Queue is EventGridEvent object. I have Azure Function trigger something like below:

public static void Run([QueueTrigger(xyz-queue, Connection = "connnection")] EventGridEvent ege)

Since, there will be 1000's of messages with same POCO object (in this case EventGridEvent), is there a way where we can read multiple messages, process them together and also ensure we are not reading more than 5 messages so that function do not take long time to process.

1

1 Answers

1
votes

The number of queue messages that the Functions runtime retrieves simultaneously and processes in parallel. When the number being processed gets down to the newBatchThreshold, the runtime gets another batch and starts processing those messages. So the maximum number of concurrent messages being processed per function is batchSize plus newBatchThreshold. This limit applies separately to each queue-triggered function.

{
    "version": "2.0",
    "extensions": {
        "queues": {
            "maxPollingInterval": "00:00:02",
            "visibilityTimeout" : "00:00:30",
            "batchSize": 5,
            "maxDequeueCount": 5,
            "newBatchThreshold": 2
        }
    }
}

For more details, you could refer to this article.

Also, if you want to output queue message multiple with poco, you could use ICollector and IAsyncCollector.