developer82
developer82

Reputation: 13713

Get EndPointName in NServiceBus 5

I'm in the process of upgrading my application from NServiceBus 4 to 5.

I have a class that implements IWantToRunWhenBusStartsAndStops and on the Start() method I print out the EndpointName - taking it from NServiceBus.Configure.EndpointName

On NServiceBus 5 it is deprecated and I want to do it correctly. How can I get the EndpointName?

Upvotes: 0

Views: 264

Answers (1)

Mauro Servienti
Mauro Servienti

Reputation: 518

You can use a ReadOnlySetting instance, take a look at the following sample:

class MyClass : IWantToRunWhenBusStartsAndStops
{
    public ReadOnlySettings Settings{ get; set; }

    public void Start()
    {
        var name = this.Settings.EndpointName();
    }

    public void Stop()
    {

    }
}

Where EndpointName() is an extension method provided by NServiceBus in the NServiceBus namespace.

Upvotes: 3

Related Questions