I checked the YAML DSL schema for RouteDefinition and it doesn't seem to have the routeId field, only id:
https://github.com/apache/camel/blob/796e58cd27a07b91c5690cac977356788ba7a03a/dsl/camel-yaml-dsl/camel-yaml-dsl/src/generated/resources/schema/camel-yaml-dsl.json#L2546 ma 26. jouluk. 2022 klo 13.08 Mikael Koskinen (mijap...@gmail.com) kirjoitti: > > Thanks! I tried routeId and route-id but got the following error on both: > > Unsupported field: routeId > in file:timers.yaml, line 2, column 5: > routeId: firstRoute > ^ > > at > org.apache.camel.dsl.yaml.deserializers.RouteDefinitionDeserializer.setProperties(RouteDefinitionDeserializer.java:128) > at > org.apache.camel.dsl.yaml.deserializers.RouteDefinitionDeserializer.setProperties(RouteDefinitionDeserializer.java:33) > at > org.apache.camel.dsl.yaml.common.YamlDeserializerBase.construct(YamlDeserializerBase.java:65) > at > org.apache.camel.dsl.yaml.common.YamlDeserializationContext$2.construct(YamlDeserializationContext.java:215) > > This is the route: > > - route: > routeId: firstRoute > from: > uri: "timer:yaml" > parameters: > period: "2000" > steps: > - setBody: > constant: "Hello Camel from yaml timer 300" > - log: "${body}" > > If I use Karavan to set the ID of the route, it sets the "id" field: > > - route: > from: > uri: timer:yaml > steps: > - setBody: > expression: > constant: > expression: Hello Camel from yaml timer 300 > - log: > message: ${body} > parameters: > period: '2000' > id: routeIdFromKaravan > > > ma 26. jouluk. 2022 klo 12.02 Claus Ibsen (claus.ib...@gmail.com) kirjoitti: > > > > And it can use camelCase too, so routeId or route-id are both possible. > > However routeId is recommended so you use same case as XML, Java DSL etc. > > > > On Mon, Dec 26, 2022 at 11:00 AM Claus Ibsen <claus.ib...@gmail.com> wrote: > > > > > 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 > > > > > > > > > -- > > Claus Ibsen > > ----------------- > > @davsclaus > > Camel in Action 2: https://www.manning.com/ibsen2