By default the Azure service bus queue binding function will have a retry count of 10, is there anyway to custom this value in either host.json or local.settings.json file? I've read about the microsoft document, which introduce four variables (prefetchCount, autoComplete, maxConcurrentCalls, maxAutoRenewDuration) but none of them looks like what I need, in addition, are those all the settings we could configure for service bus binding functions? Could we have something like max-retry, retry-interval, scale count?
-
If you want it you could set it in the code. There is a sample about it, yo could refer to here.https://github.com/jeffhollan/functions-csharp-queue-exponential/blob/master/ExponentialRetry.cs – George Chen Sep 24 '19 at 02:07
1 Answers
Maximum Delivery Count is a property of the queue itself.
You can imagine the problems that might occur if this could be overridden in software. Assume that process A is monitoring a Service Bus Queue and sets its max delivery count to 5, while process B is also monitoring the same queue, but sets its max delivery count to 10. If this were the case, Process A would force a deadletter of an undeliverable message after 5 attempts, but Process B would be expecting to get ten attempts. So the only way to change max delivery count is to set the property on the Service Bus Queue itself.
You can sidestep this by dequeuing a message completely, then re-enqueuing within a catch block instead of relying on the queue's internal retry logic. Then you can do whatever you want.

- 7,313
- 3
- 20
- 49
-
Thank you for the suggestion! Actually this is what I am doing right now by re-queue the message back to the queue, behind the scene this would trigger a new instance of function instead of the current one doing the retry, and this is something we'd like to get rid of by just letting the existed function instance retry in its life-cycle in customized retry count.When you mentioned **the only way to change max delivery count is to set the property on the Service Bus Queue itself**, how could we do that through C#? Could you please explain a little more detailed on that, thank you! – Drex Sep 23 '19 at 18:43
-
1Does it mean that the maximum delivery for service bus queue binding function is actually not something related to the function, but relates to the service bus queue? Meaning if I set the max delivery of my service bus queue to be 5, then either I have an azure function or a console app which deals with the subscription of the service bus queue, both would have 5 max retries. – Drex Sep 24 '19 at 00:33
-
@KevDing you are correct. It is a property of the Service Bus Queue itself. – Rob Reagan Sep 24 '19 at 00:37