Disabling JMX
Camel, by default, enables JMX for all routes and endpoints it creates by default. Sometimes, such as when you are performance testing Camel, you do not want any of the JMX metric-gathering to add any extra overhead, so you may want to disable JMX. In general, it is a good idea to leave JMX enabled, as you will find it useful to help diagnose any runtime issues.
This recipe shows you how to disable JMX.
Getting ready
The Java code for this recipe is located in the org.camelcookbook.monitoring.jmxdisable
package. The Spring XML files are located under src/main/resources/META-INF/spring
and prefixed with jmx-disable
.
How to do it...
In the XML DSL, create a jmxAgent
element within the camelContext
element, and set disabled
to true
:
<camelContext xmlns="http://camel.apache.org/schema/spring">
<jmxAgent id="agent" disabled="true"/>
<!-- route definitions here -->
</camelContext>
Note
You must set the id
attribute in the jmxAgent...