What's the equivalent of NamespaceManager.GetQueue.MessageCount in the new NET Standard Microsoft.Azure.ServiceBus?

旧街凉风 提交于 2019-12-24 02:45:21

问题


What's the equivalent of NamespaceManager in the new NET Standard Microsoft.Azure.ServiceBus?

I've used WindowsAzure.ServiceBus to do things like count messages in a queue ...

var namespaceManager = NamespaceManager.CreateFromConnectionString(SbConnectionString);
var count = namespaceManager.GetQueue(queueName).MessageCount;

Moving over to the new Microsoft.Azure.ServiceBus .NET Standard library, but whilst it's got classes like QueueClient and TopicClient, it's not got any NamespaceManager

How can you could do message counts in the new .NET Standard library?


回答1:


To provide an update:

This is now implemented and available under the Microsoft.Azure.ServiceBus.Management; namespace.

NamespaceManager is now called ManagementClient and has (roughly) the same endpoints available.

Here's the class itself as part of the pull request to merge it into the main repository.




回答2:


You can't.

The new API doesn't support reading message counts. You'd have to use Azure Monitor API to get them.

Read why that's that case and how to work with Azure Monitor in Reading Azure Service Bus Metrics.



来源:https://stackoverflow.com/questions/48191650/whats-the-equivalent-of-namespacemanager-getqueue-messagecount-in-the-new-net-s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!