Search code examples
azureazure-storageazure-queues

Limit number of message process attempts in Azure storage queue


I need to keep track of how many failed attempts have been made to process a message in an azure storage queue and delete the message after N unsuccesful attempts.

I have searched, but have not found any particular property that does this automaticaly and was wondering if there was a way other than using a counter in a storage table.


Solution

  • Each cloud queue message has a DequeueCount property. Does this help?

    REST API reference here.

    As for how to delete messages automatically after n attempts: There's nothing that automatically does this. You'll need to implement your own poison-message handling in Windows Azure queues, based on DequeueCount.

    Alternatively, Azure Service Bus queues have a dead-letter queue for undeliverable messages (or ones that can't be processed). More info here.