Studying rebus handlers and terminating rebus when receiving new messages

I have a web application that uses Rebus with Azure service bus queues as a transport. It is configured using the Simple Injector container.

During the removal of the application, I want the rebus not to accept new messages and not to check the number of messages being processed at the moment. Then I can wait a few seconds for the handler to finish.

Is this achievable?

EDIT: I am aware of the existence of the SetWorkerShutdownTimeout and Advanced.Workers.SetNumberOfWorkers methods. Can I achieve what I was aiming for by calling Advanced.Workers.SetNumberOfWorkers (0)?

+4
source share
1 answer

, .

( , , , , , ), , , 30 .

.

, , Advanced.Workers.SetNumberOfWorkers(0)?

:)

bus.Advanced.Workers.SetNumberOfWorkers(0);

, .

, SimpleInjector , , .

+2

Source: https://habr.com/ru/post/1690427/


All Articles