Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the unprocessed message count from a Windows Service Bus Subscription?

I'm working on a system that needs to auto scale worker processes which pull messages from a service bus topic for processing.

To do this I need to know the number of unprocessed messages for a given subscription. How do I do that?

I had a look at the SubscriptionClient Class, but there doesn't appear to be a way to find the number of messages waiting to be processed.

enter image description here

like image 255
Paul Fryer Avatar asked Nov 04 '22 03:11

Paul Fryer


1 Answers

You can use the NamespaceManager to get your QueueDescription or TopicDescription by using GetMessage(_name_) or GetTopic(_name_). These descriptions expose the value as MessageCount.

Hope this helps!

like image 193
Tom Kerkhove Avatar answered Nov 08 '22 05:11

Tom Kerkhove