Physical routing with MSMQ

Component: MSMQ Transport
Standard support for version 5.x of NServiceBus has expired. For more information see our Support Policy.

The MSMQ transport in NServiceBus is a distributed transport in which the MSMQ process runs on each machine, storing messages locally before being forwarded to other machines. In this model, each endpoint connects to the local MSMQ process and both the queue name and the host name must be specified when addressing a different endpoint.

Scaling out

Because the MSMQ queues are not accessible from outside the machine they are hosted in, NServiceBus endpoints using the MSMQ transport are not able to use the competing consumers pattern to scale out with a single shared queue.

The distributor can be used to overcome this limitation.

Physical mapping

The host name of the machine running each endpoint can be specified directly in the message-endpoint mapping configuration section by adding a @machine suffix.

    <section name="UnicastBusConfig"
             type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core"/>
      <add Assembly="Sales.Messages" 
           Endpoint="Sales@VM-1" />
      <add Assembly="Billing.Messages"
           Endpoint="Billing@VM-2" />

When using MSMQ, if there is no @machine suffix, NServiceBus assumes the configured endpoint runs on a local machine.

Related Articles

Last modified