0
votes

I have the azure function running locally but whenever I sent messages to the queue, the function never execute the item in the queue. Only get trigger when I re-run the function. I have set the batchSize in host.json to execute the message one at a time. Is it because the BatchSize causing it that way.

1
Not because of batch size. Show us your code and where you set connection / queue name.Mikhail Shilkov

1 Answers

0
votes

Most likely it's not the Batchsize, make sure to set the NewBatchThreshold:

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.

If you want to avoid parallel execution for messages received on one queue, you can set batchSize to 1. However, this setting eliminates concurrency only so long as your function app runs on a single virtual machine (VM). If the function app scales out to multiple VMs, each VM could run one instance of each queue-triggered function.

Example:

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

} I'd recommend checking the following documentation: https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue