开发者

Multiple subscribers in NServiceBus

I'm getting started with NServiceBus and have a question about the Pubsub sample.

My intention was to have multiple instances of Publisher1 running and receiving the message sent from the publisher. I also hacked the Publisher to only send messages of 开发者_如何学Pythonthe eventMessage type.

But if I start the publisher and three instances of Subscriber1, only one of them gets the message at a time.

why is that? Is it a config setting or something else?

This is what I've tried which returns an exception "Exception when starting endpoint, error has been logged. Reason: Cannot configure property before the component has been configured. Please call 'Configure' first.":

using NServiceBus;

namespace Subscriber1
{
    public class EndpointConfig : IConfigureThisEndpoint, AsA_Server
    {
    }

    public class OverrideInputQueue : IWantCustomInitialization
    {
        public void Init()
        {
            Configure
                .Instance
                .Configurer
                .ConfigureProperty<NServiceBus.Config.MsmqTransportConfig>(t => t.InputQueue, "testQueue");
        }
    }
}

/J


NServiceBus assumes that you have one input queue per process. Make sure that each of your subscribers are configured with a unique input queue. If not all three will be polling the same queue producing the behavior you're describing.

To do this you would probably have to copy paste sub1 to 3 different folders, modfying the app.config and start them up.

Hope this helps!


You should use this-

Configure.Instance.Configurer.ConfigureProperty<NServiceBus.Unicast.Transport.Msmq.MsmqTransport>(msmq => msmq.InputQueue, "SomeQueueHere");

Make sure you use MsmqTransport and not MsmqTransportConfig as you mentioned.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