-
Notifications
You must be signed in to change notification settings - Fork 14
Description
There is currently no way to run installers and endpoint setup (e.g. Endpoint.Create(...)
) when using the generic host. The endpoint can only be fully started which might not be a good idea when running installers with special privileges. Additionally, the externally managed container mode used for the generic host doesn't have any ability to run installers separately.
With NServiceBus 8.1, a new Installer API is available to run installers without starting the endpoint. This is also supported for externally managed container mode and can therefore be fully compatibility with the generic host.
But since the endpoint startup APIs aren't directly exposed to user but used by the generic host integration, the generic host needs to provide some way to let users specify that only installation should happen.
This could be done via specific configuration options that can switch between endpoint startup and endpoint installation behavior. This spike shows an example implementation on how to make this work. Using this spike, installers can be run via dotnet run MyEndpoint --nservicebus install
or MyEndpoint.exe --nservicebus install
.
One limitation to consider are scenarios where additional components are hosted with the host (e.g. asp.net applications, custom hosted services) which can't be directly influenced and need to support cancellation during hosted service startup to avoid being run during installation.