Search code examples
azureazure-functionsazure-servicebus-queues

Force Azure Function using Service Bus Queues to only process one mesage at a time


I have followed the instructions in the link here to try to get an Azure function to process messages in a queue 1 by 1

I am using Azure Service Bus Queues

I deliberately added a delay into the function to slow it down, but I can see that a queue of 250 messages is processed very quickly, despite me adding a delay of a second into the function

Has anyone had issues with trying to do this?

I have this in my host.json

 "queues": {
      "batchSize": 1,
      "newBatchThreshold": 0,
      "maxPollingInterval": "00:00:30",
      "visibilityTimeout": "00:01:00",
      "maxDequeueCount": 3
    }

Paul


Solution

  • The link you're referring to is about Azure Storage Queues. For Azure Service Bus, there are several configuration settings you should check, such as maxConcurrentCalls (16 by default) and maxConcurrentSessions if you're using sessions. More information in the official documentation here.