0
votes

By default when a processing a message in an Azure Function v2, the function will be retried 10 times on error.

I actually want to reduce this but I can't find how to do it?

public static async Task Run([ServiceBusTrigger("%EventsTopicName%", "%EventsSubscriptionName%", Connection = "GetEventsConnectionString")]Message mySbMsg, ILogger log)
{
    // Code to process a message
}
1
It seems to be controlled by the QueueDescription.MaxDeliveryCount property and has a default value of 10, you could set it. - Joy Wang-MSFT

1 Answers

1
votes

The solution for me was this, the ServiceBus is created using Azure ARM templates.

In order to reduce the number of retries, I was looking to do it in the code which was wrong. This is controlled in the ARM templates with the following property in the Topics config:

"maxDeliveryCount ": 2

When maxDeliveryCount is not set, by default the value is 10.