Search code examples
c#nservicebusnservicebus4

NServicebus 4.7.6 is not respecting the SecondLevelRetriesConfig Values on app.config


There is no custom configuration in code.

<SecondLevelRetriesConfig Enabled="true" TimeIncrease="00:05:00" NumberOfRetries="10" />

It works based on the default SecondLevelRetriesConfig values not picking up the custom configuration.

Update:

Sorry for not updating the scenario. This Scenario happens when nservicebus worker is having configuration for MasternodeConfig. It does not respect worker node config for second level retries. The timeouts are handled in MasterNode (Distributor).


Solution

  • The behavior of SLR is different between major versions of NServiceBus. Below if a dump of the documentation from http://docs.particular.net/nservicebus/scalability-and-ha/distributor/error-handling

    Please check that link if not using NServiceBus v3, v4 or v5

    NServiceBus v5.x

    The SLR policy NumberOfRetries setting its is applied on both the distributor and workers, and the TimeIncrease setting is applied on the distributor.

    When an error occurs the SLR policy is invoked immediately by the fault manager. The message will not be forwarded to the retries queue which is was the previous behavior.

    When the retry limit is reached the message is forwarded immediately to the error queue or else forwarded to the .retries queue and scheduled for retry. If the SLR policy output is that it needs to be retried then the message is forwarded to the .retries queue.

    NServiceBus v4.x

    The SLR policy is only applied on the distributor for both NumberOfRetries and TimeIncrease settings.

    The distributor has a .retries queue where a message is forwarded to in case of an error. Then the distributor processes this message, when the retry limit has been reached the message will be forwarded to the error queue or else scheduled for retry by the distributor.

    NServiceBus v3.x

    The SLR policy is applied only on the workers for both TimeIncrease and NumberOfRetries settings. If a SLR configuration is available on the distributor then these settings are ignored.

    When an error occurs the worker schedules the retry according to the SLR TimeIncrease setting and when the corresponding timeout is triggered the message is forwarded to the incoming queue of the distributor which will then forward the message to an available worker.