0
votes

I am having trouble to get NServicebus to use more than one thread for processing messages. I have a MessageHandler that is handling the message.

public void Handle(MyCommand message)
{
   Console.Write("Starting to process message");
   Thread.Sleep(2000);
   Console.Write("Finished to process message.");
}

I then add about 1000 messages in the queues and starts the service, each message takes 2 seconds to be processed. In the config I have added

<TransportConfig MaximumConcurrencyLevel="8" MaxRetries="5" MaximumMessageThroughputPerSecond="0" />

I’m using a standard license for this test.

Any suggestions?

2
What version are you using? - Sean Farmar
Are you debugging? (NSB is single threaded at debug time)... (By the way MaximumConcurrencyLevel=8 will reduce the number of threads to 8) If you run the process as a console do you get any warnings? - Sean Farmar

2 Answers

0
votes

In NServiceBus 3.* there's a WorkerThreadCount property of the TransportConfig section. But maybe that's not available in version 4.*

0
votes

Try

<TransportConfig MaximumConcurrencyLevel="5"/>

More details at http://docs.particular.net/nservicebus/operations/tuning