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

Use filename to generate id of route when creating Camel file in XML DSL with Camel JBang

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.20.4
    • 3.20.5, 3.21.0, 4.0-RC1, 4.0.0
    • camel-jbang
    • None
    • Unknown

    Description

      Currently, when calling jbang run '-Dcamel.jbang.version=3.20.3' camel@apache/camel init 'demo.xml' the generated file is:

      <?xml version="1.0" encoding="UTF-8"?>
      <!-- camel-k: language=xml -->
      
      <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns="http://camel.apache.org/schema/spring"
              xsi:schemaLocation="
                  http://camel.apache.org/schema/spring
                  https://camel.apache.org/schema/spring/camel-spring.xsd">
      
      	<!-- Write your routes here, for example: -->
          <route id="xml">
              <from uri="timer:xml?period={{time:1000}}"/>
              <setBody>
                  <simple>Hello Camel from ${routeId}</simple>
              </setBody>
              <log message="${body}"/>
          </route>
      
      </routes>
      

      it woudl be nice to have something like:

      <?xml version="1.0" encoding="UTF-8"?>
      <!-- camel-k: language=xml -->
      
      <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xmlns="http://camel.apache.org/schema/spring"
              xsi:schemaLocation="
                  http://camel.apache.org/schema/spring
                  https://camel.apache.org/schema/spring/camel-spring.xsd">
      
      	<!-- Write your routes here, for example: -->
          <route id="demo">
              <from uri="timer:xml?period={{time:1000}}"/>
              <setBody>
                  <simple>Hello Camel from ${routeId}</simple>
              </setBody>
              <log message="${body}"/>
          </route>
      
      </routes>
      

      It will mitigate the risk of having route id clash later on during development phase.

      Alternatively we might use demo-xml

      Attachments

        Activity

          People

            Unassigned Unassigned
            apupier Aurélien Pupier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: