Apache Camel Exception Block not executed after calling a Custom component

87 views Asked by At

We are using Apache Camel 3.14.x.

In our Camel Route we have defined a ExceptionBlock like this;

<camel:route id="abc">
    <camel:from uri="direct://started" />
        <camel:onException>
            <camel:exception>java.lang.Exception</camel:exception>
            <camel:handled>
                <camel:constant>true</camel:constant>
            </camel:handled>
            <camel:setProperty id="123">
                <camel:constant>false</camel:constant>
            </camel:setProperty>
        </camel:onException>
        <camel:to uri="component://xyz"/>
</camel:route>
<camel:route id="abc">
    <camel:from uri="direct://xyz" />
        <!-- An Exception is thrown -->
</camel:route>

Our Custom Component "component://abc" we dynamically resolve abc and execute a DirectVmProcessor, and call camel route, let us call it route xyz.

While the Route abc is getting called. When an exception occurs in xyz and there is no error handler in xyz, then we expect the onException block in route abc to catch the exception.

Summarising: route starter -> via process direct -> route abc -> via DirectVmProcessor -> route xyz

We have an exception in route xyz, but no exception block is defined in xyz. We have an exception block in route abc, and we expect this exception block to catch the exception in route abc. But DefaultErrorHandler picks up the exception and logs.

Additional Information: We are migrating from Camel 2x to Camel 3x. Virtually Identical route set up in Camel 2x works as expected, but not in Camel 3x.

We are looking for information on:

  1. When the DefaultErrorHandler will get called, even though an Exception block is defined for "Exception.class"
  2. What could be the changes from Camel 2x to Camel 3x could be influencing such a behaviour.
  3. Which Camel class to set up debug points to check if we have missed something.

We tried to debug the Camel Code, but it is too big and we do not know where and what to look for.

0

There are 0 answers