Hi Use route-id to set id for routes
On Mon, Dec 26, 2022 at 10:38 AM Mikael Koskinen <mijap...@gmail.com> wrote: > Hi, > > I'm testing how the route reload works if one file has multiple > routes. I've defined two routes in a single file and assigned ids to > both: > > - route: > id: firstRoute > from: > uri: "timer:yaml" > parameters: > period: "2000" > steps: > - setBody: > constant: "Hello Camel from yaml timer 30" > - log: "${body}" > > - route: > id: secondRoute > from: > uri: "timer:yaml" > parameters: > period: "3000" > steps: > - setBody: > constant: "Hello Camel from yaml timer this one" > - log: "${body}" > > When I run the routes I can see the ids: > > 2022-12-26 11:28:42.504 INFO 79551 --- [ main] > e.camel.impl.engine.AbstractCamelContext : Started firstRoute > (timer://yaml) > 2022-12-26 11:28:42.504 INFO 79551 --- [ main] > e.camel.impl.engine.AbstractCamelContext : Started secondRoute > (timer://yaml) > > Then I've enabled live reload using application.properties with > camel.main.routes-reload-remove-all-routes set to false. Here's the > full application.properties: > > # routes to load > camel.main.routes-reload-enabled = true > camel.main.routes-reload-directory = file:./ > camel.main.routes-reload-pattern = *.yaml > camel.main.routes-reload-remove-all-routes = false > > Now when I use Camel Jbang to run the routes: > > camel run timers.yaml > > I can see the route ids and the mention that live reload is enabled: > > 2022-12-26 11:32:03.051 INFO 79751 --- [ main] > upport.FileWatcherResourceReloadStrategy : Live route reloading > enabled (directory: .) > 2022-12-26 11:32:03.073 INFO 79751 --- [ main] > e.camel.impl.engine.AbstractCamelContext : Routes startup (started:2) > 2022-12-26 11:32:03.073 INFO 79751 --- [ main] > e.camel.impl.engine.AbstractCamelContext : Started firstRoute > (timer://yaml) > 2022-12-26 11:32:03.073 INFO 79751 --- [ main] > e.camel.impl.engine.AbstractCamelContext : Started secondRoute > (timer://yaml) > > But when I modify one of the routes in the timers.yaml, I get an > warning about missing ids: > > 2022-12-26 11:33:48.522 INFO 79845 --- [rReloadStrategy] > e.camel.impl.engine.AbstractCamelContext : Stopped firstRoute > (timer://yaml) > 2022-12-26 11:33:48.523 INFO 79845 --- [rReloadStrategy] > e.camel.impl.engine.AbstractCamelContext : Shutdown firstRoute > (timer://yaml) > 2022-12-26 11:33:48.524 INFO 79845 --- [rReloadStrategy] > e.camel.impl.engine.AbstractCamelContext : Stopped secondRoute > (timer://yaml) > 2022-12-26 11:33:48.524 INFO 79845 --- [rReloadStrategy] > e.camel.impl.engine.AbstractCamelContext : Shutdown secondRoute > (timer://yaml) > 2022-12-26 11:33:48.537 INFO 79845 --- [rReloadStrategy] > camel.support.RouteWatcherReloadStrategy : Routes reloaded summary > (total:2 started:2) > 2022-12-26 11:33:48.537 INFO 79845 --- [rReloadStrategy] > camel.support.RouteWatcherReloadStrategy : Started firstRoute > (timer://yaml) (source: timers.yaml:4) > 2022-12-26 11:33:48.537 INFO 79845 --- [rReloadStrategy] > camel.support.RouteWatcherReloadStrategy : Started secondRoute > (timer://yaml) (source: timers.yaml:15) > 2022-12-26 11:33:48.538 WARN 79845 --- [rReloadStrategy] > camel.support.RouteWatcherReloadStrategy : Routes with no id's > detected. Its recommended to assign route id's to your routes so Camel > can reload the routes correctly. > Unassigned routes: > timer://yaml?period=2000 > timer://yaml?period=3000 > > A bug? > > Best regards, > Mikael > -- Claus Ibsen ----------------- @davsclaus Camel in Action 2: https://www.manning.com/ibsen2