如何使用Rhino Service Bus为多个订阅者配置发布订阅?
我正在尝试使用 Rhino Service Bus 在 1 个发布者和多个订阅者之间设置发布-订阅。然而,我似乎得到的只是竞争消费者(消息在一个消费者或另一个消费者之间分发,但不会发送给两者)。
我当前的发布者配置如下所示(注意:我正在使用新的 OnewayRhinoServiceBusFacility,因此我不需要在发送者中定义总线元素)我
<facility id="rhino.esb.sender" >
<messages>
<add name="My.Messages.Namespace" endpoint="msmq://localhost/my.queue"/>
</messages>
</facility>
当前的订阅者配置如下所示:
<facility id="rhino.esb.receiver" >
<bus threadCount="1" numberOfRetries="5" endpoint="msmq://localhost/my.queue" DisableAutoQueueCreation="false" />
<messages>
<add name="My.Messages.Namespace" endpoint="msmq://localhost/my.queue" />
</messages>
</facility>
我有 2 个启动的简单命令行应用程序发布者和订阅者。我只需复制并粘贴订阅者箱即可设置 2 个订阅者。我的消息处理程序如下所示:
public class DummyReceiver : ConsumerOf<MyMessageType>
{
public void Consume(MyMessageType message)
{
// ......
}
}
有什么想法吗?干杯
I am trying to set up pub-sub between 1 publisher and multiple subscribers using Rhino Service Bus. However, all I ever seem to get is competing consumers (where messges are distributed between 1 consumer or the other, but not sent to both).
My current publisher configuration looks like this (Note: I'm using the new OnewayRhinoServiceBusFacility so I don't need to define a bus element in the sender)
<facility id="rhino.esb.sender" >
<messages>
<add name="My.Messages.Namespace" endpoint="msmq://localhost/my.queue"/>
</messages>
</facility>
My current subscriber configuration looks like this:
<facility id="rhino.esb.receiver" >
<bus threadCount="1" numberOfRetries="5" endpoint="msmq://localhost/my.queue" DisableAutoQueueCreation="false" />
<messages>
<add name="My.Messages.Namespace" endpoint="msmq://localhost/my.queue" />
</messages>
</facility>
I have 2 simple command line apps which start up publisher and subscriber. I just copy and paste subscriber bin to set up 2 subscribers. My message handler looks like this:
public class DummyReceiver : ConsumerOf<MyMessageType>
{
public void Consume(MyMessageType message)
{
// ......
}
}
Any ideas? Cheers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
哎哟!在我的生产者代码中使用发送而不是发布。从另一个示例复制它并忘记更改。
因此,作为参考,我的发布者代码如下:
我的消费者启动代码如下:
Doh! Was using Send instead of Publish in my producer code. Had copied it from another example and forgot to change.
So, for reference my publisher code is like this:
And my consumer startup code is like this: