Azure Storage Queue - Poison Messages

Pete Luetchford 21 Reputation points
2023-01-25T09:31:39.1633333+00:00

Quick question: in Azure storage queues, when a message is moved to a poison queue, does the poison message get a new Message ID or is the original one preserved?

Thanks,

Pete

Azure Queue Storage
Azure Queue Storage
An Azure service that provides messaging queues in the cloud.
68 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
2,604 questions
No comments
{count} votes

Accepted answer
  1. Mike Urnun 4,951 Reputation points Microsoft Employee
    2023-01-27T23:36:38.4933333+00:00

    Hello @Pete Luetchford - Thanks for reaching out and posting on the MS Q&A!

    The short answer is that the message ID will have changed to a different GUID when you access the message again from the poison queue.

    As you've probably already read on the doc, after all five attempts fail, the functions runtime adds a message to a queue named <originalqueuename>-poison. While looking at the implementation of this operation in the code, I found that the HandlePoisonMessageAsync() method passes the message.Body (which is the string content of the message) to the AddMessageAndCreateIfNotExistsAsync() which then calls AddMessageAsync() method that'll create a new message, which will have its own GUID assigned for message ID, on the poison queue.

    I also tested it locally and was able to confirm the same behavior as well. I hope this confirmation helps, please let me know in the comments section below if you have any further questions on this one.

    Please consider contributing to MS Q&A by marking 'Accepted Answer' and ‘Upvoting’ as applicable.

    No comments

1 additional answer

Sort by: Most helpful
  1. SaiKishor-MSFT 15,096 Reputation points Microsoft Employee
    2023-01-25T22:29:52.95+00:00

    @Pete Luetchford Thanks for reaching out to Microsoft Q&A. Poison messages is a feature that the Azure Functions team implements.

    In regard to your question, we do not allow for custom ID to be set for the message ID so ideally, the poison message would get a new message ID.

    "The MessageID element is a GUID value that identifies the message in the queue. This value is assigned to the message by the Queue service and is opaque to the client. This value may be used together with the value of the PopReceipt element to delete or update a message from the queue. The value of PopReceipt is also opaque to the client; it is required when using the Delete Message or Update Message APIs."

    Please let me know if that works or if you need any further assistance. If so, I can connect you with the functions team as needed. Thank you!

    Remember:

    Please accept an answer if correct. Original posters help the community find answers faster by identifying the correct answer. Here is [how][1].

    Want a reminder to come back and check responses? Here is [how][2] to subscribe to a notification.