I have a web app that uses Rebus with Azure Service Bus queues as a transport. It is configured with Simple Injector container.
During app disposal I want to stop rebus from accepting new messages and examine number of messages being handled at the moment. I may then decide to wait few seconds to allow handler to finish.
Is this achievable?
EDIT: I know about the existence of SetWorkerShutdownTimeout and Advanced.Workers.SetNumberOfWorkers methods. Could I achieve what I aim by calling Advanced.Workers.SetNumberOfWorkers(0)?