Reputation: 1535
I have an Azure Web Job which is working by processing new items on an Azure storage queue. That is working. I have set the MaxDequeueCount to a low number, and once an operation triggered by a queue has failed that many times, I expect that this item on the queue to be moved to a poison queue.
However, that is not happening. The item gets removed from the queue, and there is no poison queue nor this message in any poison queue. What is wrong here, as I am unaware of any other steps required in order to have the message "pushed" to a poison queue.
public static async Task ProcessQueueMessage([QueueTrigger("myQueue")] CloudQueueMessage message, TextWriter log)
{
try
{
throw new InvalidCastException();
}
catch (Exception exception)
{
log.WriteLine($"Exception in ProcessQueueMessage: {exception}");
throw;
}
}
Upvotes: 0
Views: 387
Reputation: 1380
The message will move to the poison queue only if there is an unhandled exception. Using a try-catch error is not the case. What you can do is to move the message to the poison queue manually in your catch section.
Upvotes: 1