I'm trying to upgrade a solution from NServiceBus 5 to 6. Currently, we are injecting IBus to a service class so that the service can send messages to the bus as needed. Now that IBus is no longer available in 6, how do I inject the endpoint instance when the endpoint is created using NServiceBus.Host, which will itself start this endpoint?
There is an example provided at the bottom of https://docs.particular.net/samples/hosting/multi-hosting/:
var endpointConfiguration = new EndpointConfiguration("Samples.MultiHosting.Instance1");
endpointConfiguration.UseSerialization<JsonSerializer>();
endpointConfiguration.EnableInstallers();
endpointConfiguration.UsePersistence<InMemoryPersistence>();
endpointConfiguration.SendFailedMessagesTo("error");
return Endpoint.Start(endpointConfiguration);
However, it is immediately followed by a note indicating "this is possible only when self-hosting and not using NServiceBus.Host."