Is it possible to find a list of Subscriptions on a Service Bus Topic?
I want to be able to find the list and then loop through it.
If you're using C#, you can do something like the following:
private void EnumerateTopics()
{
var namespaceManager = NamespaceManager.CreateFromConnectionString(c_ConnectionString);
const string topicName = "testtopic";
var subscriptions = namespaceManager.GetSubscriptions(topicName);
// do stuff with subscriptions
}
That's obviously all synchronous, but there are corresponding async versions of the calls (GetSubscriptionsAsync
, for example). The subscriptions object is an IEnumerable<SubscriptionDescription>
, which'll let you get at any other aspect of the subscription that you might want to use.
First you'll need to:
using Microsoft.ServiceBus;
in your .cs fileYour connection string will be exactly what you pull from the Azure Management Portal, roughly along the lines of:
Endpoint=sb://[namespacename].servicebus.windows.net/;SharedSecretIssuer=owner;SharedSecretValue=[key]
There are similarly easy-to-use libraries available for other languages too.