Is there a way to start multiple instance of the the message handle in NServiceBus

679 views Asked by At

I have a MyMessageHandler which is managed by NServiceBus host process. The handle stores the message in the database.

Is there a way to tell NServiceBus host process to start multiple instance of MyMessageHandler process/task in parallel so we can increase message throughput.

public class MyMessageHandler : IHandleMessages<MyMessage>
{
    public void Handle(MyMessage message)
    {
       // Sync call store message into the database           
    }
}

The answer is here NServicebus - One endpoint multiple handlers threading

1

There are 1 answers

0
jinskeep On

One solution to this would be to utilize the configurable MaximumConcurrencyLevel setting. Documentation from NServiceBus for this feature is located here: http://docs.particular.net/nservicebus/msmq/transportconfig#configuration-failure-handling-amp-throttling

The default value is 1. If you change the MaximumConcurrencyLevel to 5, NServiceBus will simultaneously execute your handler 5 times and wrap each instance in it's own DTC to handle failures / successes separately.