I have a solution that seems to be working.  I have assigned a context
errorHandler and have a deliverypolicy that has a dead letter uri (a route
that dumps to a file), like:

    <camelContext.... errorhandlerRef="errorHandler"/>

    <errorHandler id="errorHandler" type="DeadLetterChannel"
deadLetterUri="direct:dumpToFile" useOriginalMessage="true">
        <redeliveryPolicy maximumRedeliveries="5"....... />
    </errorHandler>

    <route>
       <from:jms:testQueue>
       <transacted>
       <bean:ref=&quot;myBean&quot; method=&quot;sendToWebService&quot;/>
    </route>


When a message fails 5 times (to test I am shutting down the web service, so
there is a connection exception thrown), it is routed to my "dumpToFile"
route.

I'm still using the Spring JmsTransactionManager in my JMS config for the
connection factory because if I don't and camel shuts down during the
retries, the message is lost (pulled off the queue).  

A few questions:

1) My ActiveMQ redeliveryPolicy seems to be getting ignored.  I believe that
the camel error handler is intercepting so that spring/activemq does not see
the rollback.  Does this seem correct?

2) Does anyone see any issues with this approach?

Claus, meant to mention, I never found a JMSRedeliveryCounter.

Thanks again,
-J



--
View this message in context: 
http://camel.465427.n5.nabble.com/Using-Dead-letter-channel-with-ActiveMQ-tp5723865p5727544.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to