Skip to content

Automatic retries and error handling

mookid8000 edited this page Oct 8, 2012 · 23 revisions

When Rebus receives a message, it keeps the message's ID in an in-memory dictionary along with a few pieces of information on when the message was received, etc.

It also keeps track of how many times it has seen the message before!

Also, Rebus will always receive the message inside of a TransactionScope (an "ambient transaction"), which ensures that the message will return to the queue if something fails when handling it.

This way, Rebus can see if message delivery has failed a certain number of times (default: 5), and if the same message is received one more time, it will be considered "poisonous", and it will be forwarded to Rebus' error queue.

This way, the message is persisted to be retried at a later time.

How to diagnose what went wrong?

Either you turn to Rebus' log - a full exception will be logged at the WARN level for each delivery attempt, except the last which will be logged as an ERROR.

Moreover, to make it even easier, the full exceptions will also be included in a header inside the message, allowing Rebus Snoop to show you what went wrong.

Clone this wiki locally