I have Azure function running on QueueTrigger, but would like to complete the function without sending the message to poison queue if DequeueCount(max retries) exceeds the set limit (but keep sending other failed messages to the poison queue)
My current function looks like this:
public async Task ProcessThis([QueueTrigger("message-queue")] Message message, string id, string popReceipt, int dequeueCount, ILogger logger)
{
try
{
...
//process queue here
...
}
catch (Exception e)
{
if (dequeueCount == this._config.DequeueCount) //Currently it's set to 10
{
return; //If I return here, would the message still go into poison queue?
}
throw e;
}
}
I want to know if this is the correct way to prevent the message going into poison queue if it fails due to max retry exceeds.