What is the recommended way to limit an Azure Service bus trigger concurrent message processing when the Azure function is set to an App Service plan?
I know one can do it using "Max Concurrent Calls" when using consumption plan.

1

There are 1 best solutions below

2
Eric Qvarnström On

To manage the concurrency of service bus triggered applications such as Function Apps and Logic Apps, you can use the host.json to set such values.

Attached below is a an example of settings that can be set:

{
    "version": "2.0",
    "extensions": {
        "serviceBus": {
            "prefetchCount": 100,
            "messageHandlerOptions": {
                "autoComplete": true,
                "maxConcurrentCalls": 32,
                "maxAutoRenewDuration": "00:05:00"
            },
            "sessionHandlerOptions": {
                "autoComplete": false,
                "messageWaitTimeout": "00:00:30",
                "maxAutoRenewDuration": "00:55:00",
                "maxConcurrentSessions": 16
            },
            "batchOptions": {
                "maxMessageCount": 1000,
                "operationTimeout": "00:01:00",
                "autoComplete": true
            }
        }
    }
} 

You can read more about it here (learn.microsoft.com).