Do Azure Functions triggered by storage queue take single message or all messages?

☆樱花仙子☆ 提交于 2019-12-06 03:04:30

API-wise your function will be called once per each individual message in the queue.

But Azure Functions runtime will retrieve and process messages in batches, calling several instances of your function in parallel.

Fei Han

First, as Mikhail said, Azure Functions runtime retrieve and process queue messages in batches. And the default batchSize is 16 and the maximum batchSize is 32

Besides, we can do configuration for 'queue' triggers and specify/modify batchSize in host.json file.

Configuration settings for 'queue' triggers

"queues": {
  "maxPollingInterval": 2000,
  "visibilityTimeout" : "00:00:10",
  "batchSize": 16,
  "maxDequeueCount": 5,
  "newBatchThreshold": 8
}

It doesn't handle all the messages in one go but it supports message batching. In order to enable batching you need to make the function's input an array of the type rather than the type itself. (e.g. EventData[] rather than EventData) then the batching applies. You can set the batch size up to 32 as @Fei mentioned. Checkout the following link talks about it briefly:

https://docs.microsoft.com/en-us/azure/azure-functions/functions-best-practices

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!