You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Claus Ibsen <cl...@gmail.com> on 2014/03/09 15:01:14 UTC

Re: Dead letter queue and onException

Hi

This is by design. If onException is triggered then it does it work,
an not the DLC etc.

If you want to do some routing before moving to a DLC, then use a
route as the DLC, and use direct:todlc as endpoints so you route to
your route using direct.

On Wed, Jan 22, 2014 at 8:19 PM, bocamel <jo...@gmail.com> wrote:
> It seems that whenever an error is caught by onException, regardless whether
> handled is set to true or false, the failed message would not be written to
> the dead letter queue.  Here is a sample project to demonstrate this:
>
> <beans xmlns="http://www.springframework.org/schema/beans"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xmlns:camel="http://camel.apache.org/schema/spring"
>        xsi:schemaLocation="
>        http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
>        http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd">
>
>   <bean id="throwException"
> class="com.pci.FileDeadChannel.ThrowExceptionProcessor" />
>
>   <camel:camelContext xmlns="http://camel.apache.org/schema/spring"
> trace="true" handleFault="true" errorHandlerRef="dlc">
>
>                 <camel:errorHandler id="dlc" type="DeadLetterChannel"
> deadLetterUri="file:log/dead">
>                         <camel:redeliveryPolicy maximumRedeliveries="2" redeliveryDelay="5000"
> retryAttemptedLogLevel="WARN"
>                                 logHandled="true"/>
>                 </camel:errorHandler>
>
>                 <camel:onException>
>                         <camel:exception>java.lang.RuntimeException</camel:exception>
>                         <camel:redeliveryPolicy maximumRedeliveries="3" redeliveryDelay="10000"
> />
>                         <camel:handled><camel:constant>false</camel:constant></camel:handled>
>                         <camel:log message="***** onException: ValidationException *****" />
>                 </camel:onException>
>
>     <camel:route>
>       <camel:from uri="file:src/data?noop=true"/>
>       <camel:process ref="throwException" />
>     </camel:route>
>   </camel:camelContext>
>
> </beans>
>
> Is this correct?  Is there a way to add some configuration in the
> onException to still use the dead letter queue?
>
> Thanks!
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Dead-letter-queue-and-onException-tp5746362.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

RE: Dead letter queue and onException

Posted by bocamel <jo...@gmail.com>.
Thank you for the explanation.

 

From: Claus Ibsen-2 [via Camel]
[mailto:ml-node+s465427n5748500h78@n5.nabble.com] 
Sent: Sunday, March 9, 2014 10:02 AM
To: bocamel
Subject: Re: Dead letter queue and onException

 

Hi 

This is by design. If onException is triggered then it does it work, 
an not the DLC etc. 

If you want to do some routing before moving to a DLC, then use a 
route as the DLC, and use direct:todlc as endpoints so you route to 
your route using direct. 

On Wed, Jan 22, 2014 at 8:19 PM, bocamel <[hidden email]> wrote: 


> It seems that whenever an error is caught by onException, regardless
whether 
> handled is set to true or false, the failed message would not be written
to 
> the dead letter queue.  Here is a sample project to demonstrate this: 
> 
> <beans xmlns="http://www.springframework.org/schema/beans" 
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>        xmlns:camel="http://camel.apache.org/schema/spring" 
>        xsi:schemaLocation=" 
>        http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
>        http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd"> 
> 
>   <bean id="throwException" 
> class="com.pci.FileDeadChannel.ThrowExceptionProcessor" /> 
> 
>   <camel:camelContext xmlns="http://camel.apache.org/schema/spring" 
> trace="true" handleFault="true" errorHandlerRef="dlc"> 
> 
>                 <camel:errorHandler id="dlc" type="DeadLetterChannel" 
> deadLetterUri="file:log/dead"> 
>                         <camel:redeliveryPolicy maximumRedeliveries="2"
redeliveryDelay="5000" 
> retryAttemptedLogLevel="WARN" 
>                                 logHandled="true"/> 
>                 </camel:errorHandler> 
> 
>                 <camel:onException> 
>
<camel:exception>java.lang.RuntimeException</camel:exception> 
>                         <camel:redeliveryPolicy maximumRedeliveries="3"
redeliveryDelay="10000" 
> /> 
>
<camel:handled><camel:constant>false</camel:constant></camel:handled> 
>                         <camel:log message="***** onException:
ValidationException *****" /> 
>                 </camel:onException> 
> 
>     <camel:route> 
>       <camel:from uri="file:src/data?noop=true"/> 
>       <camel:process ref="throwException" /> 
>     </camel:route> 
>   </camel:camelContext> 
> 
> </beans> 
> 
> Is this correct?  Is there a way to add some configuration in the 
> onException to still use the dead letter queue? 
> 
> Thanks! 
> 
> 
> 
> -- 
> View this message in context:
http://camel.465427.n5.nabble.com/Dead-letter-queue-and-onException-tp574636
2.html
> Sent from the Camel - Users mailing list archive at Nabble.com. 




-- 
Claus Ibsen 
----------------- 
Red Hat, Inc. 
Email: [hidden email] 
Twitter: davsclaus 
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io



  _____  

If you reply to this email, your message will be added to the discussion
below:

http://camel.465427.n5.nabble.com/Dead-letter-queue-and-onException-tp574636
2p5748500.html 

To unsubscribe from Dead letter queue and onException, click here
<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscrib
e_by_code&node=5746362&code=am9obnp5aW5AZ21haWwuY29tfDU3NDYzNjJ8Mjk3Mjc3MTQ4
> .
 
<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_view
er&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNa
mespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.No
deNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_ema
ils%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> NAML 





--
View this message in context: http://camel.465427.n5.nabble.com/Dead-letter-queue-and-onException-tp5746362p5748555.html
Sent from the Camel - Users mailing list archive at Nabble.com.