NServiceBus中的订户发送自动订阅消息的条件 [英] Condition when subscribers in NServiceBus send an auto-subscribe message
问题描述
我发现,即使我的NSB进程不处理诸如DTOXXX之类的消息,它仍会向DTOXXX的发布者队列发送自动订阅消息.
I am finding out that even when my NSB process does not handle messages for say DTOXXX, it is still sending an auto-subscribe message to the publisher queue for DTOXXX.
这不是所需的行为.我希望该过程可以发布和订阅DTOYYY的消息,但是使用DTOXXX进行的任何通信都只能发送.
This is not the desired behavior. I want the process to publish and subscribe to messages for DTOYYY, but any communication using DTOXXX is strictly send only.
如果还不够清楚,我有2个包含DTO的程序集.我想建立一个发布/订阅总线,但仅适用于YYY.dll中的程序集.至于其他程序集中的DTO,我希望仅通过SEND进行通信(而不是通过pub sub).
If that wasn't clear enough I have 2 assemblies that contains my DTO. I Want to establish a pub/sub bus, but only for assemblies in YYY.dll. As for the DTOs in the other assembly, I want the communication to be done via SEND only (not pub sub).
我遇到的问题是NSB会向其他进程发送自动订阅消息,即使:
The problem I am running across is that NSB is sending auto subscribe message to the other process even though:
- XXX程序集中没有DTO的处理程序.仅引用它是为了使YYY NSB可以向XXX NSB发送消息.
- 两个模块之间的通信仅严格发送.在给定实际使用情况的情况下,这样做是为了促进低耦合.商业需求.
如何正确设置模块?那就是我需要以某种方式告诉NSB,以便自动订阅消息,但仅订阅给定命名空间/程序集中的消息.
How can I set up my modules properly? That is I need to somehow tell NSB, to auto subscribe for messages but only for the ones in a given namespace/assembly.
推荐答案
您可以通过在configure接口中实现自己的DefiningEventsAs来定义自己的规则,将消息视为命令/事件(或纯消息). Nsb将仅自动订阅事件.这可能会对您的用例有所帮助...
You can define your own rules for which messages are considered commands/events (or plain messages) by implementing your own DefiningEventsAs in the configure interface. Nsb will only autosubscribe to events. That may help you for your usecase...
这篇关于NServiceBus中的订户发送自动订阅消息的条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!