NServicebus Endpoint Stop or not

I am using NServiceBus.7.4.4 with RabbitMQ, running many processes on the same queue (scale-out)

The process is a old monolith, and the shut down logic is messy, fragmented and almost impossible to fix :slight_smile:

The problem is, if I shut down the Endpoint probably, there are still many threads relying on NServicebus, resulting in lots of error logging. I know the best solution is to control the shut down order, but this is not feasible.

Is it OK to skip the Stop() of Endpoint, as the process will end anyway? Or will this result in connection exhaustion or other problems?

AppDomain.CurrentDomain.ProcessExit ? :slight_smile:

Hi @Stig_Christensen,

How is the endpoint currently being hosted?

If the process in which the endpoint is hosted terminates, then the endpoint is killed, which we refer to as a non-graceful shutdown scenario.

As suggested, a better tactic would be to hook into an extension point to stop the endpoint gracefully, by calling Endpoint.Stop(). To offer some guidance, we have a sample in which an endpoint is hosted in a Windows Service, and it shows how the endpoint’s lifecycle is managed.
You can find the sample here: Endpoint configuration choices • NServiceBus Samples • Particular Docs

I hope that helps,
Kind regards,
Laila