Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable NServiceBus retries completely

Tags:

nservicebus

Is it possible to disable retries in NServiceBus, version 3.2.2?

Using the following configuration, retries can be disabled:

  <MsmqTransportConfig NumberOfWorkerThreads="1"
                       MaxRetries="0" />

  <SecondLevelRetriesConfig Enabled="false"
                            TimeIncrease="00:00:10"
                            NumberOfRetries="0" />

But not when the thread count is set to 20. In this case, the message is retried twice:

  <MsmqTransportConfig NumberOfWorkerThreads="20"
                       MaxRetries="0" />

  <SecondLevelRetriesConfig Enabled="false"
                            TimeIncrease="00:00:10"
                            NumberOfRetries="0" />

This does look a lot like a bug. The retry behaviour should not depend on the number of threads.

like image 402
Thomas Bratt Avatar asked Nov 13 '22 03:11

Thomas Bratt


1 Answers

The semantics of the MaxRetries is "At least X times". The reason for this is performance since we can't be a little more relaxed when it comes to syncronising our threads. You could also make your transport non transactional this will effectively give you one try for each message but you'll lose the error queue as well so failed messages are gone forever.

like image 164
Andreas Öhlund Avatar answered Jan 30 '23 00:01

Andreas Öhlund