Specify Your Input Queue

When using the configuration API

these approaches can also be used from NServiceBus Host via the use of IConfigureThisEndpoint.

You can define your own convention in the endpoint initialization code using this

Configure configure = Configure.With();
// If you need to customize the endpoint name via code using the DefineEndpointName method, 
// it is important to call it first, right after the With() configuration entry point.
configure.DefineEndpointName("MyEndpoint");
BusConfiguration busConfiguration = new BusConfiguration();

busConfiguration.EndpointName("MyEndpoint");

When using the NServiceBus.Host.exe

Namespace convention

When using NServiceBus.Host, the namespace of the class implementing IConfigureThisEndpoint will be used as the endpoint name as the default convention. In the following example the endpoint name when running NServiceBus host becomes MyServer. This is the recommended way to name a endpoint. Also this emphasizes convention over configuration approach.

namespace MyServer
{
    using NServiceBus;

    public class EndpointConfigByNamespace : IConfigureThisEndpoint, AsA_Server
    {
        // ... your custom config

EndpointName attribute

You can set the endpoint name using the [EndpointName] attribute on your endpoint configuration.

This will only work when using NServiceBus host.
[EndpointName("MyEndpointName")]
public class EndpointConfigWithAttribute : IConfigureThisEndpoint, AsA_Server
{
    // ... your custom config

Installation parameter

If you specify a explicit service name when installing the NServiceBus host, this is used as the endpoint name: /serviceName:"MyEndpoint".

Command-line parameter

You can specify a endpoint name when running the NServiceBus host: /endpointName:"MyEndpoint".

Please note you can only use code OR commandline/installation parameters.


Last modified 2015-05-07 05:06:33Z