it should behave as you described...at first glance, not sure why you are
seeing otherwise...

here is a unit test that I created a while back to validate this...

public class UseOriginalMessageRouteTest extends CamelTestSupport {

        private static final Logger logger =
Logger.getLogger(UseOriginalMessageRouteTest.class.getName());

        protected CamelContext createCamelContext() throws Exception {
                CamelContext camelContext = super.createCamelContext();
                String url =
"vm://test-broker?broker.persistent=false&broker.useJmx=false";
                ConnectionFactory connectionFactory = new 
ActiveMQConnectionFactory(url);
                camelContext.addComponent("activemq",
JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
                return camelContext;
        }

        @EndpointInject(uri = "mock:mock")
        protected MockEndpoint mock;
        
        @Test
        public void testAMQWithBean() throws Exception {
                mock.setExpectedMessageCount(1);
                mock.expectedBodiesReceived("message");
                template.sendBody("activemq:queue:order", "message");
                Thread.sleep(100);
                mock.assertIsSatisfied();
        }

        @Override
        protected RouteBuilder createRouteBuilder() throws Exception {
                return new RouteBuilder() {
                        @Override
                        public void configure() throws Exception {

                ErrorHandlerBuilder eh =
deadLetterChannel("direct:mock").maximumRedeliveries(2).redeliveryDelay(0).logStackTrace(false).useOriginalMessage();

                                from("activemq:queue:order")
                                        .errorHandler(eh)
                                        .log("request ${body}")
                                        .bean(ValidateOrder.class)
                                        .bean(TransformOrder.class)
                                        .throwException(new Exception("error"));

                                from("direct:mock").log("mock 
${body}").to("mock:mock");
                        }
                };
        }

        public static class ValidateOrder {
                public String process(String body) {
                        return body + ":validated";
                }
        }

        public static class TransformOrder {
                public String process(String body) {
                        return body + ":tranformed";
                }
        }
}


devram wrote:
> 
> Let's say an exception occurs at the Persister step, what ends up
> happening is the POJO that was passed in to the Persister step is picked
> up by the deadLetterHandler instead of the xml message which I want.  How
> can I configure my route to pass the original xml message received from
> the jms end point to the deadletterhandler when exceptions occur?  Based
> on what I've read in the CamelInAction Book (chapter 5), Wiki page
> (DeadLetterChannel & Error Handling section) & on this site; it would seem
> all I needed to do was set useOriginalMessage to true, but that didn't
> work...any help would be appreciated.
> 


-----
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: 
http://camel.465427.n5.nabble.com/DeadLetterChannel-useOriginalMessage-Behaviour-tp4728373p4729251.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to