我想知道有没有办法检查service bus topic empty or not
我尝试使用nuget WindowsAzure.ServiceBus
以及示例代码。
在这个nuget中,我没有得到ITopicClient
:(
var topicClient = TopicClient(); // we can not create object
var topicPeek = topicClient.Peek();
TopicDescription topicDescription = new TopicDescription(topicName);
var topicSize = topicDescription.SizeInBytes;
任何方式这样做?
答案 0 :(得分:1)
使用WindowsAzure.ServiceBus
包,您可以使用MessagingFactory.Create创建Service Bus客户端实例,以获取对MessagingFactory
的引用。获得其中一个后,您可以致电CreateTopicClient
以获取TopicClient
个实例。
(请注意,还有一个名为Microsoft.Azure.ServiceBus
的新软件包,其功能有限,但它支持.NET Core。如果使用该软件包,则类层次结构有所不同,您可以直接创建客户端实例。)