问题
Is there a way to get the current message count for an Azure topic subscription?
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.
回答1:
I found what I was looking for:
var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
var subscriptionDesc = namespaceManager.GetSubscription(topicPath, subscriptionName);
long messageCount = subscriptionDesc.MessageCount;
来源:https://stackoverflow.com/questions/13957339/how-do-you-get-the-message-count-for-azure-topic-subscription