[英]Get Azure service bus queue status using NServiceBus
https://stackoverflow.com/a/50267687/2063755 provides the following code to get the queue status: https://stackoverflow.com/a/50267687/2063755提供以下代码来获取队列状态:
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?我怎样才能使用 NServiceBus 做到这一点?
I was hoping to use IEndpointInstance
but it doesn't have many methods.我希望使用IEndpointInstance
但它没有很多方法。
NServiceBus doesn't provide queue status. NServiceBus 不提供队列状态。 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.如果您需要队列的状态,则必须使用本机 Azure 服务总线 SDK 和NamespaceManager
或ServiceBusAdministrativeClient
,具体取决于您使用的 ZF20E3C5E54C0AB3D376AZD660B3。
The latest version of NServiceBus uses the Azure.Messaging.ServiceBus
SDK.最新版本的 NServiceBus 使用Azure.Messaging.ServiceBus
SDK。 To read the status of a queue queue
the following would be needed:要读取队列queue
的状态,需要以下内容:
var admin = new ServiceBusAdministrationClient(connectionString);
QueueProperties props = await admin.GetQueueAsync("queue");
var status = props.Status
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.