NServiceBus Retry Delay
Asked Answered
A

3

6

What is the optimal way to configure/code NServiceBus to delay retrying messages?

In its default configuration retry happens almost immediately up to the number of attempts defined in the configuration file. I'd ideally like to retry again after an hour, etc.

Also, how does HandleCurrentMessageLater() work? What does the Later aspect refer to?

Alfonso answered 16/2, 2010 at 4:43 Comment(0)
L
6

The NSB retries is there to remedy temporary problems like deadlocks etc. Longer retries is better handled by creating another process that monitors the error queue and puts them back into to the source queue at the interval you like. Take a look at the ReturnToSourceQueue.exe that comes with NSB for reference.

Edit: NServiceBus now supports this , we call it Second Level Retries, see http://docs.particular.net/ for more details

Lil answered 4/3, 2010 at 17:7 Comment(1)
This answer was posted some time ago there is now NSB support for this built in. See the answer of @SDShooter for more details.Ger
R
4

Here is a blog post on why NServiceBus doesn't include a retry delay that I wrote after asking Udi this very same question in his distributed systems architecture course:

NServiceBus Retries: Why no back-off delay?

And here is a discussion thread covering some of the points involved in building an error queue monitor/retry endpoint:

http://tech.groups.yahoo.com/group/nservicebus/message/10964

As far as HandleCurrentMessageLater(), all that does is puts the current message back at the end of the queue. If there are no other messages waiting, it's going to be processed again immediately.

Renowned answered 30/7, 2011 at 20:16 Comment(0)
A
4

As of NServiceBus 3.2.1, they provide an out of the box solution to handle back off delays in the event of consecutive message failures. The previously existing retry mechanism still retries failures without a delay to handle cases like Database deadlocks, quickly self healing network issues, etc.

Once a message has been retried the configured number of times, the message is moved to a "Second Level Retry" queue. This queue, as configured below, will retry after a 10, 20, and 30 second delay, then the message will be moved to the configured error queue. You're free to change these values to something that better suites your environment.

You can also check out this link: http://docs.particular.net/nservicebus/second-level-retries

Arola answered 5/6, 2012 at 21:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.