There are several options available to execute custom code as part of the endpoint's startup/shutdown sequence:
- Using the Generic Host lifecycle to run tasks during the application's lifecycle.
- Adding a custom FeatureStartupTask.
The IWantToRunWhenBusStartsAndStops interface is no longer available as part of the NServiceBus package. It has been replaced by IWantToRunWhenEndpointStartsAndStops.