camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Not move file on custom exception thown (file component)
Date Tue, 22 Mar 2016 12:05:43 GMT
On Tue, Mar 22, 2016 at 1:00 PM, fxthomas <felix.thomas@gmail.com> wrote:
> hello,
>
>   I have a below route configuration, my problem is that I don't want camel
> to move the file to error Or complete folder incase i throw a custom
> exception while processing . But currently it moves the file to complete or
> error if I handle the exception true/false. Is there a way to make camel
> leave the file as it is in the same folder.  I am stopping the route for the
> exception "com.exception.FileSequenceException" which works but the file
> gets moved, which i want to avoid in this special scenario.
>

Why do you want that? If the file is leave as-is then its picked up on
next poll and you end up throwing the same exception over and over
again.



>
> <route routePolicyRef="routePolicy"
> shutdownRunningTask="CompleteCurrentTaskOnly" id="ProcessCSVToDB">
>     <from
> uri="file:///C:\FS\auth\processing\?readLock=changed&amp;readLockTimeout=10000&amp;include=.*xml&amp;moveFailed=C:\FS\auth\error\&amp;move=C:\FS\auth\complete\&amp;charset=utf-8&amp;sendEmptyMessageWhenIdle=true&amp;sorter=#customFileSorter"/>
>         <onException>
>                 <exception>com.exception.ErrorThresHoldException</exception>
>                 <exception>com.exception.InvalidFileException</exception>
>                 <handled><constant>false</constant></handled>
>         </onException>
>         <onException>
>             <exception>com.exception.FileSequenceException</exception>
>                 <handled><constant>true</constant></handled>
>                 <process ref="stopRouteProcessor"/>
>         </onException>
>         <onException>
>                 <exception>java.lang.Exception</exception>
>                 <handled><constant>false</constant></handled>
>                 <process ref="stopRouteProcessor"/>
>         </onException>
>         <choice>
>                 <when>
>                 <simple>${body} != null</simple>
>                 <to
> uri="bean:processorBean?method=processFileMessage(${body},'databasebean')"/>
>                 </when>
>                 <otherwise>
>                          <process ref="stopRouteProcessor"/>
>                 </otherwise>
>         </choice>
>   </route>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Not-move-file-on-custom-exception-thown-file-component-tp5779476.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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

Mime
View raw message