[ 
https://issues.apache.org/jira/browse/CAMEL-25554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen resolved CAMEL-25554.
---------------------------------
    Resolution: Fixed

Fixed by https://github.com/apache/camel/pull/27745 (merged to main as 
1d86b6a03e10, 4.24.0).

_Claude Code on behalf of Claus Ibsen_

> camel-core - on-demand route reload drops routes created from templatedRoute
> ----------------------------------------------------------------------------
>
>                 Key: CAMEL-25554
>                 URL: https://issues.apache.org/jira/browse/CAMEL-25554
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 4.22.1
>         Environment: Camel JBang 4.22.1, Java 25.0.4, macOS
>            Reporter: Serdar Gökay
>            Assignee: Claus Ibsen
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> A YAML file with a {{routeTemplate}} and {{templatedRoute}} entries starts 
> all its routes, but after an on-demand reload only the plain routes are back. 
> The templated routes are gone, the reload counts as succeeded and nothing is 
> logged.
> h3. Reproduction
> {{code/routes.camel.yaml}}:
> {noformat}
> - route:
>     id: plain
>     from:
>       uri: timer:plain
>       parameters: { period: 2000 }
>       steps:
>         - log: plain
> - routeTemplate:
>     id: tick
>     parameters:
>       - name: name
>     route:
>       from:
>         uri: timer:{{name}}
>         parameters: { period: 2000 }
>         steps:
>           - log: "templated {{name}}"
> - templatedRoute:
>     routeTemplateRef: tick
>     routeId: tick-a
>     parameters: [ { name: name, value: a } ]
> - templatedRoute:
>     routeTemplateRef: tick
>     routeId: tick-b
>     parameters: [ { name: name, value: b } ]
> {noformat}
> {noformat}
> camel run --source-dir=code --console
> {noformat}
> # Startup logs {{Routes startup (total:3 templates:2)}}; plain, templated a 
> and templated b are logged.
> # Change the log text of the plain route and save.
> # Trigger the reload: {{curl 
> "localhost:8080/q/dev/reload?reload=true&wait=true"}}
> Result: {{Status: Reload success}} and {{Routes reloaded summary (total:1 
> started:1)}}. Only {{plain}} runs; {{tick-a}} and {{tick-b}} are no longer in 
> the route list. The reload strategy reports no error.
> The same happens with a plain {{DefaultCamelContext}}, a 
> {{RouteOnDemandReloadStrategy(dir, true)}} with pattern {{*}} (as KameletMain 
> configures it) and {{onReload("test")}}: three routes before, only {{plain}} 
> after.
> h3. Observation
> {{RouteWatcherReloadStrategy.onRouteReload}} removes all routes and route 
> templates, then calls {{RoutesLoader.updateRoutes}}, which calls 
> {{RouteBuilder.updateRoutesToCamelContext}}. That method populates beans, 
> rests, transformers, validators and route templates and updates the routes, 
> but it does not populate the templated routes. On startup 
> {{addTemplatedRoutesToCamelContext}} calls {{populateTemplatedRoutes}}. 
> {{RouteBuilder}} is unchanged on main, so main appears to behave the same; I 
> have only run 4.22.1.
> A possible change is to call {{populateTemplatedRoutes(context)}} in 
> {{updateRoutesToCamelContext}} after the routes are updated and to add the 
> created route ids to the returned set, so they are started and listed in the 
> reload summary.



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

Reply via email to