Pause Endpoint Message Processing

Is it possible to pause message processing for an endpoint? My application takes messages from an MSMQ transport and then sends messages through SMPP, to an XMPP server, etc. When those connections go down, I would like to stop processing messages until the connection is reestablished and then continue processing messages.

In NServiceBus 3 we were able to change the number of workers on a transport to 0 to stop processing but I do not see anything like that in NSeviceBus 8. What is the best way to accomplish this?

There’s Message Throughput Throttling, but it will not allow concurrency less than 1 (documentation doesn’t call that out).

Limiting to one is not going to work because processing needs to stop all together because the messages will not be able to be processed. Also I was under the impression that LimitMessageProcessingConcurrencyTo was only available when the endpoint is created and does not change after the endpoint has started.

Yes, you’re correct.

I never had to stop the processing using NSB. Usually, it would be hosted by the host, such as Azure Functions, where the host can scale to zero. So, I’m assuming this might be an on-premises scenario where the endpoint needs to control the scale/processing, and I’m not sure if that’s possible OOTB. I’ll let more knowledgeable folks chime in.


The “stop the whole service” approach doesn’t work if nServiceBus is being used to send messages out using a CONNECTED protocol, for example XMPP/SMPP/MQTT. When our existing nServiceBus code starts up today, we have the initial number of worker threads set at zero, and a small state machine in the code does the following:

@Bill_Matson something is missing in your reply.