I have a Mass Transit Service Bus that is listening to several queues and processing the messages. I would like to somehow pause the processing of new requests and wait for the current requests to complete so that I can run some housekeeping tasks.
A few of my own thoughts:
- I have investigated the service bus
BeforeConsumingMessagehandler and although this would allow me to check for a 'Pause processing' flag in my database, I unsure how I would then actually pause the processing! - We are using RabbitMQ - could I use this to put the queues in a suspend state?
- I have found so little on this subject that I wonder if it is an 'anti-pattern' and I should just stop my Mass Transit services if I want to run some housekeeping jobs and trust in any partially complete sagas to be picked up when the service bus starts back up. (Rather not go for this option, though).
So my question is: Is there a way to instruct the service bus to finish processing the current sagas but do not take any more messages from the queue?