Note that there are some explanatory texts on larger screens.

plurals
  1. POCamel Exception handling doesnt work if exception clause is defined in a separate class
    primarykey
    data
    text
    <p>I am trying to build a application with several camel routes which re use many common routes internally. Hence, I am trying to segregate the routes in several different Route Builder classes and then connecting the routes where needed. </p> <p>For eg, all routes pertaining to sending emails go into a EmailRouteBuilder class and all routes dealing with a particular JMS Queue go into MyQueueRouteBuilder class. I suppose this should be alright since Camel doesnt not distinguish between classes and only looks for routes defininition. </p> <p>In addition, I am also grouping several exception handling routes into a separate ExceptionHandlingRouteBuilder. </p> <p>I am also connecting all the different classes together by defining the camel context in Spring like so - </p> <pre><code>&lt;camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring"&gt; &lt;propertyPlaceholder id="properties" location="classpath:${env}/autoimport.properties"/&gt; &lt;!-- Common Routes --&gt; &lt;routeBuilder ref="emailRouteBuilder" /&gt; &lt;routeBuilder ref="myQueueRouteBuilder" /&gt; &lt;routeBuilder ref="httpRouteBuilder" /&gt; &lt;routeBuilder ref="exceptionsRouteBuilder" /&gt; &lt;routeBuilder ref="customer1RouteBuilder" /&gt; &lt;routeBuilder ref="customer2RouteBuilder" /&gt; &lt;/camelContext&gt; </code></pre> <p>My exceptionsRouteBuilder contains many exception clauses like - </p> <pre><code>onException(ConnectException.class) .routeId("connectExceptionEP") .handled(true) .log("Caught Exception: ") .to("direct:gracefulExit"); .. .. .. </code></pre> <p>However, it looks like there is a problem with the exceptions being defined in another class, or for that matter, defined separately out of the main route definition.</p> <p>I verified this in the logs by looking for the routes being booted ( by routeId ) and also checking when an exception is thrown. </p> <p>Additionally, to further confirm, I took the http Connect Exception handling route and put that directly in the httpRouteBuilder and lo..! , the exception handling now kicks in just fine for this exception.. </p> <p>Am I missing something here to get all exceptions to work while being nicely defined in its own class. ? </p> <p>I am using Apache Camel 2.9.0 , but I verified the same behavior also in 2.8.3. </p> <p>Thanks, Anand</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload