camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From christian_seufert <christian.seuf...@icw.de>
Subject Proxying of RouteBuilder causes problem through CamelConextFactoryBean
Date Sun, 05 Apr 2009 10:30:16 GMT

Hi, 
first of all I want to say that Apache Camel is a great product...

Now, here is my question: We are using in our application a special
mechanism for modularization that requires that all Spring beans have to be
exported with an interface and are proxied. Since the only interface we can
use for the RouteBuilder class is org.apache.camel.routes we are faced with
the problem that when the CamelContextFactoryBean tries to install the
routeBuilders (installRoutes method) it is looking only for RouteBuilder
instances in the Spring context:
 
if (builderRefs != null) {
            for (RouteBuilderRef builderRef : builderRefs) {
                CamelContextHelper.lookup(camelContext, ref,
RouteBuilder.class);
                RouteBuilder builder =
builderRef.createRouteBuilder(getContext());
                getContext().addRoutes(builder);
            }
  
But our routebuilder beans are proxied by the Routes interface so that there
is a Classcast problem. The solution for this problem was to look for Routes
instances instead of RouteBuilder instances:

if (builderRefs != null) {
            for (RouteBuilderRef builderRef : builderRefs) {
                Routes routes =
CamelContextHelper.lookup(context,builderRef.getRef(), Routes.class);
                getContext().addRoutes(routes);
            }
        }

This workaround is working fine, so my question is if it wouldn't be more
appropriate to look for Routes instances?

Cheers,
christian


-- 
View this message in context: http://www.nabble.com/Proxying-of-RouteBuilder-causes-problem-through-CamelConextFactoryBean-tp22892487p22892487.html
Sent from the Camel - Users (activemq) mailing list archive at Nabble.com.


Mime
View raw message