How to configure pub sub for multiple subscribers using Rhino Service Bus?

I am trying to set up pub-sub between 1 publisher and several subscribers using Rhino Service Bus. However, all I ever get is competing consumers (where the riots are distributed between 1 consumer or another, but not sent to both).

My current publisher configuration looks like this (Note: I am using the new OnewayRhinoServiceBusFacility, so I do not need to define a bus item 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 is as follows:

<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 applications that run publisher and subscriber. I just copy and paste the subscriber box to install 2 subscribers. My message handler looks like this:

public class DummyReceiver : ConsumerOf<MyMessageType>
{
    public void Consume(MyMessageType message)
    {
                    // ......
            }
    }

Any ideas? Greetings

+3
1

Doh! Send . .

, :

var container = new WindsorContainer(new XmlInterpreter("RhinoEsbSettings.xml"));
RhinoServiceBusFacility facility = new RhinoServiceBusFacility();
container.Kernel.AddFacility("rhino.esb", facility);

var bus = container.Resolve<IStartableServiceBus>();
bus.Start();

MyMessageType msg = new ...
bus.Publish(msg);

:

var container = new WindsorContainer(new XmlInterpreter("RhinoEsbSettings.xml"));
container.Register(Component.For<ConsumerOf<MyMessageType>>().ImplementedBy<DummyReceiver>().LifeStyle.Transient.Named("Consumer"));

RhinoServiceBusFacility facility = new RhinoServiceBusFacility();
container.Kernel.AddFacility("rhino.esb", facility);

var bus = container.Resolve<IStartableServiceBus>();
bus.Start();
+3

Source: https://habr.com/ru/post/1723497/


All Articles