[ 
https://issues.apache.org/jira/browse/CAMEL-19127?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17698261#comment-17698261
 ] 

Andrea Cosentino commented on CAMEL-19127:
------------------------------------------

Please don't change the priority. This is not a critical issue and it's not a 
blocker one.

> 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+springboot2.7.8
>            Reporter: geyipeng
>            Priority: Minor
>
> 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:
> import org.apache.camel.builder.RouteBuilder;
> import org.apache.camel.routepolicy.quartz.SimpleScheduledRoutePolicy;
> import org.springframework.stereotype.Component;
> import java.util.Date;
> @Component
> public class TestRouteBuilder extends RouteBuilder {
>     @Override
>     public void configure() {
>         from("direct:listenEvent").process(exchange -> 
> getContext().addRoutes(new RouteBuilder() {
>             @Override
>             public void configure() {
>                 SimpleScheduledRoutePolicy simpleScheduledRoutePolicy = new 
> SimpleScheduledRoutePolicy();
>                 simpleScheduledRoutePolicy.setRouteStartDate(new 
> Date(System.currentTimeMillis() + 5000));
>                 from("direct:" + 
> System.currentTimeMillis()).routePolicy(simpleScheduledRoutePolicy).noAutoStartup().log("${body}");
>             }
>         }));
>     }
> }



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

Reply via email to