I’m considering a full-duplex scenario where we use async request-response messaging. The client sends a message asking for some work to be done, and we 1) use NServiceBus retry policies to try multiple times if it fails, but 2) if it exhausts the retries, respond with a message indicating failure to the client, instead of dropping the message on the error queue.
There may be some categories of exceptions where we would use the error queue, but is there a way for the handler to know that it’s processing a message that has already been tried x times? This sample seems to do something similar, but relies on an in-memory dictionary to track the retries. I’d prefer to do something like add the retry count to a custom header or something. How might that work?
Or is there a solution I’m not thinking of?