2
votes

We have an NService prototype running with a publisher and a subscriber component.

If we instantiate multiple copies of the same subscriber on the same physical machine, then only one of them will receive any given published message - but if we run one subscriber each on multiple machines, it works as expected.

It appears that we can't have two processes on the same box that both implement IHandleMessage and both subscribe to the same message queue, since the publisher has no way of knowing there's two separate subscribers involved...

Are we right? Is this behaviour by design, or have we mis-configured something?

1

1 Answers

4
votes

You can have multiple subscribers on the same physical machine - they just need independent input queues.

This means that you cannot run multiple process instances off the same collection of executables and config files - you must duplicate them in a different folder and change the configuration on the other instance.

This is basically what is shown by the PubSub example included with the NServiceBus code.

What you are seeing right now is each subscriber (with the same input queue and thus the same "identity") stealing messages from each other - basically multithreading by using more processes.