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

Debugger - Source locations are not available in Spring Boot configurations

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.15.0
    • 3.15.0
    • came-core, jmx
    • None
    • Unknown

    Description

      I modified the SpringBoot XML example so that it configures routes and route contexts as Spring beans, e.g.:

      <?xml version="1.0" encoding="UTF-8"?>
      <spring:beans xmlns:spring="http://www.springframework.org/schema/beans" 
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                    xmlns="http://camel.apache.org/schema/spring" 
                    xsi:schemaLocation="                     
                        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd 
                        http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd 
      ">
          <routeContext id="test">
              <route id="hello">
                  <from uri="timer:hello?period={{timer.period}}"/>
                  <transform>
                      <method ref="myBean" method="saySomething"/>
                  </transform>
                  <setProperty name="testRouteURI">
                      <constant>direct:test</constant>
                  </setProperty>
                  <setHeader name="number">
                      <simple>${random(0,10)}</simple>
                  </setHeader>
                  <filter>
                      <simple>${header.number} &gt; 4</simple>
                      <transform>
                          <simple>Random ${body}</simple>
                      </transform>
                  </filter>
                  <to uri="stream:out"/>
              </route>
          </routeContext>
      </spring:beans>
      

      I ran the application and called dumpRouteSourceLocationsAsXml from Jconsole. The response was:

      <routeLocations>
          <routeLocation routeId="hello" id="hello" index="0" sourceLocation="file:/Users/foobar/camel-spring-boot-examples/xml/target/classes/camel/my-route.xml" sourceLineNumber="-1"/>
          <routeLocation routeId="hello" id="transform1" index="25" sourceLocation="file:/Users/foobar/camel-spring-boot-examples/xml/target/classes/camel/my-route.xml" sourceLineNumber="-1"/>
          <routeLocation routeId="hello" id="setProperty1" index="26" sourceLocation="file:/Users/foobar/camel-spring-boot-examples/xml/target/classes/camel/my-route.xml" sourceLineNumber="-1"/>
          <routeLocation routeId="hello" id="setHeader1" index="27" sourceLocation="file:/Users/foobar/camel-spring-boot-examples/xml/target/classes/camel/my-route.xml" sourceLineNumber="-1"/>
          <routeLocation routeId="hello" id="filter1" index="28" sourceLocation="file:/Users/foobar/camel-spring-boot-examples/xml/target/classes/camel/my-route.xml" sourceLineNumber="-1"/>
          <routeLocation routeId="hello" id="transform2" index="29" sourceLocation="" sourceLineNumber="-1"/>
          <routeLocation routeId="hello" id="to1" index="30" sourceLocation="file:/Users/foobar/camel-spring-boot-examples/xml/target/classes/camel/my-route.xml" sourceLineNumber="-1"/>
      </routeLocations>
      

      I also wanted to have a custom Camel context configuration, so I explicitly created a Camel context XML file and added an annotation to the application class to exclude the CamelAutoConfiguration. This time source locations looked like this:

      <routeLocations>
          <routeLocation routeId="hello" id="hello" index="0" sourceLocation="" sourceLineNumber="-1"/>
          <routeLocation routeId="hello" id="transform1" index="4" sourceLocation="" sourceLineNumber="-1"/>
          <routeLocation routeId="hello" id="setProperty1" index="5" sourceLocation="" sourceLineNumber="-1"/>
          <routeLocation routeId="hello" id="setHeader1" index="6" sourceLocation="" sourceLineNumber="-1"/>
          <routeLocation routeId="hello" id="filter1" index="7" sourceLocation="" sourceLineNumber="-1"/>
          <routeLocation routeId="hello" id="transform2" index="8" sourceLocation="" sourceLineNumber="-1"/>
          <routeLocation routeId="hello" id="to1" index="9" sourceLocation="" sourceLineNumber="-1"/>
      </routeLocations>
      

      So it seems like a bit more work is needed to support Spring configurations.

      Attachments

        Issue Links

          Activity

            People

              davsclaus Claus Ibsen
              javaduke Eugene Berman
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: