Reading all the messages in a Queue is possible with Peek
operation concept of Service bus.
MessagingFactory messagingFactory = MessagingFactory.CreateFromConnectionString(<Your_Connection_String>);
var queueClient = messagingFactory.CreateQueueClient(<Your_Queue_Name>, ReceiveMode.PeekLock); // Receive mode is by default PeekLock and hence, optional.
BrokeredMessage message = null;
while(true)
{
message = queueClient.Peek(); // You have read one message
if (message == null) // Continue till you receive no message from the Queue
break;
}
This can also return expired
or locked
messages. Give a quick read about Message browsing if this suits your requirement of reading messages.