Service Broker 外部激活器...在 2 个队列上激活?

发布于 2024-10-18 08:05:14 字数 2695 浏览 2 评论 0原文

我有 2 个队列,还有更多队列...我想使用外部激活器从外部激活这些队列。

当我编辑 EAService.config 来激活队列#1 时,它工作得很好。
当我编辑 EAService.config 来激活队列#2 时,它工作得很好。

如果我将两者都放入配置中,则只有第一个列出的才会被激活。

两个队列实际上都是由同一个 exe 处理的...不起作用的示例是这个...

<NotificationServiceList>
    <NotificationService name="my_notif_svc1" id="100" enabled="true">
      <Description>my notification service 1</Description>
      <ConnectionString>
        <Unencrypted>server=my_pc01;database=my_db;Application Name=External Activator;Integrated Security=true;</Unencrypted>
      </ConnectionString>
    </NotificationService>
    <NotificationService name="my_notif_svc2" id="100" enabled="true">
      <Description>my notification service 2</Description>
      <ConnectionString>
        <Unencrypted>server=my_pc01;database=my_db;Application Name=External Activator;Integrated Security=true;</Unencrypted>
      </ConnectionString>
    </NotificationService>
  </NotificationServiceList>
  <ApplicationServiceList>
    <ApplicationService name="myMessageApp1" enabled="true">
      <OnNotification>
        <ServerName>my_pc01</ServerName>
        <DatabaseName>my_db</DatabaseName>
        <SchemaName>dbo</SchemaName>
        <QueueName>my_user_queue1</QueueName>
      </OnNotification>
      <LaunchInfo>
        <ImagePath>c:\test\myMessageReceiver.exe</ImagePath>
        <CmdLineArgs>whatever cmd-line arguments you need to pass to your receiver application</CmdLineArgs>
        <WorkDir>c:\test</WorkDir>
      </LaunchInfo>
      <Concurrency min="1" max="4" />
    </ApplicationService>
    <ApplicationService name="myMessageApp2" enabled="true">
      <OnNotification>
        <ServerName>my_pc01</ServerName>
        <DatabaseName>my_db</DatabaseName>
        <SchemaName>dbo</SchemaName>
        <QueueName>my_user_queue2</QueueName>
      </OnNotification>
      <LaunchInfo>
        <ImagePath>c:\test\myMessageReceiver.exe</ImagePath>
        <CmdLineArgs>whatever cmd-line arguments you need to pass to your receiver application</CmdLineArgs>
        <WorkDir>c:\test</WorkDir>
      </LaunchInfo>
      <Concurrency min="1" max="4" />
    </ApplicationService>
  </ApplicationServiceList>

另外我不明白 id="100" 正在做什么...我尝试使用相同的 # 和不同的 #...即 100 & 101 但这没有什么区别。激活器服务仅适用于“ApplicationServiceList”

帮助中列出的第一个服务!

I have 2 queues and more to come... I want to have those queues externally activated using the external activator.

When I edit the EAService.config to activate queue#1 it works just fine.
When I edit the EAService.config to activate queue#2 it works just fine.

If I put both in the config only the one listed first gets activated.

Both queues are actually getting processed by the same exe... and example of what doesn't work is this...

<NotificationServiceList>
    <NotificationService name="my_notif_svc1" id="100" enabled="true">
      <Description>my notification service 1</Description>
      <ConnectionString>
        <Unencrypted>server=my_pc01;database=my_db;Application Name=External Activator;Integrated Security=true;</Unencrypted>
      </ConnectionString>
    </NotificationService>
    <NotificationService name="my_notif_svc2" id="100" enabled="true">
      <Description>my notification service 2</Description>
      <ConnectionString>
        <Unencrypted>server=my_pc01;database=my_db;Application Name=External Activator;Integrated Security=true;</Unencrypted>
      </ConnectionString>
    </NotificationService>
  </NotificationServiceList>
  <ApplicationServiceList>
    <ApplicationService name="myMessageApp1" enabled="true">
      <OnNotification>
        <ServerName>my_pc01</ServerName>
        <DatabaseName>my_db</DatabaseName>
        <SchemaName>dbo</SchemaName>
        <QueueName>my_user_queue1</QueueName>
      </OnNotification>
      <LaunchInfo>
        <ImagePath>c:\test\myMessageReceiver.exe</ImagePath>
        <CmdLineArgs>whatever cmd-line arguments you need to pass to your receiver application</CmdLineArgs>
        <WorkDir>c:\test</WorkDir>
      </LaunchInfo>
      <Concurrency min="1" max="4" />
    </ApplicationService>
    <ApplicationService name="myMessageApp2" enabled="true">
      <OnNotification>
        <ServerName>my_pc01</ServerName>
        <DatabaseName>my_db</DatabaseName>
        <SchemaName>dbo</SchemaName>
        <QueueName>my_user_queue2</QueueName>
      </OnNotification>
      <LaunchInfo>
        <ImagePath>c:\test\myMessageReceiver.exe</ImagePath>
        <CmdLineArgs>whatever cmd-line arguments you need to pass to your receiver application</CmdLineArgs>
        <WorkDir>c:\test</WorkDir>
      </LaunchInfo>
      <Concurrency min="1" max="4" />
    </ApplicationService>
  </ApplicationServiceList>

