You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Stephan Burkard <sb...@gmail.com> on 2013/12/10 16:15:56 UTC

Can "useAdviceWith" raise problems with errorhandling?

Hi Camel users

My Camel is currently a bit wrong-headed and so I am riding down another
path than the one I am expecting.

I have attached a small example project that is based on Camel 2.9.8 and
the problem occurs with errorhandling and adviceWith.

I have a route with a default errorhandler with redelivery configured and
an additional onException block for a specific exception that does no
redeliveries.

Let's start with the working example (see "FullErrorHandlingTest" in
example project):
If I create the route with a "built in" exception (hardcoded in the route)
according to the onException block, the block catches the exception
correctly and does no redelivery. All is fine.

Now the strange behaviour (see "ErrorHandlingAdviceTest" in example
project):
If I create the same route, but omit the last step and instead add this
same last step in the TestCase with "adviceWith", the block does NOT catch
the exception and the default errorhandler does the configured retries.

Therefore the question: is "adviceWith" raising issues with errorhandling?
Or is the strange behaviour due to a mistake I made?

I would like to create automated tests to control the route flow for
different errors.

Thanks for any help
Stephan

Re: Can "useAdviceWith" raise problems with errorhandling?

Posted by Stephan Burkard <sb...@gmail.com>.
OK, I add some probably helpful details I found out about this:

- If I just remove the "isUseAdviceWith()" method that returns true, to
inform Camel about my Advices, the test runs fine.
- If I left the "isUseAdviceWith()" method in place and just start the
Camel context before doing the route manipulations, the test runs fine.

So it seems to be a timing thing...

Regards
Stephan





On Tue, Dec 10, 2013 at 4:15 PM, Stephan Burkard <sb...@gmail.com> wrote:

> Hi Camel users
>
> My Camel is currently a bit wrong-headed and so I am riding down another
> path than the one I am expecting.
>
> I have attached a small example project that is based on Camel 2.9.8 and
> the problem occurs with errorhandling and adviceWith.
>
> I have a route with a default errorhandler with redelivery configured and
> an additional onException block for a specific exception that does no
> redeliveries.
>
> Let's start with the working example (see "FullErrorHandlingTest" in
> example project):
> If I create the route with a "built in" exception (hardcoded in the route)
> according to the onException block, the block catches the exception
> correctly and does no redelivery. All is fine.
>
> Now the strange behaviour (see "ErrorHandlingAdviceTest" in example
> project):
> If I create the same route, but omit the last step and instead add this
> same last step in the TestCase with "adviceWith", the block does NOT catch
> the exception and the default errorhandler does the configured retries.
>
> Therefore the question: is "adviceWith" raising issues with errorhandling?
> Or is the strange behaviour due to a mistake I made?
>
> I would like to create automated tests to control the route flow for
> different errors.
>
> Thanks for any help
> Stephan
>
>
>