You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ptatTransamerica <pr...@gmail.com> on 2016/09/23 20:45:24 UTC

Loop should continue after exception caught.

Hi,

I am looking for the option to continue the loop after catching the
exception in the route.
e.g 

<loop>
  <simple>${body.size} </simple>
  <doTry>
        .....calling some service which can produce exception.
  <doCatch>
    <exception>java.lang.Exception</exception>
   <log message="Excetpion occured - ${exception.message}"/>
     ....after catching the exception, I need to continue the loop here.
 </doCatch>
</doTry>

Any information is appreciated.

Thanks



--
View this message in context: http://camel.465427.n5.nabble.com/Loop-should-continue-after-exception-caught-tp5787979.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Loop should continue after exception caught.

Posted by ptatTransamerica <pr...@gmail.com>.
It was breaking the loop. But I found a bug in my code that resolved the
issue. However, that was useful tip. 
Thank you for your time :).



--
View this message in context: http://camel.465427.n5.nabble.com/Loop-should-continue-after-exception-caught-tp5787979p5788163.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Loop should continue after exception caught.

Posted by DariusX <da...@gmail.com>.
Do you find it is always breaking out of the loop or never breaking out? 
When I try the following code, the loop continues after being caught, unless
I set the "CamelRouteStop" property, as shown below.

        from("direct:loopTest")
        .loop(simple("${body.size}"))
        .doTry()
           .process(new Processor1())
           .to("log:LogPoint1")
        .doCatch(Exception.class)
          .setProperty("CamelRouteStop", constant(Boolean.TRUE))
          .to("log:exception")
        .endDoTry();




--
View this message in context: http://camel.465427.n5.nabble.com/Loop-should-continue-after-exception-caught-tp5787979p5788159.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Loop should continue after exception caught.

Posted by ptatTransamerica <pr...@gmail.com>.
Hi Ibsen,

I see a case here that you responded earlier.

http://stackoverflow.com/questions/31312281/apache-camel-loop-does-not-stop-on-exception
https://issues.apache.org/jira/browse/CAMEL-8945

So, can't I continue after catching the exception in loop?

In my case, after catching the exception, I need to decide to break or
continue the loop. 

Please help.



--
View this message in context: http://camel.465427.n5.nabble.com/Loop-should-continue-after-exception-caught-tp5787979p5788137.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Loop should continue after exception caught.

Posted by ptatTransamerica <pr...@gmail.com>.
Yes, I use 2.17.3.



--
View this message in context: http://camel.465427.n5.nabble.com/Loop-should-continue-after-exception-caught-tp5787979p5788064.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Loop should continue after exception caught.

Posted by Claus Ibsen <cl...@gmail.com>.
What version of Camel do you use? And have you tried upgrading and use latest?

On Fri, Sep 23, 2016 at 10:45 PM, ptatTransamerica <pr...@gmail.com> wrote:
> Hi,
>
> I am looking for the option to continue the loop after catching the
> exception in the route.
> e.g
>
> <loop>
>   <simple>${body.size} </simple>
>   <doTry>
>         .....calling some service which can produce exception.
>   <doCatch>
>     <exception>java.lang.Exception</exception>
>    <log message="Excetpion occured - ${exception.message}"/>
>      ....after catching the exception, I need to continue the loop here.
>  </doCatch>
> </doTry>
>
> Any information is appreciated.
>
> Thanks
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Loop-should-continue-after-exception-caught-tp5787979.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