additionally I don't understand what the id="100" is doing... I tried having same # and different #... ie 100 & 101 but it didn't make a difference. The activator service only works for the first one listed in the "ApplicationServiceList"

help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

橘亓 2024-10-25 08:05:14

我找到了我的问题...

来自文档

系统可以使用外部激活
对于多个 Service Broker
应用程序队列。有一个
之间的多对一关系
应用程序队列和激活
通知服务。有一个
之间的一对一关系
激活通知服务和
外部激活服务。

我是上面列出的两个通知服务(my_notif_svc1 和 my_notif_svc2)。我切换了我的事件通知(创建事件通知...)以利用相同的“TO SERVICE”,现在它可以工作了。

因此,您必须为外部激活器使用一项“服务”,但您可以为指向该服务的多个队列创建多个事件通知。

我仍然认为我的设置方式应该有效,但这绝对有效......

I figured out my problem...

From the documentation

Systems can use external activation
for multiple Service Broker
application queues. There is a
many-to-one relationship between
application queues and activation
notification services. There is a
one-to-one relationship between the
Activation Notification service and
the External Activation service.

I was two notification services (my_notif_svc1 & my_notif_svc2) listed above. I switched my event notifications (create event notivation ... ) to utilize the same "TO SERVICE" and now it works.

So you have to utilize one "service" for external activator but you can create multiple Event Notifications for multiple queues which point to that service.

I still think the way I had it set up it should work but this definitely works...

白馒头 2024-10-25 08:05:14

我也遇到了同样的问题,如果微软能给出官方回应,说明为什么以及他们是否会尊重 SSBEA 中列出的多个通知服务,而不仅仅是列表中的第一个,那就太好了。最后,我们采用了相同的解决方案,这里有一个有用的代码片段,可用于动态获取 Guid 并将队列激活事件设置为单个服务 (ServiceBrokerNotification.NotificationService)。

DECLARE @sbn nvarchar(100) = 'servicebrokernotification'
DECLARE @sbnid nvarchar(60)

SELECT @sbnid = ''''+CAST(service_broker_guid AS nvarchar(60))+'''' FROM sys.databases WHERE name = @sbn 选择 @sbnid

声明 @Str nvarchar(max) 声明@createEventSql nvarchar(max)

设置@Str = '创建事件通知NotificationEvent ON QUEUE [TargetQueue] FOR QUEUE_ACTIVATION TO SERVICE ''NotificationService'' ,' + @sbnid;

选择@Str 执行(@Str)

I also ran into this same problem and it would be nice to have an official response from Microsoft as to why and if they will honor multiple notification services listed in SSBEA and not just the first one in the list. In the end we went with the same solution, and here is a helpful snippet to use to dynamically to get the Guid and setup the queue activation event to a SINGLE service (ServiceBrokerNotification.NotificationService).

DECLARE @sbn nvarchar(100) = 'servicebrokernotification'
DECLARE @sbnid nvarchar(60)

SELECT @sbnid = ''''+CAST(service_broker_guid AS nvarchar(60))+'''' FROM sys.databases WHERE name = @sbn SELECT @sbnid

DECLARE @Str nvarchar(max) DECLARE @createEventSql nvarchar(max)

Set @Str = 'CREATE EVENT NOTIFICATION NotificationEvent ON QUEUE [TargetQueue] FOR QUEUE_ACTIVATION TO SERVICE ''NotificationService'' ,' + @sbnid;

Select @Str EXECUTE (@Str)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文