The most important configuration setting for NServiceBus is the selection of the message transport. Microsoft Message Queuing (MSMQ) is the default transport and is used throughout this book, but several other transports are currently supported.
Declaring any of the transports when self-hosting follows the same pattern. For example, here is how you would explicitly select MSMQ, although as the default transport, doing so isn't required:
cfg.UseTransport<MsmqTransport>();
The MsmqTransport
type parameter is a class that inherits from NServiceBus.TransportDefinition
. In addition to being the default transport, MSMQ is also built into the NServiceBus core.
Using any of the other transports also requires an additional NuGet package. The full details about the use of each alternative transport are beyond the scope for this book, but we will cover them briefly.