Access MaxDequeueCount from Azure function

PAUL FALLOWS 21 Reputation points
2023-06-06T20:28:37.61+00:00

Hi

From a Queue triggered Function is it possible to access the MaxDequeueCount property of the queue? I want to manually handle the poison queue process so I need to know the MaxDequeueCount to do this.

Many thanks

Paul

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,177 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Pramod Valavala 20,641 Reputation points Microsoft Employee
    2023-06-06T22:35:43.15+00:00

    @PAUL FALLOWS While I don't think there is a direct way of getting this information via a binding or through dependency injection, the host.json file is present right alongside your function app when deployed, so there is nothing stopping you from doing something like this 😅

    string json = File.ReadAllText("./host.json");
    var hostJson = ObjectSerializer.Deserialize<JsonNode>(json);
    
    var maxDequeueCount = hostJson["extensions"]["queues"]["maxDequeueCount"];
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.