Learn  how to connect to JMX and get different types of information.

JMX Listener

The JMX component is provided by default and enables listening to JMX Events.


Define in properties the configuration :

  • The remote URI of the JMX service
  • The target JMX Object domain
  • The target JMX Key type 
  • The target JMX Key Name
  • (warning) you may also need to specify user and password properties in case the JMX connector requires authentication


In this example, we listen for Garbage collection event for PS Marksweep garbage

The result of the Event is an XML content.

Routes definitions
<?xml version="1.0" encoding="UTF-8"?>
<routes xmlns="" xmlns:u="" xmlns:jmx="urn:org.apache.camel.component:jmx">
        <from uri="jmx:{{JMXAccess}}?objectDomain={{GarbageObjectDomain}}&amp;key.type={{GarbageKeyType}}&amp;{{GarbageKeyName}}"/>
        <convertBodyTo type="org.w3c.dom.Document"/>
        <setHeader name="EntryTime">
            <xpath resultType="java.lang.String">//jmx:NotificationEvent/jmx:dateTime</xpath>
        <log message="Garbage on {{GarbageKeyName}} at ${header.EntryTime}"/>

Related Links