I understand the let NServiceBus handles the error and let it retry or use the second level of retries this are valid for some unknown error within the applicaiton.
For example let say it the transactionId == null then i dont just want to throw the exception and let NService bus handles it as i know this never gonna pass with any extra attempts. For know exception scenarios what is the best this do?
I am using saga which call the what different endpoints (A,B,C,D). how do you handle the above error scenario in this endpoints as i dont want my saga to be in a hanging state.
If you have an exception (or class of exceptions) that you know no number of retries will help, then you are correct, it is best to fail fast.
let's say you have a handler like this..
And you want to trap & fail fast for div/0...
If you try to run the handler via a unit test, the test will of course blow up and throw an error. If you put a break point in the handler on "crash = 5 / zero", then re-run your project you should see that when NServiceBus tries to redeliver the message, the second-level retries do not occur and your undelivered goes directly to the error queue.