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

Spring Boot - xmlRoutesReloadDirectory & jmxCreateConnector issue - duplicated JMX

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Incomplete
    • Affects Version/s: None
    • Fix Version/s: 2.21.0
    • Component/s: camel-spring-boot
    • Labels:
      None
    • Environment:

      Windows
      Camel 2.20.0
      JDK 1.8

    • Estimated Complexity:
      Unknown

      Description

      We configured CAMEL with Spring Boot.

      We used the 'application.properties' file to set-up a folder in which routes are read from when they are updated:
      camel.springboot.xmlRoutesReloadDirectory=/path/to/route/folder/

      First remark: If a file is already in the folder, a 'touch' on it is required for it to be loaded.

      We then tried to configure an JMX agent with the following configuration, still in 'application.properties':
      camel.sprintboot.jmxCreateConnector=true

      Second remark: The value is not set. We traced (debug mode) to check whether the method 'CamelConfigurationProperties.setJmxCreateConnector()' was called. It is NOT called.

      We therefore configured our Spring Boot application to load a context on start-up:
      {{
      @SpringBootApplication
      @ImportResource(

      {"classpath:camelContext.xml"}

      )
      public class ST3Application {
      /**

      • A main method to start this application.
      • @throws Exception
        */
        public static void main(String[] args) throws Exception { SpringApplication.run(ST3Application.class, args); }

        }
        }}

      The camelContext.xml being as follows:
      {{
      <beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      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">
      <camelContext id="camel-xml" xmlns="http://camel.apache.org/schema/spring">
      <jmxAgent id="agent" createConnector="true" />
      </camelContext>
      </beans>
      }}

      In this case, the JMX Bean is exposed and accessible via a JMX client.

      Third remark: When we update the route file from the '/path/to/route/folder/' folder, there is a message in the log indicateing that there is a conflict with the exposed JMX:

      {{
      2017-12-05 09:49:37.368 WARN 3096 — [ main] a.c.m.DefaultManagementLifecycleStrategy : This CamelContext(camel-xml) will be registered using the name: camel-xml-1 due to clash with an existing name already registered in MBeanServer.
      }}

      So it seems that upon routes reloading, the initial JMX are not properly destroyed before creating the new ones.

      The annoying thing is that we cannot safely access the MBean as it is mixed up.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              folier Frédéric OLIER
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: