Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Camel JMX (work in progress)

Apache Camel has extensive support for JMX to allow you to monitor and control the behavior of the broker via the JMX MBeansCamel managed objects a JMX client.

Using JMX to

...

manage Apache Camel

By default, JMX instrumentation agent is enabled in Camel which means that Camel runtime creates and registers MBean objects to a MBeanServer in the same JVM. The types of MBean objects are endpoint , route, service, and processor. The CamelNamingStrategy is the default naming strategy which builds object names used for MBean registration. By default, org.apache.camel is the domain name for all object names created by CamelNamingStrategy. It can be configured by Java VM system property:

Code Block

  -Dorg.apache.camel.jmx.mbeanObjectDomainName=your.domain.name

Or, by adding a jmxAgent element inside the camelContext element in Spring configuration:

Code Block

  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
    <jmxAgent id="agent" mbeanObjectDomainName="your.domain.name"/> 
    ...
  </camelContext>

Spring configuration always take precedence over system properties.

Disabling JMX instrumentation agent in Camel

You can enable/ disable JMX support as follows...1. Run a camel context setting the context property useJmx to true. instrumentation agent by setting Java VM system property as follow. The property value is treated as boolean.

Code Block

  -Dorg.apache.camel.jmx.disabled=True

Or, by adding a jmxAgent element inside the camelContext element in Spring configuration:

Code Block
  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring" useJmx>
    <jmxAgent id="agent" disabled="true"/> 
    ...
  </camelContext>

Locating a MBeanServer in the Java VM

Each CamelContext can have an instance of InstrumentationAgent wrapped insider the InstrumentationLifecycleStrategy. The InstrumentationAgent is the object that interfaces with a MBeanServer to register/unregister Camel MBeans. By default, Camel runtime picks the first MBeanServer returned by MBeanServerFactory.findMBeanServer method that matches the default domain name with org.apache.camel.

You can configure the matching default domain name Java VM system property.

Code Block

  -Dorg.apache.camel.jmx.mbeanServerDefaultDomain=<your.domain.name>

Or, by adding a jmxAgent element inside the camelContext element in Spring configuration:

Code Block

  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
    <jmxAgent id="agent" mbeanServerDefaultDomain="your.domain.name"/> 
    ...
  </camelContext>

If no matching MBeanServer is located, a new one is created and the new MBeanServer's default domain name is taken as above as well.

It is also possible to pick the PlatformMBeanServer instead by setting the system property:

Code Block

  -Dorg.apache.camel.jmx.usePlatformMBeanServer=True

Or, by adding a jmxAgent element inside the camelContext element in Spring configuration:

Code Block

  <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
    <jmxAgent id="agent" usePlatformMBeanServer="true"/> 
    ...<route>
      ...
    </route>
  </camelContext>

2. Run a JMX console (e.g. jconsole - JMX console included in the JDK <JAVA_HOME>/bin/jconsole.exe)

...