1

I have a .Net service that functions as a bridge between RabbitMQ and another service. Messages are received and forwarded; Replies are received and delivered to RabbitMQ. Internally I have some queues for buffering.

I now want to assume more control over the shutdown process of my bridge.

Once the shutdown signal is received, the service should:

  1. Stop subscribing to events from RabbitMQ
  2. Process all events in my queues
  3. shutdown

The challenge is that processing an event in my inbox, may trigger a new reply, which should be put into my outbox and delivered, before shutting down.

The Kestrel problem
Kestrel seems to listen to the IHostApplicationLifetime.ApplicationStopping token, and when this is triggered, it will stop accepting new requests.

I need to override this behaviour, and allow it to continue to process events, while I empty my queues.

I have been unable to find any way to alter the default behaviour of Kestrel.

I am hoping to find some hints, tricks or links to documentation.

Steps sofar
I have looked around the documentation and intellisence for ways to override the default Kestrel behaviour.
I cannot find any options or settings to change this.

I need a way to override or inject my own CancellationToken in Kestrel, so I can control the shutdown process.

2
  • Kestrel is a Web Server framework. It sounds like you're just doing a Windows Service (or whatever OS you run this on). stackoverflow.com/a/75392616/1043380 Commented Oct 29, 2024 at 16:37
  • 1
    Thanks for the comment Gunr2171. Yes, we are in fact doing a Windows Service, using the Host setup, and in this service we register a Kestrel, with the .UseKestrel() extension method. I am not sure what the linked issue has to do with my question thou. Commented Oct 30, 2024 at 8:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.