Reputation: 82291
The "retry" system with NServiceBus is great. It works fantastic in making sure small things like dead locks don't mess us up.
However, sometimes I KNOW that a message is bad. Bad in the sense that no amount of retries is going to help.
Is there a way to tell NServiceBus: "This message is a bad apple, move it to the error queue"? (And have it skip the retries?)
Upvotes: 5
Views: 502
Reputation: 6050
If you are using NSB 3, you can take a look at the IManageMessageFailures interface. This will allow you to plug in your functionality, but this is after the message has failed. If you would like to get at the message earlier, then take a look at the Message Mutators feature. This gets you in both at the transport layer and at the application layer.
Upvotes: 3
Reputation: 34183
Would calling Bus.DoNotContinueDispatchingCurrentMessageToHandlers();
inside the handler not be a simpler way of doing this?
Upvotes: 1