You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Dragisa Krsmanovic <dk...@plos.org> on 2009/12/11 23:21:33 UTC

Not possible to use onException and doTry()... doFinally() ?

In this route, although message, correctly, does not get to mock:end, it
does not seem to go to mock:error either.

from("seda:start")
    .onException(Exception.class)
      .handled(true)
      .redeliveryDelay(10)
      .maximumRedeliveries(2)
      .retryAttemptedLogLevel(LoggingLevel.WARN)
      .retriesExhaustedLogLevel(LoggingLevel.ERROR)
      .to("mock:error")
    .end()
    .doTry()
      .to("bean:throwsException")
    .doFinally()
      .to("mock:finally")
    .end()
    .to("mock:end");

In fact, if I used direct:start instead of seda, I would get the
exception thrown back.

-- 
Dragisa Krsmanovic
Java Developer
Public Library of Science 
http://www.plos.org


--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
This email is confidential to the intended recipient. If you have received it in error, please notify the sender and delete it from your system. Any unauthorized use, disclosure or copying is not permitted. The views or opinions presented are solely those of the sender and do not necessarily represent those of Public Library of Science unless otherwise specifically stated. Please note that neither Public Library of Science nor any of its agents accept any responsibility for any viruses that may be contained in this e-mail or its attachments and it is your responsibility to scan the e-mail and attachments (if any).


Re: Not possible to use onException and doTry()... doFinally() ?

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Dec 11, 2009 at 11:21 PM, Dragisa Krsmanovic
<dk...@plos.org> wrote:
> In this route, although message, correctly, does not get to mock:end, it
> does not seem to go to mock:error either.
>

doTry .. doCatch .. doFinally does NOT use regular error handling.
Its in fact its own little error handler where you let its doCatch
handle that if you like.


> from("seda:start")
>    .onException(Exception.class)
>      .handled(true)
>      .redeliveryDelay(10)
>      .maximumRedeliveries(2)
>      .retryAttemptedLogLevel(LoggingLevel.WARN)
>      .retriesExhaustedLogLevel(LoggingLevel.ERROR)
>      .to("mock:error")
>    .end()
>    .doTry()
>      .to("bean:throwsException")
>    .doFinally()
>      .to("mock:finally")
>    .end()
>    .to("mock:end");
>
> In fact, if I used direct:start instead of seda, I would get the
> exception thrown back.

Yes of course since seda is async (like a mini JMS queue inside) where
as direct is sync (just like a local method call).


>
> --
> Dragisa Krsmanovic
> Java Developer
> Public Library of Science
> http://www.plos.org
>
>
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> This email is confidential to the intended recipient. If you have received it in error, please notify the sender and delete it from your system. Any unauthorized use, disclosure or copying is not permitted. The views or opinions presented are solely those of the sender and do not necessarily represent those of Public Library of Science unless otherwise specifically stated. Please note that neither Public Library of Science nor any of its agents accept any responsibility for any viruses that may be contained in this e-mail or its attachments and it is your responsibility to scan the e-mail and attachments (if any).
>
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus