6
votes

I am using azure service bus topic and subscription mechanism and want to process the messages which are all in the dead letter queue.

Moreover i want to process the messages via azure web job in C# and send them back to queue. So i want to know how I can process the messages on the deadletter queue through my application?

3
Frankly, I don't get what exactly you are asking. Could you rephrase?Mikhail Shilkov
Another troll comment from a Microsoft employee. This is the only way to handle Microsoft Azure Service Bus dead letter queues on Mac and Linux, because the Azure Service Bus Explorer tool is Windows only and they cannot be viewed via the portal.SSH This

3 Answers

12
votes

When a message is deadlettered it goes onto the dead letter queue for the subscription from which it was read. You access that just like you'd access the original subscription except that you append /$DeadLetterQueue to the subscription name.

4
votes

Moreover i want to process the messages via azure web job in C# and send them back to queue.

As spodger pointed that the path of your deadletter subscription would be:

{topic-path}/Subscriptions/{subcription-name}/$DeadLetterQueue

You could use the WebJobs SDK for Service Bus and leverage the ServiceBusTrigger to access your dead letter queue message(s) as follows:

public void ProcessDeadletterQueue(
    [ServiceBusTrigger("topicName", "subscriptionName/$DeadLetterQueue")] BrokeredMessage message)
{
    //TODO:
}

For more details, you could refer to here.

0
votes

When a message is dead-lettered from a Service Bus Entity(Queue or Topic Subscription), it will be moved to the dead-letter path of the same entity. The reason for dead-lettering will be available in the message's custom properties DeadLetterReason and DeadLetterErrorDescription.

In order to receive the dead-letter messages,

string path = Microsoft.ServiceBus.Messaging.SubscriptionClient.FormatDeadLetterPath(topicPath, subscriptionName);    
var subscriptionClient = SubscriptionClient.CreateFromConnectionString(connectionString, path);  
BrokeredMessage message = subscriptionClient.Receive();