As per my understanding default value for maxDeliveryAttempts is 5?
Even after explicitly setting the value of 5 at times I've observed retry to exceed 5 ( upto > 10 recently).
Configurations are
SetNumberOfWorkers:5,SetMaxParallelism: 10, SimpleRetryStrategy(maxDeliveryAttempts: 5, secondLevelRetriesEnabled: true),
Within handler, if we are unable to process the message as a best-suggested practice should I explicitly throw an exception, return null or just let the exception propagate ( at the moment I catch the exception log and rethrow same) - can this impact the behaviour?
I've also implemented IHandleMessages> to do some house keeping. Note: using rebus with rabbitmq
First off, "best practice" with Rebus is to let exceptions bubble out of the handler and let Rebus do the logging. It will log each failed processing attempt as a WARNING, and then it will log all of the caught exceptions as an
AggregateException
as an ERROR when moving the message to the error queue.Unless you enable 2nd level retries :) in that case, Rebus will proceed on to a second round of deliveries after the initial 5 WARNINGs, only dispatching the message as an
IFailed<TMessage>
.If the subsequent five delivery attempts also fail (e.g. because there's no handler that implements
IHandleMessages<IFailed<YourMessage>>
), then you will get an additional 5 WARNINGs in the log, followed by an ERROR, when the message finally gets moved to the error queue.I hope that makes it clearer :) let me know if there's something I should explain in more detail.