为什么 NServiceBus 会从两个不同的服务器接收通知?
我的应用程序有两个组件。一种是通知程序进程(Notifier),它运行在媒体服务器上,当文件被修改时使用 NServiceBus 发布消息。另一个是 MVC Web 应用程序 (PhotoWeb),它订阅这些消息以执行缓存失效等操作。
我正在为 QA 设置暂存环境,问题是在暂存环境中运行的 PhotoWeb 应用程序正在接收通知 服务器 - 这是意外的,而且有点奇怪...
部署到生产环境的 PhotoWeb 实例具有以下配置:
<MsmqTransportConfig InputQueue="PhotoWebInputQueue" ErrorQueue="PhotoWebErrorQueue" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig>
<MessageEndpointMappings>
<clear/>
<!-- Where do we subscribe to messages about filesystem changes? -->
<add Messages="MyProject.Messages" Endpoint="NotifierInputQueue@webmedia"/>
</MessageEndpointMappings>
</UnicastBusConfig>
登台环境中的配置是:
<MsmqTransportConfig InputQueue="PhotoWebInputQueue" ErrorQueue="PhotoWebErrorQueue" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig>
<MessageEndpointMappings>
<clear/>
<!-- Where do we subscribe to messages about filesystem changes? -->
<add Messages="MyProject.Messages" Endpoint="NotifierInputQueue@staging_media"/>
</MessageEndpointMappings>
</UnicastBusConfig>
来自登台媒体服务器和实时媒体 注意:
- 我误解了队列的实际含义 - PhotoWebInputQueue 实际上是共享网络资源,而不是特定服务器本地的队列
- 以前的部署导致 NServiceBus 订阅实时网络媒体暂存 Web 服务器上的队列,并且此订阅在重新启动等过程中持续存在。
但是,我的 NServiceBus-fu 不够强大,无法知道如何测试这些理论中的任何一个。您可以看到此配置或架构有什么明显的错误吗?
谢谢,
迪伦
My app has two components. One is a notifier process (Notifier) that runs on a media server and publishes a message using NServiceBus when a file is modified. The other is a MVC web application (PhotoWeb) that subscribes to these messages to perform cache invalidation, etc.
I'm setting up a staging environment for QA, and the problem is that the PhotoWeb app that's running in the staging environment is receiving notifications from both the staging media server AND the live media server - which is unexpected, and a little odd...
The PhotoWeb instance that's deployed to production has this configuration:
<MsmqTransportConfig InputQueue="PhotoWebInputQueue" ErrorQueue="PhotoWebErrorQueue" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig>
<MessageEndpointMappings>
<clear/>
<!-- Where do we subscribe to messages about filesystem changes? -->
<add Messages="MyProject.Messages" Endpoint="NotifierInputQueue@webmedia"/>
</MessageEndpointMappings>
</UnicastBusConfig>
and the configuration that's in the staging environment is:
<MsmqTransportConfig InputQueue="PhotoWebInputQueue" ErrorQueue="PhotoWebErrorQueue" NumberOfWorkerThreads="1" MaxRetries="5" />
<UnicastBusConfig>
<MessageEndpointMappings>
<clear/>
<!-- Where do we subscribe to messages about filesystem changes? -->
<add Messages="MyProject.Messages" Endpoint="NotifierInputQueue@staging_media"/>
</MessageEndpointMappings>
</UnicastBusConfig>
A couple of theories spring to mind:
- I've misunderstood what a queue actually is - and the
PhotoWebInputQueue
is actually a shared network resource instead of a queue that's local to a specific server - A previous deployment has caused NServiceBus to subscribe to the live webmedia queue on the staging web server, and this subscription is persisting across restarts, etc.
However, my NServiceBus-fu isn't strong enough to know how to test either of those theories. Anything obviously wrong with this configuration or architecture that you can see?
Thanks,
Dylan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通知程序向两个订阅者发送消息的唯一方法是通知程序的订阅存储中存在两个订阅者的订阅。订阅包括:
当发布者收到消息时,它会依次根据每个订阅评估该消息,并将该消息发送给每个匹配的订阅者。
如果您清除实时通知程序的订阅存储,然后重新启动实时订阅者,这应该可以解决该问题。
The only way your notifier can be sending messages to both subscribers is if there is a subscription for both subscribers in the notifier's subscription store. The subscription consists of:
When the publisher receives a message it evaluates the message against each subscription in turn, and sends the message on to each matching subscriber.
If you clear down the live notifier's subscription store and then restart the live subscriber this should resolve the issue.