Tedford
Tedford

Reputation: 2932

Is there a way to disable the native retry logic with an azure queue trigger?

I see in the documentation where queues and blob triggers will cause a native retry of 5 times. I am sure this is can very helpful in some circumstances but it is also not helpful in others. Is there some configuration bit that can be set to remove these retries? In the case of a function failing due to exhausting the RU of a cosmosdb binding it is unlikely that rapidly running it 4 more times will garner a different result.

Upvotes: 3

Views: 3459

Answers (2)

NitinSingh
NitinSingh

Reputation: 2078

You haven't mentioned if the queue is a Storage or Service Bus.

For the Service Bus, you can do the following which worked for me:-

Instead of making change in your function app, update the queue's configuration to set the "Max Delivery Count" as 1. This will ensure only a single dequeue operation is possible at the source end, without bothering of who is the consumer.

This works irrespective of whether the version of Function App is v1 or v2. See the screenshot of Azure Portal

Service bus queue's property

Upvotes: 2

Mikhail Shilkov
Mikhail Shilkov

Reputation: 35154

Edit your host.json file to set maxDequeueCount to 1:

{
  "queues": {
      "maxDequeueCount": 1
    }
}

Upvotes: 6

Related Questions