David Klempfner
David Klempfner

Reputation: 9870

Get Azure service bus queue status using NServiceBus

https://stackoverflow.com/a/50267687/2063755 provides the following code to get the queue status:

string connectionString = "connection string";
var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
var queueDescription = namespaceManager.GetQueue("queue name");
var status = queueDescription.Status;

How can I do that using NServiceBus?

I was hoping to use IEndpointInstance but it doesn't have many methods.

Upvotes: 0

Views: 474

Answers (1)

Sean Feldman
Sean Feldman

Reputation: 25994

NServiceBus doesn't provide queue status. If you need the status of the queue, you will have to use the native Azure Service Bus SDK and NamespaceManager or ServiceBusAdministrativeClient, depending on what SDK you're using.

The latest version of NServiceBus uses the Azure.Messaging.ServiceBus SDK. To read the status of a queue queue the following would be needed:

var admin = new ServiceBusAdministrationClient(connectionString);
QueueProperties props = await admin.GetQueueAsync("queue");
var status = props.Status

Upvotes: 1

Related Questions