你如何获得Azure的主题订阅消息计数? [英] How do you get the message count for Azure Topic Subscription?
本文介绍了你如何获得Azure的主题订阅消息计数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法让一个Azure的主题订阅当前消息计数?
Is there a way to get the current message count for an Azure topic subscription?
我看到SubscriptionDescription类有一个MessageCount属性,但这类似乎只能用于创建订阅。我没有看到一个方法来检索现有订阅的SubscriptionDescription对象。
I see that the SubscriptionDescription class has a MessageCount property, but this class appears to only be used to create a subscription. I don't see a way to retrieve a SubscriptionDescription object for an existing subscription.
推荐答案
我发现我一直在寻找的:
I found what I was looking for:
var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
var subscriptionDesc = namespaceManager.GetSubscription(topicPath, subscriptionName);
long messageCount = subscriptionDesc.MessageCount;
这篇关于你如何获得Azure的主题订阅消息计数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文