4
votes

Why does my Azure Service Bus queues send messages to the dead letter sub queue when it's not enabled?

Right from the beginning I made sure expired messages wouldn't be moved to the dead letter queue (or so I thought).

In Visual Studio Server Explorer I see this under my queues:

  • EnableDeadLetteringOnMessageExpiration: False

But I also see this:

  • DeadLetterMessageCount: 16

I can't pull them out as normal so I created a temporary service to handle (get rid of) these and this is what I was able to extract from the brokeredMessage.Properties:

  • DeadLetterReason: MaxDeliveryCountExceeded
  • DeadLetterErrorDescription: Message could not be consumed after 10 delivery attempts.

I would like the messages to just stay in the normal queue when they're not completed. So far I've changed MaxDeliveryCount to 1000 but it's not a real solution.

What am I overlooking?

Update Upon reading my own text I realised EnableDeadLetteringOnMessageExpiration has nothing to do with delivery count. Do I have any option to let my messages stay in the normal queue forever? Or do I have to set the MaxDeliveryCount "high enough"?

1

1 Answers

2
votes

I had the same issue. Messages will be moved to dead letter if they reached MaxDeliveryCount, even though you disable it. You may want to set MaxDeliveryCount to 0 or int.MaxValue to stop deadlettering.

NOTE: This information is not documented anywhere. I figured that out by finding people who work on ServiceBus Queue specifically.