Hi Christian,
I think it's expected as you use a global onException handler.
So to not have the recursion problem, you should do something like:
from("direct:test")
.onException(Throwable.class)
.to("direct:handle_er")
.end()
.throwException(new RuntimeException())
.to("log:test2");
from("direct:handle_er")
.throwException(new RuntimeException());
On Thu, May 4, 2017 at 5:30 PM Christian Schneider <[email protected]>
wrote:
> I have the routes below. When I send a message to direct:test I get an
> infinite recursion of exceptions.
> The reason is that the onException handler also seems to be called for
> the direct:handle_er that is called when handling the
> first exception. In case such a handler route also throws an exception
> the recursion happens.
>
> Is this expected or a bug?
> If it is not a bug what do we recommend our users to avoid the recursion?
>
> onException(Throwable.class)
> .to("direct:handle_er");
>
> from("direct:test")
> .throwException(new RuntimeException())
> .to("log:test2");
>
> from("direct:handle_er")
> .throwException(new RuntimeException());
>
> See also https://issues.apache.org/jira/browse/CAMEL-11229
>
> Christian
>
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> http://www.talend.com
>
> --
Arnaud Deprez
Software Engineer
Phone: +32 497 23 30 44
Linked'In: https://www.linkedin.com/in/deprezarnaud
Github: https://github.com/arnaud-deprez