【问题标题】:Service Broker Application Queue Disable EventService Broker 应用程序队列禁用事件
【发布时间】:2012-09-17 23:19:15
【问题描述】:

我正在尝试事件通知中的选项BROKER_QUEUE_DISABLED,它似乎没有正确生成代理队列禁用事件。有人可以验证我创建的脚本吗? (见下文)

脚本:

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

【问题讨论】:

    标签: service-broker


    【解决方案1】:

    我找到了问题的答案:)

    如果我们手动关闭队列,SQL 引擎将不会生成禁用事件。只有在激活过程中发生任何错误时才会生成。我在激活过程中添加了自定义错误,例如SELECT 1/0 然后 SQL 可以生成禁用事件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-01
      • 1970-01-01
      相关资源
      最近更新 更多