One of the key goals for NServiceBus 3.0 is to remove much of the need for configuration and there by improve the out of the box experience. In order to achieve this we have introduced the concept of a EndpointName that will be used to control our naming conventions.

The endpoint name is the name of a individual endpoint and must be unique across your solution. The only exception to this rule is when you are scaling out using the master node concept where the same logical endpoint would reside on many physical servers, more on that in a upcoming post.

Conventions that use the endpoint name

The following conventions use the endpoint name to configure various parts of NServiceBus. Note that the {masternode} will be localhost if not specified.

  • Local address - The local address (input queue) of your endpoint will be the {endpointname}
  • Subscriptions - If you use the Msmq subscription storage the name of the queue used to store the subscribers will be {endpointname}.subscriptions
  • Raven database name - The database name when storing data related to the endpoint will be {endpointname}
  • Timeout manager address - The address of the timeout manager will be {endpointname}.timeouts@{masternode}
  • Gateway input address - The address where the gateway will pickup outgoing messages will be {endpointname}.Gateway@{masternode}
  • Gateway url - If you use the http/https channel the url that the gateway will listen to is defaulted to http(s)://localhost/{endpointname}
  • Distributor input queue - The input queue of the distributor will be {endpointname}@{masternode}
  • Distributor control queue - The control queue of the distributor will be {endpointname}.distributor.control@{masternode}
  • Distributor storage queue - The local storage queue of the distributor will be {endpointname}

How to specify the endpoint name

There are multiple ways that you can define the endpoint name. Lets look at them one by one.

  • If not specified by the user the namespace of the class implementing IConfigureThisEndpoint will be used as the endpoint name when running the NServiceBus host. If your project is called MyServer and the config is in the root this will result in the endpoint name "MyServer". This is the recommended way to name a endpoint.
  • If not specified by the user when custom hosting NServiceBus the namespace of the class calling NServiceBus.Configure.With() will be used. For websites this will likely be the namespace of your global.asax.cs
  • You can set the endpoint name using the [EndpointName] attribute on your endpoint configuration.
  • You can implement the INameThisEndpoint interface on your endpoint config
  • If you specify a explicit service name when installing the NServiceBus host this will be used as endpoint name: /serviceName:""MyEndpoint"
  • You can specify a endpoint name when running the NServiceBus host: /endpointName:""MyEndpoint"
As you can see there is lots of ways to do this. But if all the above is not enough you can define your own convention using:

Upgrading from NServiceBus 2.6

Users upgrading from 2.6 need to name their endpoint to the same name as their current input queue since there is no way to explicitly set the input queue in NServiceBus 3.0

In closing

Naming your endpoint will be a very important thing going forward and the framework will try to push you in that direction by not making it to easy for you to override. This will hope fully help us further improve our "convention over configuration" support make it even easier for you to build, deploy and run NServiceBus in the future.