Hello,
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.

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.

In addition, I am also grouping several exception handling routes into a
separate ExceptionHandlingRouteBuilder.

I am also connecting all the different classes together by defining the
camel context in Spring like so -

<camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring
">
        <propertyPlaceholder id="properties"
location="classpath:${env}/autoimport.properties"/>
        <!-- Common Routes -->
        <routeBuilder ref="emailRouteBuilder" />
        <routeBuilder ref="myQueueRouteBuilder" />
      <routeBuilder ref="httpRouteBuilder" />
        <routeBuilder ref="exceptionsRouteBuilder" />
        <routeBuilder ref="customer1RouteBuilder" />
        <routeBuilder ref="customer2RouteBuilder" />

    </camelContext>


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.

I verified this in the logs by looking for the routes being booted ( by
routeId ) and also checking when an exception is thrown.

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..

Am I missing something here to get all exceptions to work while being
nicely defined in its own class. ?

Thanks,
Anand

Reply via email to