JMX

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.

Properties

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


Route

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="http://camel.apache.org/schema/spring" xmlns:u="http://www.systar.com/aluminium/camel-util" xmlns:jmx="urn:org.apache.camel.component:jmx">
    <route>
        <from uri="jmx:{{JMXAccess}}?objectDomain={{GarbageObjectDomain}}&amp;key.type={{GarbageKeyType}}&amp;key.name={{GarbageKeyName}}"/>
        <convertBodyTo type="org.w3c.dom.Document"/>
        <setHeader headerName="EntryTime">
            <xpath resultType="java.lang.String">//jmx:NotificationEvent/jmx:dateTime</xpath>
        </setHeader>
        <log message="Garbage on {{GarbageKeyName}} at ${header.EntryTime}"/>
    </route>
</routes>



Related Links