How to change poison-queue message expiration date period to maximum in azure storage queue and currently by default expiration time is 7 days.
AFAIK, the maximum allowed expiration time for Azure Queue message is 7 days, which is also the default value.
The poison queue is also a normal queue named {original-queue-name}-poison
. For example, if Azure Webjobs SDK handles a queue message exceeding the maximum number of attempts, then the related message would be moved to a poison queue, and this process is handled by the SDK.
Per my understanding, you need to explicitly handle the poison messages instead of storing the messages into the poison queue permanently. Details you could follow How to handle poison messages. Moreover, you could choose other Message Queuing services to meet your requirement.
As changelog.txt about changes in 9.0.0:
Queues: Added support for infinite TTL on queue messages.
You could specify the timeToLive
parameter when adding the queue message as follows:
queue.AddMessage(new CloudQueueMessage($"hello world-{DateTime.UtcNow}"),timeToLive:TimeSpan.MaxValue);
For your requirement, you could use the manual poison message handling approach to check the dequeueCount
and explicitly add the current queue message into the poison queue programmatically.
Note: The maximum number of retries before a queue message is sent to a poison queue is 5 by default, you could change it via config.Queues.MaxDequeueCount
.
Or you just leverage the automatic poison message handling, then you could trigger the relevant poison queue and add the queue message into your custom poison queue with the infinite TTL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With