EAI Guy.net

Enterprise Applicaiton Integration and SOA 2.0

Tag Archives: ESB

NServiceBus & Second Level Retries

You may be familiar with how NServiceBus immediately re-tries transactions that fail, and the number of re-tries is configurable. This is handy in situations like when a deadlock is hit – the retry will likely succeed:

Image

You are also probably aware that sometimes it takes a few moments for something else to happen in the system before our transaction will succeed. NSB now has a “second-level retry” feature that kicks in when  immediate retries are used up: NSB waits a configurable interval (10 seconds in the example below), then re-tries the transaction with a fresh set of immediate re-tries. This is incredibly useful in situations where multiple messages are coming in with dependencies on each other (though a Saga would be better here), or in situation where a dependent system is known to go down for a few minutes or hours. This feature could be used to keep error-queue counts down and reduce support burden:

Image

ReturnToSourceQueue.exe

ReturnMessageToErrorQueue is a command-line tool that ships with NServiceBus and returns all messages from an error queue to their source queues.

Unfortunately the directions are sparse, and my first attempt was a flop:
C:\Projects\NServiceBus\tools>ReturnToSourceQueue.exe
Please enter the error queue you would like to use:
.\private$\myNsbApp.error
Please enter the id of the message you'd like to return to its source queue, or 'all' to do so for all messages in the queue.
all

Unhandled Exception: System.Messaging.MessageQueueException: Format name is invalid.
at System.Messaging.MessageQueue.MQCacheableInfo.get_Transactional()
at System.Messaging.MessageQueue.get_Transactional()
at NServiceBus.Tools.Management.Errors.ReturnToSourceQueue.ErrorManager.set_InputQueue(Address value)
at ReturnToSourceQueue.Program.Main(String[] args)

Here is the correct syntax:

C:\Projects\NServiceBus\tools>ReturnToSourceQueue.exe
Please enter the error queue you would like to use:
myNsbApp.error@SERVERNAME
Please enter the id of the message you'd like to return to its source queue, or 'all' to do so for all messages in the queue.
all

Attempting to return message to source queue. Queue: [myNsbApp.error@servername], message id: [all]. Please stand by.
Success.
Success.
Success.

Udi, please update the directions!