Description
Enhancement
Hello,
How do you find idea of making String RepublishMessageRecoverer.prefixedOriginalRoutingKey protected instead of private?
It would make if possible to override prefixedOriginalRoutingKey to send back with different routing key depending on message.
My case is I would like to add custom headers to message that is moved to DLQ (x-dead-letter-exchange) that is associated with a queue.
RejectAndDontRequeueRecoverer would be fine, but I can't add custom headers there.
RepublishMessageRecoverer is good for headers, but it sends back to wrong exchange - I would like to make it behave the same as RejectAndDontRequeueRecoverer about used DLQ/exchange.
Now I will have to override whole recover() with copy paste and write custom private prefixedOriginalRoutingKey.
If prefixedOriginalRoutingKey were protected, it would be sufficient to override it without necessity of copy-paste recover() and other private methods used by it.
I would like to:
@Override
protected String prefixedOriginalRoutingKey(Message message) {
return message.getMessageProperties().getConsumerQueue() + ".dead.letter";
}
Regarding what @garyrussell wrote
but making that method protected won't change the exchange - you can set the errorExchangeName for that (also errorRoutingKey and then the prefix won't be used).
It seems to me that I can't get what I need with errorExchangeName or errorRoutingKey - they are static and I need to compute DLQ dynamically. If it do is possible, please show how could I implement it.
Thanks and Regards.