title | summary | reviewed | component | related | redirects | ||
---|---|---|---|---|---|---|---|
Installers |
Installers ensure endpoint-specific artifacts are installed and configured during endpoint startup. |
2023-05-01 |
core |
|
|
Installers ensure that endpoint-specific artifacts (e.g. database tables, queues, directories, etc.) are created and configured.
Installers require permissions to administer resources such as database tables, queues, or directories. Following the principle of least privilege, it is recommended to run an endpoint with these elevated permissions only during initial deployment.
The alternative to using installers is to create the required resources before the endpoint is run. The method of doing this varies for each transport or persistence package. For more information, see operations.
partial: installer-api
NServiceBus detects all events an endpoint handles and auto-subscribes to these events at startup. Automatic subscriptions can be turned off by disabling the auto subscribe feature.
partial: default-behavior
Installers can be enabled to always run at startup:
snippet: Installers
Installers may need to be run depending on the arguments that are provided to the host or aspects the environment the endpoint is hosted in.
For example, installers can be enabled based on command line arguments:
snippet: InstallersRunWhenNecessaryCommandLine
They can also be enabled by a machine name convention:
snippet: InstallersRunWhenNecessaryMachineNameConvention
Note
Some combinations of transports / persisters / DI containers may require .Start
to be called instead of .Create
. In this case call both .Start
and .Stop
and allow the endpoint to shutdown immediately after startup.
Implement the INeedToInstallSomething
interface to create a custom installer:
snippet: InstallSomething
Assemblies in the runtime directory are scanned for installers so no code is needed to register them.