Trying to use retryOptions for service bus trigger on Azure Functions

Occasional Contributor

I am just trying to follow this article in order to customize retrying behavior on the service bus trigger (which is I believe 10 attempts with a small interval in between).

It seems to be not working (It runs 10 times before service bus message goes to dead letter. It does not take into account appropriate settings from host.json file)

I have the latest 5.x Extension referenced by Nuget.


Here is my very basic example:



using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Logging;

namespace CH.AF.SampleBox
    public static class TestSbRetry
        //[FixedDelayRetry(5, "00:00:30")]
        public static void Run([ServiceBusTrigger("test2", Connection = "Sbus2")]string myQueueItem, ILogger log)
            log.LogInformation($"Attempt to run dunction at {DateTime.Now}");
            log.LogInformation($"C# ServiceBus queue trigger function processed message: {myQueueItem}");
            throw new ApplicationException("artificial exception to test retry");



And the host.json




  "version": "2.0",
  "extensions": {
    "serviceBus": {
      "serviceBusOptions": {
        "retryOptions": {
          "mode": "fixed",
          "tryTimeout": "00:01:00",
          "delay": "00:00:20.00",
          "maxDelay": "00:01:00",
          "maxRetries": 2
  "logging": {
    "fileLoggingMode": "always",
    "logLevel": {
      "default": "Trace",
      "function": "Trace",
      "Host.Aggregator": "Trace"
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": false
      "enableLiveMetrics": true




Does anybody have any idea what I am missing?

0 Replies