NServiceBus.Extensions.Hosting and delayed startup (and/or errorhandling)

When I am using UseNServiceBus the endpoint startup isn’t controlled by me. Is it possible to delay it, so it doesn’t happen in the short time of my Windows service startup? And/or is it possible to make retries on connection failures?

maybe it is not possible?

Is it possible to delay it, so it doesn’t happen in the short time of my Windows service startup?

Assuming that you want to wait for some infrastructure component to become available you might be able to use the fact that generic host will start its hosted services sequentially and in the order, they have been registered.

Ie create a “CheckThatMyInfrastructureIsAvailable” hosted service, register it first and then have its StartAsync method not return until the infrastructure component have been confirmed to be up.

And/or is it possible to make retries on connection failures?

We only perform retries once the endpoint has successfully started. The idea is that such retries could be done by eg. having the windows service configured to retry startup

Hope this helps!

Cheers,

Andreas