Hi

Mind about the DLQ is usually a drop point for the message content,
and as you use a file endpoint, then you can only reply this by having
a route that pickup those files and route back to what its supposed to
do. The actual exception message should still be logged in the log, so
you have a chance to find out why it failed.

Also mind that this requires to be able to reply the message safely,
eg the error may happen half way into a route, and then you replay the
message from DLQ, and then it may re-process some parts it did before
the error (idempotence).

Since your example started from a JMS and a JMS broker has error
handling and delivery, then have you though about using its feature
for that, and not Camels.




On Wed, Apr 22, 2020 at 2:59 PM Gerald Kallas <catsh...@mailbox.org> wrote:
>
> Hi Claus,
>
> tx for the reply.
>
> I already thought about direct send to the DLQ.
>
> When I'm going to use a file consumer with a failure directory configured eg
>
> <from uri="file:/var/casisp/files/prices?include=.*&amp;moveFailed=error/>
>
> the move would be only executed when an exception has been thrown. Do you 
> have any hint on this with the approach as described?
>
> Best
> - Gerald
>
> > Claus Ibsen <claus.ib...@gmail.com> hat am 22. April 2020 14:49 geschrieben:
> >
> >
> > 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



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to