Today, we will talk about how you can set up alerts on Azure Service Bus Topics and what the challenges are. Firstly, I describe the problem. Secondly, I give a solution that is not that good, but it is the best I can do given the tools available. Indeed, Tom Kerkhove lamented about similar issues nearly two years ago.
I want to get alerts whenever a message does not have a matching Topic Subscription Filter. In the event that there is no subscription BizTalk would give a subscription not found error. In contrast, Azure Topics just throw the message away without any error. As was previously stated, one solution is to create a notin subscription for all messages without matching subscriptions instead. Thus, have service bus topic with subscriptions like this.
I want to detect when the message count is high. This indicates that the messages are stuck in the topic or if they have been sent to the notin subscription.
How to set up alerts on a service bus topic
Firstly, open the alerts tab on the service bus blade. Secondly, create a new alert rule selecting “Count of messages in a Queue/Topic” and select “Entity Name” as a dimension. Now you can select the topics or queue on the service bus. However, you cannot select the topic subscription themselves.
Thirdly, configure the evaluation criteria. Finally configure the Threshold value with the help of the graph on the right-hand side.
Save the rule.
In summary I have shown how to configure an alert of message counts on a topic. However, we can only monitor the message count on the topic and not the subscriptions. Thus, we detect stuck messages when the message counts on the subscription get high.