I am migrating my project from the WindowsAzure.ServiceBus
to the new Microsoft.Azure.Servicebus
NuGet package.
The problem is that I cannot find a way to list all my current topics/subscriptions in my servicebus namespace.
This is the piece of code I used before with the old NuGet package:
var namespaceManager = NamespaceManager.CreateFromConnectionString("ServiceBusConnectionString");
foreach (var topic in await namespaceManager.GetTopicsAsync())
{
foreach (var subscription in await namespaceManager.GetSubscriptionsAsync(topic.Path))
{
//do something
}
}
foreach (var queue in await namespaceManager.GetQueuesAsync())
{
//do something
}
Edit: The latest version has support for listing all topics, subscriptions and queues.
var managementClient = new ManagementClient("ServiceBusConnectionString");
foreach (var topic in await _managementClient.GetTopicsAsync())
{
foreach (var subscription in await _managementClient.GetSubscriptionsAsync(topic.Path))
{
//do something
}
}