You cannot do that, but you can track the failures handled attribute
in JMX which we be incremented when you handle that exception.


On Mon, Nov 6, 2017 at 8:22 PM, David Hoffer <dhoff...@gmail.com> wrote:
> I’m having trouble getting the exception behavior I’m looking for.  What I
> expected this to do is when any exception is thrown it will cause this
> route to fail and not do any retries as the docs say that no
> onException retries is the default.
>
> However instead it retries forever as long as the handled constant is
> false.  Only when I set that to true do I get the expected behavior but I
> don’t want to do that because then our Camel JMX tool that monitors all
> routes will report this as a success which is exactly wrong.
>
> I tried added a redeliveryPolicy where maximumRedeliveries=0 and that does
> not help.
>
>
> Specifically the source of the exception that is being thrown is in each of
> the unmarshal beans, e.g. tarGz, tar, etc.
>
>
> <route id="from_OD" autoStartup="{{gp.camel.OD.from.isConfigured}}"
>             <from uri="sftp://{{gp.camel.OD.from.username}}@
> {{gp.camel.OD.from.host}}:{{gp.camel.OD.from.port}}?password={{gp.camel.OD.from.password}}&amp;delete=true&amp;exclusiveReadLockStrategy=#nonBlockingSftpReadLockStrategy&amp;readLockCheckInterval=10000&amp;readLockTimeout=3600000&amp;reconnectDelay=10000&amp;delay=10000"/>
>
>             <convertBodyTo type="byte[]"/>
>
>             <choice>
>                 <when id="tarGz">
>                     <simple>${file:name} regex '.*\.tgz'</simple>
>                     <unmarshal ref="tarGz"/>
>                     <split>
>                         <simple>${header.CamelGroupedExchange}</simple>
>                         <bean ref="routeManager" method="route(*)"/>
>                     </split>
>                 </when>
>                 <when id="tar.gz">
>                     <simple>${file:name} regex '.*\.tar\.gz'</simple>
>
>                     <unmarshal ref="tarGz"/>
>                     <split>
>                         <simple>${header.CamelGroupedExchange}</simple>
>                         <bean ref="routeManager" method="route(*)"/>
>                     </split>
>                 </when>
>                 <when id="tar">
>                     <simple>${file:name} regex '.*\.tar'</simple>
>                     <unmarshal ref="tar"/>
>                     <split>
>                         <simple>${header.CamelGroupedExchange}</simple>
>                         <bean ref="routeManager" method="route(*)"/>
>                     </split>
>                 </when>
>                 <when id="gz">
>                     <simple>${file:name} regex '.*\.gz'</simple>
>                     <unmarshal ref="gz"/>
>                     <split>
>                         <simple>${header.CamelGroupedExchange}</simple>
>                         <bean ref="routeManager" method="route(*)"/>
>                     </split>
>                 </when>
>                 <when id="zip">
>                     <simple>${file:name} regex '.*\.zip'</simple>
>                     <unmarshal ref="zip"/>
>                     <split>
>                         <simple>${header.CamelGroupedExchange}</simple>
>                         <bean ref="routeManager" method="route(*)"/>
>                     </split>
>                 </when>
>                 <otherwise>
>                     <stop/>
>                 </otherwise>
>             </choice>
>     <onException>
>                 <exception>java.lang.Exception</exception>
> <redeliveryPolicy maximumRedeliveries="0"/>
>                 <handled>
>                     <constant>false</constant>
>                 </handled>
>                 <log loggingLevel="ERROR" message="onException during
> from_OD :  ${exception.message}\n${exception.stacktrace}"/>
> <to
> uri="file://{{gangplank.share_home}}/work/fromOD/.error/?tempFileName=${file:name}.partial"/>
>             </onException>
>         </route>
>
> Any ideas why I get what seems like the opposite of the expected behavior
> and how to fix?
>
> -Dave



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

Reply via email to