views:

37

answers:

1

Hi,

I am having a slight issue with NServiceBus distributor and this probably my own ignorance but this is what's happening -

I have -
a. 2 Workers (Server) processes running on 2 machines
b. 1 Distributor process posting messages to the workers
c. 1 Client process posting messages to the distributor

Now it all works OK, when all servers are up and running.

Say, I now shut down Worker process #1 such that only Worker process #2 is running. I now wait for some time and then start posting messages to distributor, what I notice is that invariably some messages end up being queued to worker process #1 (the process that was shut down).

Now I suppose this happens because before shutting down the server had indicated to the distributor that it was ready and the distributor was responding to these control messages.

My question is that is there a way to gracefully close a worker connected to a distributor informing it that no more messages should be queued to it.

Thanks.

+2  A: 

You can gradually dial down the number of worker threads of a worker node by sending it ChangeNumberOfWorkerThread messages. There is a management tool under the grid directory (i think) that you can use, just need to enter in the distributor queue and each of the worker queues.

Udi Dahan
Ahh...the man himself. Thanks Udi. I did try doing what you suggested, and it doesn't work exactly as I had hoped. The distributor still sends a few messages to the worker whose number of threads is reduced to 0.What I wanted to find out is if there is a 'unsubscribe' message that can be sent from a worker to leave a distributor group so that no more messages are forwarded to it?Thanks.
ilias
If the worker sent the distributor ready messages in the past for which the distributor had not yet sent it messages, then the kind of behavior you experienced will happen. This is because the distributor uses a FIFO queue for holding the list of ready workers.
Udi Dahan