Hi Dont throw an exception again while handling the exception in doCatch. But instead you can send the message direct to the DLQ. And also dont make your error handling to complex.
On Wed, Apr 22, 2020 at 2:37 PM Gerald Kallas <catsh...@mailbox.org> wrote: > > Hi all, > > I've following route. The doCatch should do some specific stuff in case of an > error, followed by a general execption thrown for hitting the error handler. > > I'd expect that in case of an error the message would be sent to the DLQ but > this doesn't happen. > > What I'm doing wrong here? Tx for any hints. > > Best > - Gerald > > <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" > > xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 > https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> > > <bean id="redeliveryPolicyConfig" > class="org.apache.camel.processor.errorhandler.RedeliveryPolicy"> > <property name="maximumRedeliveries" value="3"/> > <property name="redeliveryDelay" value="5000"/> > </bean> > > <bean id="deadLetterErrorHandler" > class="org.apache.camel.builder.DeadLetterChannelBuilder"> > <property name="deadLetterUri" value="jms:queue:DLQ"/> > <property name="redeliveryPolicy" > ref="redeliveryPolicyConfig"/> > </bean> > > <camelContext> > > <route> > <from uri="jms:queue:TEST" > errorHandlerRef="deadLetterErrorHandler" /> > > <doTry> > > <to uri="https://someFailureEndpoint" /> > > <doCatch> > > > <exception>java.lang.Exception</exception> > ... > > <throwException > exceptionType="java.lang.Exception" message="Exception captured."/> > </doCatch> > > <doFinally> > </doFinally> > > </doTry> > </route> > > </camelContext> > > </blueprint> -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2