NServiceBus Endpoint Auto-recovery following Critical error shutdown

nservicebus

#1

I have a self hosting deployment of NServiceBus 6.2, and during a criticalErrorAction where the endpoint is stopped, I would like to attempt to restart the endpoint after a specific amount of time.

An example of this idea of auto recovery, may be if the transport database was inaccessible for an amount of time due to a server restart.

I do not have the option of restarting IIS in order to re-start the endpoints, if the rest of the system is stable.
There appears there is not a method to restart an endpoint instance, so could you advise on the best way to wait for the critical error’ing endpoint to stop completely and then create a new endpoint which, if successfully starts, will take over from the stopped endpoint?

Eventually I would like to have an increasing retry limit (similar to delayed retries for messages) which will attempt to start an endpoint N times, then eventually resort to logging or emailing to inform the endpoint could not be recovered.


(Ramon Smits) #2

Would it be possible to run your endpoints as windows services? Then they are isolated and can easily be restarted. You can also make use of windows service recovery.

The following guidance explains how you can create a self-hosted windows service, how you can install this service, and how to configure recovery options.