Azure Functions – How to retry messages in the poison queue

When working with a scenario where your Microsoft Azure Function reads data from a queue, your azure functions is automatically triggered when an entry is added to the queue you wish to read from.

The SDK will call your function 5 times, and the message is only removed from the trigger queue if:

  • The function was successful
  • The function fails 5 times

On the 5th fail, the message is moved to the poison queue, a separate queue named [queuename]-poison.

Queues and poison queues

Queues and poison queues

HOW TO RETRY THE POISON QUEUE:

Microsoft have built in methods for manual and automatically poison message handling, but there is no description of how to just retry the messages. In many situations, the problem causing your issue is fixed elsewhere, and all you need to do is retry the messages.

The solution is easier that I thought: The poison queue is just another queue, so all you need to do is to point the Azure Function to the poison queue, and the messages will be executed:

Read from Poison Queue

Read from Poison Queue

MORE TO READ:

 

About briancaos

Developer at Pentia A/S since 2003. Have developed Web Applications using Sitecore Since Sitecore 4.1.
This entry was posted in c#, Microsoft Azure and tagged , , . Bookmark the permalink.

5 Responses to Azure Functions – How to retry messages in the poison queue

  1. Matt says:

    And if it fails again it’ll put the messages back into the *same* poison queue? Or will create a poison-poison.

    Like

  2. briancaos says:

    No, it will just put it back into the poison queue again.

    Like

  3. Pingback: Handling poison messages from Storage Queue – My Learnings

  4. Manu Nair says:

    So what if it is an ever failing message? Will that results in a infinite execution?

    Like

  5. briancaos says:

    Yes, that will result in an infinite execution. Do not point to the poison queue for a long time.

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.