mskuratowski
mskuratowski

Reputation: 4124

Disable automatic retry for Azure Durable Function

I would like to disable automatic retry in the Azure Durable Function. So whenever there is an error just stop executing and do not retry it again.

I updated host.json with the following settings but it seems not working.

{
  "version": "2.0",
  "retry": {
    "strategy": "fixedDelay",
    "maxRetryCount": 0,
    "delayInterval": "00:00:00"
  },
  "extensions": {
    "queues": {
      "maxDequeueCount": 0
    }
  },
  "functionTimeout": "00:30:00",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  }
}

I still can see queue messages in mystorageaccountname-workitems queue.

Upvotes: 0

Views: 1425

Answers (1)

SaiSakethGuduru
SaiSakethGuduru

Reputation: 2440

Disable automatic retry for Azure Durable Function

To disable retry option in your durable function, add a function

[FunctionName("TimerOrchestratorWithRetry")]
public static async Task Run([OrchestrationTrigger] IDurableOrchestrationContext context)
{
    var retryOptions = new RetryOptions(
        firstRetryInterval: TimeSpan.FromSeconds(5),
        maxNumberOfAttempts: 3);

    await context.CallActivityWithRetryAsync("FlakyFunction", retryOptions, null);

    // ...
}
 

Options to customize Automatic retry policy:

  • Max number of attempts: The maximum number of attempts. If set to 1, there will be no retry.
  • First retry interval: The amount of time to wait before the first retry attempt. for further reference check Automatic Retry Policy docs for durable functions.

Upvotes: 1

Related Questions