Service Broker, Detecting Disabled Queues

  • Below is the code I am using just to try and get the notification into the queue (After that My plan was to send an email to myself with an alert of some sort.)

    --Create a queue to receive messages.

    CREATE QUEUE pmNotifyQueue ;

    GO

    --Create a service on the queue that references

    --the event notifications contract.

    CREATE SERVICE pmNotifyService

    ON QUEUE pmNotifyQueue

    ([http://schemas.microsoft.com/SQL/Notifications/PostEventNotification],

    );

    GO

    --Create the event notification.

    CREATE EVENT NOTIFICATION pmQueueDisabled

    ON DATABASE

    FOR BROKER_QUEUE_DISABLED

    TO SERVICE 'pmNotifyService', 'current database';

    The error I get is :

    Msg 1098, Level 15, State 1, Line 2

    The specified event type(s) is/are not valid on the specified target object.

    This error is from the CREATE EVENT NOTIFICATION step.

    I can;t figure it out - Any Suggestions?

  • Sorry, I didn't see this before....

    Is the comma in CREATE SERVICE a mistake or is there supposed to be another contract? (I am getting a syntax error there).

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Apparently, Service Broker event notifications can only be scoped to a specific Queue. So change your CREATE Event Notification as follows:

    CREATE EVENT NOTIFICATION pmQueueDisabled

    ON QUEUE pmNotifyQueue

    FOR BROKER_QUEUE_DISABLED

    TO SERVICE 'pmNotifyService', 'current database';

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • Using event notification for logon auditing, I am getting multiple records for the same event. Is there a way to limit to a single record per event. For event type AUDIT_LOGON_FAILED, a single record is returned for an event, however, for AUDIT_LOGON, multiple records are returned per event.

    Please help avoiding retrieving multiple records for a single logon event. Or what other alternative exists for capturing failed login attempts. I am trying to automate the process and reporting.

    Any help will be appreciated.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply