Multiple routing best practice?


(Kevin Ison) #1

I have a test container so as to learn how to use this software. I am at the point now where I need to be able to send messages to multiple subscribers… is there a good example on how to do this…

client
|-----> subscriber a
|-----> subscriber b
|-----> subscriber c

Thanks


(Mauro Servienti) #2

Hi Kevin,

Have a look at our documentation about pub/sub:
https://docs.particular.net/nservicebus/messaging/publish-subscribe/

And the available samples:
https://docs.particular.net/samples/pubsub/

Cheers,
.m


(Kevin Ison) #3

So… am I reading correctly to subscriber I have to have a handler in my endpoint that implements my “sub” message classes?
eg:
Endpoint1Hndlr.IHandleMessage< someMessageClass>
Endpoint2Hndlr.IHandleMessage< someMessageClass>
Endpoint3Hndlr.IHandleMessage< someMessageClass>

Is this correct?

I could also create a publisher in my handler that reacts when i receive the message for the subscription im watching?


(Sean Feldman) #4

Hi Kevin,

That’s corerct with auto-subscription turned on by default. If no auto-subscription is enabled, then a manual subscription is required. See more information here: https://docs.particular.net/nservicebus/messaging/publish-subscribe/controlling-what-is-subscribed.

Not sure I follow this question. If you meant you could also publish a message within a handler that has received another event, then correct.

Sean