[ https://issues.apache.org/jira/browse/CAMEL-3989?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13044817#comment-13044817 ]
Claus Ibsen commented on CAMEL-3989: ------------------------------------ Okay this ticket is in fact invalid. The source code is correct. When you do {code:xml} <onException> <exception>org.apache.camel.MyException</exception> <handled><constant>false</constant></handled> </onException> {code} Its a bit unusual behavior and we may have to throw some error on startup stating this is a mis-configuration. You cannot have <handled> without any child outputs. So you have to add some logic what to do: {code:xml} <onException> <exception>org.apache.camel.MyException</exception> <handled><constant>false</constant></handled> <log message="Damn something went wrong, and I will just fail"/> </onException> {code} However the <onException> can also be used to have per exception specific redelivery policy, for example. You may have a a DLC error handler with a pre configured redelivery policy: {code:xml} <errorHandler type="DeadLetterChannel" id="myDLC" deadLetterUri="mock:dead"> <redeliveryPolicy maximumRedeliveries="5" redeliveryDelay="1000" useCollisionAvoidance="true"/> </errorHandler> {code} And then in case of a special MyException we want to use a different redelivery policy, so we can "override" this: {code:xml} <onException> <exception>org.apache.camel.MyException</exception> <redeliveryPolicy maximumRedeliveries="3" redeliveryDelay="5000"/> </onException> {code} So what happens is that the DLC is being used, but in case of a MyException is being thrown it will use the <redeliveryPolicy> settings defined in the <onException> instead of its default (well in fact it does an overlay). So in this example, so even after 3 redelivery attempts, the exchange is exhausted, and is handled by the error handler (the DLC) in this case. So the exchange is moved into the dead letter queue. So what we need to do is to add a check in OnException that it fail on startup if it has been misconfigured. > onException definition ignored when using route/@errorHandlerRef with the xml > dsl > --------------------------------------------------------------------------------- > > Key: CAMEL-3989 > URL: https://issues.apache.org/jira/browse/CAMEL-3989 > Project: Camel > Issue Type: Bug > Components: camel-spring > Affects Versions: 2.7.1 > Reporter: Hadrian Zbarcea > Assignee: Hadrian Zbarcea > Fix For: 2.8.0 > > > When using a route definition like below: > {code} > <camelContext xmlns="http://camel.apache.org/schema/spring"> > <onException> > <exception>org.apache.camel.MyException</exception> > <handled><constant>false</constant></handled> > </onException> > <route errorHandlerRef="errorHandler"> > <from uri="direct:start"/> > [...] > {code} > the onException definition is not propagated to the ref'd DLC and hence it > will be ignored. -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira