It is very hard to find some good documentation on getting all the messages in a deadletter queue and getting to take a peek at them.
I have an Azure Servicebus Queue and everything I can find is for Azure Servicebus Topics.
Can someone help me with a quick guide?
Dead letter queue is a secondary sub-queue where the poison messages are moved to.
In case of Azure Servicebus Queue the standard path for DLQ is queuePath/$DeadLetterQueue
.
So you need to have another queueClient
to read the DLQ.
And you will do something like this in .NET clients.
string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");
var client = QueueClient.CreateFromConnectionString(connectionString, "QueueName");
// do whatever regular queue reading activities
// this is for dead letter queue
var deadLetterClient = QueueClient.CreateFromConnectionString(connectionString, QueueClient.FormatDeadLetterPath(client.Path), ReceiveMode.ReceiveAndDelete);
BrokeredMessage receivedDeadLetterMessage;
while ((receivedDeadLetterMessage = deadLetterClient.Receive(TimeSpan.FromSeconds(10))) != null)
{
Console.WriteLine(receivedDeadLetterMessage);
}