I am writing a utility to monitor our Azure Service Bus Topics and Subscriptions.
I can get the Topic details, such as name, queued message count and dead-letter message count, but I would like to get the number of messages that have been processed.
Here is the code I am using:
var sub = namespaceManager.GetSubscription(topicPath, subscriptionName);
var name = sub.Name;
var pending= sub.MessageCountDetails.ActiveMessageCount;
var deadletter = sub.MessageCountDetails.DeadLetterMessageCount
It seems that GetSubscription
does not include any properties to get the number of messages processed.
Has anyone tried to do this before?
It is possible to fetch the Total Count of Messages in a Topic, Incoming Messages, Outgoing Messages with the help of the latest Azure Monitor Metrics. In your case, count of Outgoing messages will be the number of processed messages.