camel-users mailing list archives

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

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 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);

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


View this message in context:
Sent from the Camel - Users (activemq) mailing list archive at

View raw message