Multiple endpoint NServiceBus service

Hi, I am new to NServiceBus. I have to create a service that can use NServiceBus.Host features and have 2 endpoints, one is reading messages from RabbitMQ transport queue and the other one is reading messages from a MSMQ queue. How would I create such a system? I have read that you can create multiple instances of endpoints, but not with NServiceBus.Host. Where would I handle the creation of the 2 endpoints when I am using NServiceBus.Host features?

Hi Davis

Thanks for reaching out and congratulations for tipping your toes into NServiceBus. I would love to hear a bit your thoughts behind the need of having one endpoint that reads from MSMQ and one that reads from RabbitMQ, could you explain a bit more the use case?

In that use case do you envision those endpoints needing to share some common infrastructure or even “instances” of some infrastructure?

As you already mentioned the NServiceBus.Host is basically meant to host one single endpoint. For more complex hosting scenarios we recommend to use the self-hosting approach. In the future we will even deprecate the host functionality as outlined in https://docs.particular.net/nservicebus/upgrades/host-7to8

As a general guidance unless some deployement or runtime/environment restrictions required you to host multiple endpoints together we would recommend to have a single endpoint per process. As soon as you start co-hosting multiple endpoints together the configuration can become quite tricky because you have to make sure that assembly scanning does pick up the right handlers and infrastructure as outlined in

https://docs.particular.net/samples/hosting/multi-hosting/

On another note. Having a multi transport system is something that is not officially supported. You would need to use the community package called router https://docs.particular.net/nservicebus/router/ and rely on the community to update the package should you have any issues with that.

Regards
Daniel