You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2023/03/09 08:38:00 UTC

[jira] [Commented] (CAMEL-19127) Cannot add route when route is set to not start automatically

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

Claus Ibsen commented on CAMEL-19127:
-------------------------------------

Can you put together a full sample project that demonstrates what you think is a problem. The sample code above is not sufficient

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