Whenever you talk about automatic retries in a messaging environment, you must invariably consider poison messages. A poison message is a message that cannot be immediately resolved by a retry because it will consistently result in an error.
A deadlock is a transient error. We can reasonably expect deadlocks and other transient errors to resolve by themselves without any intervention.
Poison messages, on the other hand, cannot resolve themselves. Sometimes, this is because of an extended outage. At other times, it is purely our fault—an exception we didn't catch or an input condition we didn't foresee.
If we retry poison messages in perpetuity, they will create a blockage in our incoming queue of messages. They will retry over and over, and valid messages will get stuck behind them, unable to make it through.
For this reason, we must set a reasonable limit on retries, and after failing too many times, poison messages must be removed from the processing...