I've got a solution, but I'm not sure this is the "correct" way. I created a
Processor that replaces the message body with a wrapper that contains the
original body, the thrown exception and the original destination.
public class DeadLetterDecoratorProcessor implements Processor {
public void process(Exchange exchange) throws Exception {
Message in = exchange.getIn();
Message out = in.copy();
Object body = in.getBody();
DeadLetterWrapper wrapper = new DeadLetterWrapper();
wrapper.setDeadLetter(body);
wrapper.setException((Throwable)
exchange.getProperty("CamelCauseException"));
wrapper.setOriginalDestination((Destination)
in.getHeader("JMSDestination"));
out.setBody(wrapper);
exchange.setOut(out);
}
}
And my configuration that invokes the decorator :
<bean id="deadLetterProcessor"
class="org.apache.camel.processor.CompositeProcessor">
<constructor-arg>
<list>
<ref bean="deadLetterDecorator"/>
<ref bean="deadLetterRecipientList"/>
</list>
</constructor-arg>
</bean>
Any feedback?
--
View this message in context:
http://www.nabble.com/Saving-original-destination-when-sending-to-DLQ-tp20914367s22882p20916756.html
Sent from the Camel - Users mailing list archive at Nabble.com.