Determining how many messages are on the Azure Service Bus Queue

后端 未结 9 850
难免孤独
难免孤独 2020-12-09 15:52

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 pendi

9条回答
  •  旧巷少年郎
    2020-12-09 16:24

    As per the recommendation by Microsoft, it is recommended to use Microsoft.Azure.ServiceBus in which you can easily fetch the message count by

    var managementClient = new ManagementClient("connection string for queue");
    var queue = await managementClient.GetQueueRuntimeInfoAsync("queue name");
    var messages = queue.MessageCount;
    

提交回复
热议问题