Service Broker Application Queue Disable Event

旧巷老猫 提交于 2020-01-15 05:51:44

问题


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

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

回答1:


I found an answer to my question :)

SQL engine will not generate disable event if we manually turned off the queue. It will generate only if any error occurs in activation procedure. I added custom error in activation proc, something like SELECT 1/0 then SQL can generate Disable event.



来源:https://stackoverflow.com/questions/12468392/service-broker-application-queue-disable-event

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!