Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determining how many messages are on the Azure Service Bus Queue

I know there is a way to determine the number of messages (or approximate number) in the Azure Queue (Store Account); however is there a way to query for the number of pending messages on an Azure Service Bus queue?

like image 620
aceinthehole Avatar asked Apr 27 '13 17:04

aceinthehole


People also ask

How do I check messages on Azure Service Bus queue?

To peek messages, select Peek Mode in the Service Bus Explorer dropdown. Check the metrics to see if there are Active Messages or Dead-lettered Messages to peek and select either Queue / Subscription or DeadLetter sub-queue. Select the Peek from start button.

What is the maximum size of a message in an Azure Service Bus queue?

Service Bus messaging services (queues and topics/subscriptions) allow application to send messages of size up to 256 KB (standard tier) or 100 MB (premium tier).

What would be the size of an individual messages in Azure queue storage service?

A queue message can be up to 64 KB in size. A queue may contain millions of messages, up to the total capacity limit of a storage account.

What is the size of a single message in a queue Azure?

A single queue message can be up to 64 KB in size, and a queue can contain millions of messages, up to the total capacity limit of a storage account.


2 Answers

var nsmgr = Microsoft.ServiceBus.NamespaceManager.CreateFromConnectionString(connectionString); long count = nsmgr.GetQueue(queueName).MessageCount; 
like image 99
Joseph Avatar answered Oct 08 '22 05:10

Joseph


It is called MessagesCountDetails.ActiveMessageCount. It returns the number of the Active Messages in the Queue. You probably have some Dead letter messages:

var msg = Microsoft.ServiceBus.NamespaceManager.CreateFromConnectionString(Settings.Default.ConnectionString); numofmessages.Text = msg.GetQueue(QueueName).MessageCountDetails.ActiveMessageCount.ToString(); 
like image 27
Katsifaris Avatar answered Oct 08 '22 04:10

Katsifaris