The .NET Standard client (Microsoft.Azure.ServiceBus
) is deliberately not providing management operations. It states that management operations should not be performed at run time. Management operations are extremely slow.
Is this possible in some other way in this library with .NET Core 1.1?
Yes, it is possible.
Instead of the NamespaceManager
that was available with the old client (WindowsAzure.ServiceBus
), there's a ServiceBus management library (Microsoft.Azure.Management.ServiceBus.Fluent
)
You will need to do the following:
- Authenticate using
ServiceBusManager
- Access the namespace you're interested in via
ServiceBusManager.Namespaces
- Filter out the entity you're interested in by locating it under
ServiceBusManager.Namespaces.Queues
/ServiceBusManager.Namespaces.Topics
. For subscription you'll need to locate one via ITopic
object.
- Once you've got your entity (
IQueue
, ITopic
, or ISubscription
), you'll be able to access the message counts.
I'm not a big fan of this approach. Rather than each developer reinventing this wheel, Azure Service Bus team should have provided a helper library to replace NamespaceManger
. You can always raise an issue or vote for an issue that was closed.
Management operations were introduced back in version 3.1.1 with pull request #481.