geyipeng created CAMEL-19127:
--------------------------------

             Summary: Cannot add route when route is set to not start 
automatically
                 Key: CAMEL-19127
                 URL: https://issues.apache.org/jira/browse/CAMEL-19127
             Project: Camel
          Issue Type: Bug
          Components: came-core
    Affects Versions: 3.20.2
         Environment: win10+jdk17+camel3.20.2
            Reporter: geyipeng


When I want to listen for events dynamically adding routes while the camel is 
running and use ScheduledRoutePolicy to manage the start and stop times of 
routes, I find that when dynamically created routes are set to noAutoStartup, 
this will not work. Here is the sample code:

@Component
public class TestRouteBuilder extends RouteBuilder {
@Override
public void configure() {
from("direct:listenEvent").process(exchange -> getContext().addRoutes(new 
RouteBuilder() {
@Override
public void configure() {
from("direct:" + System.currentTimeMillis()).noAutoStartup().log("${body}");
}
}));
}
}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to