Reputation: 2714
Microsoft will deprecated support of Classic API for Service Bus at November 2021 (as described here)
In our code we use WindowsAzure.ServiceBus package. It is an ol package and Microsoft suggets to use new Azure.Messaging.ServiceBus package.
WindowsAzure.ServiceBus
package contain GetQueues(String) method. This method can use filter
parameter for filtration queues by name or properties. It is very useful if a ServiceBus
has many Queues.
But I can't find equivalent of this feature in new Azure.Messaging.ServiceBus
package.
How can I implement filter feature in new package?
Thanks for any help.
Upvotes: 0
Views: 2096
Reputation: 136366
How can I implement filter feature in new package?
You will need to use GetQueuesAsync
method in ServiceBusAdministrationClient
class to get this information.
Please see the sample code:
using System;
using System.Threading.Tasks;
using Azure.Messaging.ServiceBus.Administration;
namespace SO67703647
{
class Program
{
static string connectionString = "your-connection-string";
static async Task Main(string[] args)
{
var adminClient = new ServiceBusAdministrationClient(connectionString);
var queuesListingResult = adminClient.GetQueuesAsync();
await foreach (var item in queuesListingResult)
{
Console.WriteLine(item.Name);
}
Console.WriteLine("=======================");
Console.WriteLine("Press any key to terminate the application.");
Console.ReadKey();
}
}
}
Upvotes: 3