I'm trying to understand NServiceBus given the online documentation. What I can't wrap my head around is the overall recommended setup of the infrastructure. Our app is supposed to be able to run both a single machine and across multiple (logically different) sites (n stores-1 headquarter). As for NServiceBus (I am using v5 through NuGet), I don't fully understand the notion of a host and endpoints.
Lets say we have 15 services (order service, item service, etc.).
Do I need 15 clients (15 class library projects with code sending messages over the bus), and 15 servers (one or more receiving messages handler classes that handle service specific messages/commands)? So 30 total.
Should each service use its own separate MSMQ?
For those 15 "server" projects, in a production environment I need to install the NServiceBus.Host 15 times (hence creating 15 Windows service instances). During debugging in VS, the NSerivceBus.Host.exe will be started when you start debugging.
So you effectively "host" only one endpoint for each host/server project. Or can I have a single host and 15 endpoints inside of it?
You can tell I am new to this ESB pattern, so thanks for your input.
You don't need 15 class libraries. NServiceBus can router the messages based on their namespace/type. eg: all namespace messages of "Message.Orders" can be routed to "Orders" queue.
in production possibility.. but it really depends on the volume of messages and the logical grouping/partitioning. in development, I would have one queue for all messages.
again, this is a deployment issue that is dictated by logical partitioning. usually you would have this scripted to handle the installation/un-installation of these services. I have mine in powershell script.
NServiceBus is really flexible on how and when you partition your messages. it is usually done at the configuration level in UAT or Production and outside the development lifecycle. keep in mind, one NServiceBus host == 1 MSMQ
I started with one service first, then start partitioning based on volume/priority messages.
Also, the only reason you would breakdown the messages to 15 classes, if you want to expose these assemblies to external solutions without exposing the other message types.