camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From martin11 <>
Subject adviceWith() does not start merged route
Date Wed, 05 Dec 2012 16:16:56 GMT

I`m using Camel ver. 2.10.1 and my route is not started when I use
AdviceWith within RouteBuilder.

Here is my context:

<bean id="routeBuilder" class="my.test.RouteBuilder"/>
<camel:camelContext id="myContext">
    <camel:routeBuilder ref="routeBuilder" />

    <camel:route id="route1">
        <camel:to uri="direct:route2"/>

    <camel:route id="route2">
        // some CXFRS calls...

and route builder java code:
public class RouteBuilder extends org.apache.camel.builder.RouteBuilder {

    private static final String DEVEL_PROPERTY = "env";
    private static final String DEVEL_VALALUE = "devel";

    public void configure() throws Exception {
        String property = System.getProperty(DEVEL_PROPERTY);
        if (property != null && property.matches(DEVEL_VALALUE)) {
            getContext().addStartupListener(new StartupListener() {
                public void onCamelContextStarted(CamelContext context,
boolean alreadyStarted) throws Exception {
                    Route route = context.getRoute("route2");
                    if (route != null) {
                        RouteDefinition routeDefinition =
context, new AdviceWithRouteBuilder() {
                            public void configure() throws Exception {
                    } else {
                        log.warn("Missing route 'route1' in context");

Problem is in method adviceWith() (where I add interceptSendToEndpoint()).
At the end of method adviceWith() should be  merged route restarted.
Unfortunately the route is not started (I get CamelExchangeException: No
consumers available on endpoint...) because
DefaultCamelContext.shouldStartRoutes() return false.
So how can I use adviceWith to start merged route?

Why I need this? Because on development environment I don`t want to send
Exchange message to CXFRS component. Instead of I want only print out
("stream:out") the message.

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

View raw message