Event Notification is not sending an even when Service Broker Queue disable.

Answered Event Notification is not sending an even when Service Broker Queue disable.

  • Saturday, September 15, 2012 5:32 PM
     
     

    Hi All,

    I am trying an option "BROKER_QUEUE_DISABLED" in EVENT NOTIFICATION it seems it is not properly generating a Broker Queue disabled event. SO can some one please validate the script which I created(see below)

    -Thanks in Advance

    Script:

    CREATE QUEUE NotifyQueue

    GO

    CREATE

    SERVICE NotifyService

    ON

    QUEUE NotifyQueue

    [http://schemas.microsoft.com/SQL/Notifications/PostEventNotification]);


    GO

    CREATE ROUTE NotifyRoute
    WITH SERVICE_NAME = 'NotifyService',
    ADDRESS = 'LOCAL';
    GO

    CREATE

    EVENT NOTIFICATION [CHS_QueueDisabledNotif]

           ON QUEUE [CHS_Change_Queue] WITH FAN_IN

           FOR BROKER_QUEUE_DISABLED

           TO SERVICE 'NotifyService', 'current database'



    --Testing

    --Try Disabling Application Queue

    ALTER QUEUE dbo.CHS_Change_Queue WITH STATUS = OFF

    SELECT * FROM NotifyQueue


    Vinay



    • Edited by KVK Kumar Saturday, September 15, 2012 5:35 PM
    • Moved by Iric WenModerator Monday, September 17, 2012 6:58 AM (From:SQL Server Notification Services)
    •  

All Replies

  • Monday, September 17, 2012 7:17 AM
    Moderator
     
     

    Hi Vinay,


    According to your description, it seems like that you have not got the event notification when you disabled the queue.

    Please follow the blog below which includes sample code to create an event notification service to receive notification messages when a user queue being watched gets disabled:

    http://blogs.msdn.com/b/sql_service_broker/archive/2008/06/30/poison-message-handling.aspx

    Best Regards,
    Iric
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


  • Monday, September 17, 2012 11:16 PM
     
     Answered

    Hi All,

    I found the reason, and below is my explaination

    "

    Service Broker creates an event notification only when a Service Broker queue is disabled because of a poison message. When you disable a queue manually, no event notification message is created. Because of this, an application has the possibility to subscribe to this event notification and react accordingly in this error situation. "

    In my script i was trying disabling manually :)

    Hope this helps.


    Vinay

    • Marked As Answer by KVK Kumar Monday, September 17, 2012 11:16 PM
    •