How do I create an alert in SQL Agent, to notify me once service broker message queue exceeds 300 messages? I am trying to get a notification to an operator in SQL Agent when this occurs.
1 Answer
based on the documentation here
you should use an alarm like this:
USE [msdb]
GO
EXEC msdb.dbo.sp_add_alert @name=N'MyAlert',
@enabled=1,
@delay_between_responses=0,
@include_event_description_in=0,
@performance_condition=N'Broker Statistics|Forwarded Pending Msg Count||>|300',
@job_id=N'00000000-0000-0000-0000-000000000000'
GO