Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-16552

camel-spring-boot - Configuring route templates trouble setting route id when using spring yaml configuration

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.7.3
    • 3.7.4, 3.10.0
    • camel-spring-boot
    • None
    • Unknown

    Description

      In BaseMainSupport.java the route id to be used for routes instantiated based on templates using properties seems to be determined by using square brackets with non-number indices (see CAMEL-15270):

      ...

      > String id = StringHelper.between(entry.getKey(), "[", "]"); ...

      > source.addParameter(id, key, entry.getValue()); ...

      I fear that may break compatibility with YAML formatted application configuration files, or at least I can't figure out how to model it in YAML.

      My attempts are shown in the two YAML excepts below, which will cause

      "binding to target [Bindable@7af327e3 type = java.util.List<java.util.Map<java.lang.String, java.lang.String>> failed".

      The first example results in properties generated i. e. camel.route-template.config[4][0].auto-start, as I can't get around the yaml list.

       

       1)

       camel:

           route-template:

               config:

                   "[4]":

                       - template-id:   "template-route"

                         ...

       2)

       camel:

           route-template:

               config:

                   "[4]":

                       template-id:   "template-route"

                       ...

       

      Pls. provide a possibility or an example to configure routes based on templates in YAML.

       

      Additional remark: I tried to set the route id in a route template definition converter, however, in DefaultModel.java, the id is overwritten after the converter is applied:

      RouteDefinition def = converter.apply(target, prop);
      if (routeId != null)

      { def.setId(routeId); }

      Is that intended?

       

       

      Attachments

        Activity

          People

            davsclaus Claus Ibsen
            andreas.klug2@de.bosch.com Andreas Klug
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: