How do you get the message count for Azure Topic S

2020-02-26 08:34发布

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条回答
够拽才男人
2楼-- · 2020-02-26 09:14

I found what I was looking for:

var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString);
var subscriptionDesc = namespaceManager.GetSubscription(topicPath, subscriptionName);
long messageCount = subscriptionDesc.MessageCount;
查看更多
登录 后发表回答