Modified: websites/production/camel/content/camel-jmx.html
==============================================================================
--- websites/production/camel/content/camel-jmx.html (original)
+++ websites/production/camel/content/camel-jmx.html Fri Aug 25 08:22:01 2017
@@ -36,17 +36,6 @@
     <![endif]-->
 
 
-  <link href='//camel.apache.org/styles/highlighter/styles/shCoreCamel.css' 
rel='stylesheet' type='text/css' />
-  <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css' 
rel='stylesheet' type='text/css' />
-  <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js' 
type='text/javascript'></script>
-  
-  <script type="text/javascript">
-  SyntaxHighlighter.defaults['toolbar'] = false;
-  SyntaxHighlighter.all();
-  </script>
 
     <title>
     Apache Camel: Camel JMX
@@ -86,245 +75,96 @@
        <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="CamelJMX-CamelJMX">Camel 
JMX</h2><p>Apache Camel has extensive support for JMX to allow you to monitor 
and control the Camel managed objects with a JMX client. Camel also provides a 
<a shape="rect" href="jmx.html">JMX</a> component that allows you to subscribe 
to MBean notifications. This page is about how to manage and monitor Camel 
using JMX.</p><h3 id="CamelJMX-ActivatingJMXinCamel">Activating JMX in 
Camel</h3><p></p><div class="toc-macro client-side-toc-macro" 
data-headerelements="H1,H2,H3,H4,H5,H6,H7"></div><div 
class="confluence-information-macro 
confluence-information-macro-information"><p class="title">Spring JAR 
Dependencies Required By Camel 2.8 or Older</p><span class="aui-icon 
aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>The following Spring jar files 
must be on the classpath in order for Camel to be able to use JMX 
instrumentation:</p><ul><li><st
 
rong><code>spring-context.jar</code></strong></li><li><strong><code>spring-aop.jar</code></strong></li><li><strong><code>spring-beans.jar</code></strong></li><li><strong><code>spring-core.jar</code></strong></li></ul><p>If
 these jar files are not on the classpath Camel will fallback to non JMX mode. 
Camel will log a warning to this affect using the logger: 
<strong><code>org.apache.camel.impl.DefaultCamelContext</code></strong>.</p><p><strong>From
 Camel 2.9:</strong> the Spring jar files are <strong>no</strong> longer 
required for Camel to run in JMX mode.</p></div></div><h4 
id="CamelJMX-UsingJMXtomanageApacheCamel">Using JMX to manage Apache 
Camel</h4><p>By default, JMX instrumentation agent is <em>enabled</em> in 
Camel, which means that Camel runtime creates and registers MBean management 
objects with a <strong><code>MBeanServer</code></strong> instance in the VM. 
This allows Camel users to instantly obtain insights into how Camel routes 
perform down to the individual processor lev
 el.</p><p>The supported types of management objects are <a shape="rect" 
class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/management/mbean/ManagedEndpoint.html";>endpoint</a>,
 <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/management/mbean/ManagedRoute.html";>route</a>,
 <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/management/mbean/ManagedService.html";>service</a>,
 and <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/management/mbean/ManagedProcessor.html";>processor</a>.
 Some of these management objects also expose lifecycle operations in addition 
to performance counter attributes.</p><p>The <a shape="rect" 
class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/management/Default
 ManagementNamingStrategy.html">DefaultManagementNamingStrategy</a> is the 
default naming strategy which builds object names used for MBean registration. 
By default <strong><code>org.apache.camel</code></strong> is the domain name 
for all object names created by 
<strong><code>CamelNamingStrategy</code></strong>. The domain name of the MBean 
object can be configured by Java VM system property:</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[-Dorg.apache.camel.jmx.mbeanObjectDomainName=your.domain.name
-]]></script>
-</div></div><p>Or, by adding a <strong><code>jmxAgent</code></strong> element 
inside the&#160;<strong><code>camelContext</code></strong> element in Spring 
configuration:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext id=&quot;camel&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-  &lt;jmxAgent id=&quot;agent&quot; 
mbeanObjectDomainName=&quot;your.domain.name&quot;/&gt;
+<div class="wiki-content maincontent"><h2 id="CamelJMX-CamelJMX">Camel 
JMX</h2><p>Apache Camel has extensive support for JMX to allow you to monitor 
and control the Camel managed objects with a JMX client. Camel also provides a 
<a shape="rect" href="jmx.html">JMX</a> component that allows you to subscribe 
to MBean notifications. This page is about how to manage and monitor Camel 
using JMX.</p><h3 id="CamelJMX-ActivatingJMXinCamel">Activating JMX in 
Camel</h3><p></p><parameter ac:name="title">Spring JAR Dependencies Required By 
Camel 2.8 or Older</parameter><rich-text-body><p>The following Spring jar files 
must be on the classpath in order for Camel to be able to use JMX 
instrumentation:</p><ul><li><strong><code>spring-context.jar</code></strong></li><li><strong><code>spring-aop.jar</code></strong></li><li><strong><code>spring-beans.jar</code></strong></li><li><strong><code>spring-core.jar</code></strong></li></ul><p>If
 these jar files are not on the classpath Camel will fallback to 
 non JMX mode. Camel will log a warning to this affect using the logger: 
<strong><code>org.apache.camel.impl.DefaultCamelContext</code></strong>.</p><p><strong>From
 Camel 2.9:</strong> the Spring jar files are <strong>no</strong> longer 
required for Camel to run in JMX mode.</p></rich-text-body><h4 
id="CamelJMX-UsingJMXtomanageApacheCamel">Using JMX to manage Apache 
Camel</h4><p>By default, JMX instrumentation agent is <em>enabled</em> in 
Camel, which means that Camel runtime creates and registers MBean management 
objects with a <strong><code>MBeanServer</code></strong> instance in the VM. 
This allows Camel users to instantly obtain insights into how Camel routes 
perform down to the individual processor level.</p><p>The supported types of 
management objects are <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/management/mbean/ManagedEndpoint.html";>endpoint</a>,
 <a shape="rect" class="external-link" href="http://came
 
l.apache.org/maven/current/camel-core/apidocs/org/apache/camel/management/mbean/ManagedRoute.html">route</a>,
 <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/management/mbean/ManagedService.html";>service</a>,
 and <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/management/mbean/ManagedProcessor.html";>processor</a>.
 Some of these management objects also expose lifecycle operations in addition 
to performance counter attributes.</p><p>The <a shape="rect" 
class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/management/DefaultManagementNamingStrategy.html";>DefaultManagementNamingStrategy</a>
 is the default naming strategy which builds object names used for MBean 
registration. By default <strong><code>org.apache.camel</code></strong> is the 
domain name for all object names created by <strong><code>CamelN
 amingStrategy</code></strong>. The domain name of the MBean object can be 
configured by Java VM system 
property:</p><plain-text-body>-Dorg.apache.camel.jmx.mbeanObjectDomainName=your.domain.name
+</plain-text-body><p>Or, by adding a <strong><code>jmxAgent</code></strong> 
element inside the&#160;<strong><code>camelContext</code></strong> element in 
Spring configuration:</p><plain-text-body>&lt;camelContext id="camel" 
xmlns="http://camel.apache.org/schema/spring"&gt;
+  &lt;jmxAgent id="agent" mbeanObjectDomainName="your.domain.name"/&gt;
     ...
 &lt;/camelContext&gt;
-]]></script>
-</div></div><p>Spring configuration always takes precedence over system 
properties when they both present. It is true for all JMX related 
configurations.</p><h4 
id="CamelJMX-DisablingJMXinstrumentationagentinCamel">Disabling JMX 
instrumentation agent in Camel</h4><p>You can disable JMX instrumentation agent 
by setting the Java VM system property as follow. The property value is treated 
as <code>boolean</code>.</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[-Dorg.apache.camel.jmx.disabled=true
-]]></script>
-</div></div><p>Or, by adding a <strong><code>jmxAgent</code></strong> element 
inside the <strong><code>camelContext</code></strong> element in Spring 
configuration:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext id=&quot;camel&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-  &lt;jmxAgent id=&quot;agent&quot; disabled=&quot;true&quot;/&gt;
+</plain-text-body><p>Spring configuration always takes precedence over system 
properties when they both present. It is true for all JMX related 
configurations.</p><h4 
id="CamelJMX-DisablingJMXinstrumentationagentinCamel">Disabling JMX 
instrumentation agent in Camel</h4><p>You can disable JMX instrumentation agent 
by setting the Java VM system property as follow. The property value is treated 
as 
<code>boolean</code>.</p><plain-text-body>-Dorg.apache.camel.jmx.disabled=true
+</plain-text-body><p>Or, by adding a <strong><code>jmxAgent</code></strong> 
element inside the <strong><code>camelContext</code></strong> element in Spring 
configuration:</p><plain-text-body>&lt;camelContext id="camel" 
xmlns="http://camel.apache.org/schema/spring"&gt;
+  &lt;jmxAgent id="agent" disabled="true"/&gt;
     ...
 &lt;/camelContext&gt;
-]]></script>
-</div></div><p>Or in <strong>Camel 2.1</strong> its a bit easier (not having 
to use JVM system property) if using pure Java as you can disable it as 
follows:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[CamelContext camel = new 
DefaultCamelContext();
+</plain-text-body><p>Or in <strong>Camel 2.1</strong> its a bit easier (not 
having to use JVM system property) if using pure Java as you can disable it as 
follows:</p><plain-text-body>CamelContext camel = new DefaultCamelContext();
 camel.disableJMX();
-]]></script>
-</div></div><h4 id="CamelJMX-LocatingaMBeanServerintheJavaVM">Locating a 
MBeanServer in the Java VM</h4><p>Each CamelContext can have an instance of <a 
shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/InstrumentationAgent.html";>InstrumentationAgent</a>
 wrapped inside the <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/management/InstrumentationLifecycleStrategy.html";>InstrumentationLifecycleStrategy</a>.
 The InstrumentationAgent is the object that interfaces with a <a shape="rect" 
class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/javax/management/MBeanServer.html";
 rel="nofollow">MBeanServer</a> to register/unregister Camel MBeans. Multiple 
CamelContexts/InstrumentationAgents can/should share a 
<strong><code>MBeanServer</code></strong>. By default, Camel runtime picks the 
first <strong><code>MBeanServer</code></strong> returned 
 by <a shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/javax/management/MBeanServerFactory.html#findMBeanServer(java.lang.String)"
 rel="nofollow">MBeanServerFactory.findMBeanServer method</a> that matches the 
default domain name of <strong><code>org.apache.camel</code></strong>. You may 
want to change the default domain name to match the 
<strong><code>MBeanServer</code></strong> instance that you are already using 
in your application. Especially, if your 
<strong><code>MBeanServer</code></strong> is attached to a JMX connector 
server, you will not need to create a connector server in Camel.</p><p>You can 
configure the matching default domain name via system property.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[-Dorg.apache.camel.jmx.mbeanServerDefaultDomain=&lt;your.domain.name&gt;
-]]></script>
-</div></div><p>Or, by adding a&#160;<strong><code>jmxAgent</code></strong> 
element inside the&#160;<strong><code>camelContext</code></strong> element in 
Spring configuration:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext id=&quot;camel&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-  &lt;jmxAgent id=&quot;agent&quot; 
mbeanServerDefaultDomain=&quot;your.domain.name&quot;/&gt;
+</plain-text-body><h4 id="CamelJMX-LocatingaMBeanServerintheJavaVM">Locating a 
MBeanServer in the Java VM</h4><p>Each CamelContext can have an instance of <a 
shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/InstrumentationAgent.html";>InstrumentationAgent</a>
 wrapped inside the <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/management/InstrumentationLifecycleStrategy.html";>InstrumentationLifecycleStrategy</a>.
 The InstrumentationAgent is the object that interfaces with a <a shape="rect" 
class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/javax/management/MBeanServer.html";
 rel="nofollow">MBeanServer</a> to register/unregister Camel MBeans. Multiple 
CamelContexts/InstrumentationAgents can/should share a 
<strong><code>MBeanServer</code></strong>. By default, Camel runtime picks the 
first <strong><code>MBeanServer</code></strong> ret
 urned by <a shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/javax/management/MBeanServerFactory.html#findMBeanServer(java.lang.String)"
 rel="nofollow">MBeanServerFactory.findMBeanServer method</a> that matches the 
default domain name of <strong><code>org.apache.camel</code></strong>. You may 
want to change the default domain name to match the 
<strong><code>MBeanServer</code></strong> instance that you are already using 
in your application. Especially, if your 
<strong><code>MBeanServer</code></strong> is attached to a JMX connector 
server, you will not need to create a connector server in Camel.</p><p>You can 
configure the matching default domain name via system 
property.</p><plain-text-body>-Dorg.apache.camel.jmx.mbeanServerDefaultDomain=&lt;your.domain.name&gt;
+</plain-text-body><p>Or, by adding 
a&#160;<strong><code>jmxAgent</code></strong> element inside 
the&#160;<strong><code>camelContext</code></strong> element in Spring 
configuration:</p><plain-text-body>&lt;camelContext id="camel" 
xmlns="http://camel.apache.org/schema/spring"&gt;
+  &lt;jmxAgent id="agent" mbeanServerDefaultDomain="your.domain.name"/&gt;
     ...
 &lt;/camelContext&gt;
-]]></script>
-</div></div><p>If no matching <strong><code>MBeanServer</code></strong> can be 
found, a new one is created and the new 
<strong><code>MBeanServer</code></strong>'s default domain name is set 
according to the default and configuration as mentioned above.</p><p>It is also 
possible to use the <a shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/ManagementFactory.html#getPlatformMBeanServer()"
 rel="nofollow">PlatformMBeanServer</a> when it is desirable to manage JVM 
MBeans by setting the system property. The 
<strong><code>MBeanServer</code></strong> default domain name configuration is 
ignored as it is not applicable. </p><p><strong>From Camel 1.5</strong>: the 
default value of <strong><code>usePlatformMBeanServer</code></strong> is 
<strong><code>true</code></strong>. Set the property 
to&#160;<strong><code>false</code></strong> to disable using platform 
<strong><code>MBeanServer</code>.</strong></p><div class="code panel pdl" 
style="bor
 der-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[-Dorg.apache.camel.jmx.usePlatformMBeanServer=True
-]]></script>
-</div></div><p>Or, by adding a&#160;<strong><code>jmxAgent</code></strong> 
element inside the <strong><code>camelContext</code></strong> element in Spring 
configuration:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext id=&quot;camel&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-  &lt;jmxAgent id=&quot;agent&quot; 
usePlatformMBeanServer=&quot;true&quot;/&gt;
+</plain-text-body><p>If no matching <strong><code>MBeanServer</code></strong> 
can be found, a new one is created and the new 
<strong><code>MBeanServer</code></strong>'s default domain name is set 
according to the default and configuration as mentioned above.</p><p>It is also 
possible to use the <a shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/management/ManagementFactory.html#getPlatformMBeanServer()"
 rel="nofollow">PlatformMBeanServer</a> when it is desirable to manage JVM 
MBeans by setting the system property. The 
<strong><code>MBeanServer</code></strong> default domain name configuration is 
ignored as it is not applicable. </p><p><strong>From Camel 1.5</strong>: the 
default value of <strong><code>usePlatformMBeanServer</code></strong> is 
<strong><code>true</code></strong>. Set the property 
to&#160;<strong><code>false</code></strong> to disable using platform 
<strong><code>MBeanServer</code>.</strong></p><plain-text-body>-Dorg.apache.ca
 mel.jmx.usePlatformMBeanServer=True
+</plain-text-body><p>Or, by adding 
a&#160;<strong><code>jmxAgent</code></strong> element inside the 
<strong><code>camelContext</code></strong> element in Spring 
configuration:</p><plain-text-body>&lt;camelContext id="camel" 
xmlns="http://camel.apache.org/schema/spring"&gt;
+  &lt;jmxAgent id="agent" usePlatformMBeanServer="true"/&gt;
     ...
 &lt;/camelContext&gt;
-]]></script>
-</div></div><h4 id="CamelJMX-CreatingJMXRMIConnectorServer">Creating JMX RMI 
Connector Server</h4><p>JMX connector server enables MBeans to be remotely 
managed by a JMX client such as JConsole; Camel JMX RMI connector server can be 
optionally turned on by setting system property and the 
<strong><code>MBeanServer</code></strong> used by Camel is attached to that 
connector server.</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[-Dorg.apache.camel.jmx.createRmiConnector=True
-]]></script>
-</div></div><p>Or, by adding a <strong><code>jmxAgent</code></strong> element 
inside the <strong><code>camelContext</code></strong> element in Spring 
configuration:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext id=&quot;camel&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-  &lt;jmxAgent id=&quot;agent&quot; createConnector=&quot;true&quot;/&gt;
+</plain-text-body><h4 id="CamelJMX-CreatingJMXRMIConnectorServer">Creating JMX 
RMI Connector Server</h4><p>JMX connector server enables MBeans to be remotely 
managed by a JMX client such as JConsole; Camel JMX RMI connector server can be 
optionally turned on by setting system property and the 
<strong><code>MBeanServer</code></strong> used by Camel is attached to that 
connector 
server.</p><plain-text-body>-Dorg.apache.camel.jmx.createRmiConnector=True
+</plain-text-body><p>Or, by adding a <strong><code>jmxAgent</code></strong> 
element inside the <strong><code>camelContext</code></strong> element in Spring 
configuration:</p><plain-text-body>&lt;camelContext id="camel" 
xmlns="http://camel.apache.org/schema/spring"&gt;
+  &lt;jmxAgent id="agent" createConnector="true"/&gt;
     ...
 &lt;/camelContext&gt;
-]]></script>
-</div></div><h4 id="CamelJMX-JMXServiceURL">JMX Service URL</h4><p>The default 
JMX Service URL has the format:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[service:jmx:rmi:///jndi/rmi://localhost:&lt;registryPort&gt;/&lt;serviceUrlPath&gt;
-]]></script>
-</div></div><p>where&#160;<strong><code>registryPort</code></strong> is the 
RMI registry port and the default value is 
<strong><code>1099</code></strong>.</p><p>You can set the RMI registry port by 
system property.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[-Dorg.apache.camel.jmx.rmiConnector.registryPort=&lt;port
 number&gt;
-]]></script>
-</div></div><p>Or, by adding a <strong><code>jmxAgent</code></strong> element 
inside the&#160;<strong><code>camelContext</code></strong> element in Spring 
configuration:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext id=&quot;camel&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-  &lt;jmxAgent id=&quot;agent&quot; createConnector=&quot;true&quot; 
registryPort=&quot;port number&quot;/&gt;
+</plain-text-body><h4 id="CamelJMX-JMXServiceURL">JMX Service URL</h4><p>The 
default JMX Service URL has the 
format:</p><plain-text-body>service:jmx:rmi:///jndi/rmi://localhost:&lt;registryPort&gt;/&lt;serviceUrlPath&gt;
+</plain-text-body><p>where&#160;<strong><code>registryPort</code></strong> is 
the RMI registry port and the default value is 
<strong><code>1099</code></strong>.</p><p>You can set the RMI registry port by 
system 
property.</p><plain-text-body>-Dorg.apache.camel.jmx.rmiConnector.registryPort=&lt;port
 number&gt;
+</plain-text-body><p>Or, by adding a <strong><code>jmxAgent</code></strong> 
element inside the&#160;<strong><code>camelContext</code></strong> element in 
Spring configuration:</p><plain-text-body>&lt;camelContext id="camel" 
xmlns="http://camel.apache.org/schema/spring"&gt;
+  &lt;jmxAgent id="agent" createConnector="true" registryPort="port 
number"/&gt;
     ...
 &lt;/camelContext&gt;
-]]></script>
-</div></div><p>where&#160;<strong><code>serviceUrlPath</code></strong> is the 
path name in the URL and the default value is 
<strong><code>/jmxrmi/camel</code></strong>.</p><p>You can set the service URL 
path by system property.</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[-Dorg.apache.camel.jmx.serviceUrlPath=&lt;path&gt;
-]]></script>
-</div></div><div class="confluence-information-macro 
confluence-information-macro-tip"><p class="title">Setting ManagementAgent 
settings in Java</p><span class="aui-icon aui-icon-small aui-iconfont-approve 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p><strong>From Camel 2.4:</strong> 
various options can also be set on the 
<strong><code>ManagementAgent</code></strong>:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-context.getManagementStrategy().getManagementAgent().setServiceUrlPath(&quot;/foo/bar&quot;);
-context.getManagementStrategy().getManagementAgent().setRegistryPort(2113);
-context.getManagementStrategy().getManagementAgent().setCreateConnector(true);
-]]></script>
-</div></div></div></div><p>Or, by adding 
a&#160;<strong><code>jmxAgent</code></strong> element inside 
the&#160;<strong><code>camelContext</code></strong> element in Spring 
configuration:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext id=&quot;camel&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-  &lt;jmxAgent id=&quot;agent&quot; createConnector=&quot;true&quot; 
serviceUrlPath=&quot;path&quot;/&gt;
+</plain-text-body><p>where&#160;<strong><code>serviceUrlPath</code></strong> 
is the path name in the URL and the default value is 
<strong><code>/jmxrmi/camel</code></strong>.</p><p>You can set the service URL 
path by system 
property.</p><plain-text-body>-Dorg.apache.camel.jmx.serviceUrlPath=&lt;path&gt;
+</plain-text-body><parameter ac:name="title">Setting ManagementAgent settings 
in Java</parameter><rich-text-body><p><strong>From Camel 2.4:</strong> various 
options can also be set on the 
<strong><code>ManagementAgent</code></strong>:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/management/ManagedServiceUrlPathTest.java}</plain-text-body></p></rich-text-body><p>Or,
 by adding a&#160;<strong><code>jmxAgent</code></strong> element inside 
the&#160;<strong><code>camelContext</code></strong> element in Spring 
configuration:</p><plain-text-body>&lt;camelContext id="camel" 
xmlns="http://camel.apache.org/schema/spring"&gt;
+  &lt;jmxAgent id="agent" createConnector="true" serviceUrlPath="path"/&gt;
     ...
 &lt;/camelContext&gt;
-]]></script>
-</div></div><p>By default, RMI server object listens on a dynamically 
generated port, which can be a problem for connections established through a 
firewall. In such situations, RMI connection port can be explicitly set by the 
system property.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[-Dorg.apache.camel.jmx.rmiConnector.connectorPort=&lt;port
 number&gt;
-]]></script>
-</div></div><p>Or by adding a&#160;<strong><code>jmxAgent</code></strong> 
element inside the <strong><code>camelContext</code></strong> element in Spring 
configuration:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext id=&quot;camel&quot; 
xmlns=&quot;http://activemq.apache.org/camel/schema/spring&quot;&gt;
-  &lt;jmxAgent id=&quot;agent&quot; createConnector=&quot;true&quot; 
connectorPort=&quot;port number&quot;/&gt;
+</plain-text-body><p>By default, RMI server object listens on a dynamically 
generated port, which can be a problem for connections established through a 
firewall. In such situations, RMI connection port can be explicitly set by the 
system 
property.</p><plain-text-body>-Dorg.apache.camel.jmx.rmiConnector.connectorPort=&lt;port
 number&gt;
+</plain-text-body><p>Or by adding 
a&#160;<strong><code>jmxAgent</code></strong> element inside the 
<strong><code>camelContext</code></strong> element in Spring 
configuration:</p><plain-text-body>&lt;camelContext id="camel" 
xmlns="http://activemq.apache.org/camel/schema/spring"&gt;
+  &lt;jmxAgent id="agent" createConnector="true" connectorPort="port 
number"/&gt;
     ...
 &lt;/camelContext&gt;
-]]></script>
-</div></div><p>When the connector port option is set, the JMX service URL will 
become:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[service:jmx:rmi://localhost:&lt;connectorPort&gt;/jndi/rmi://localhost:&lt;registryPort&gt;/&lt;serviceUrlPath&gt;
-]]></script>
-</div></div><h4 id="CamelJMX-SystemPropertiesforCamelJMXSupport">System 
Properties for Camel JMX Support</h4><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Property Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>value</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.jmx</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><strong><code>true/</code></strong><strong><code>false</code></strong></p></td><td
 colspan="1" rowspan="1" 
class="confluenceTd"><p>When&#160;<strong><code>true</code></strong> JMX in 
enabled in Camel.</p></td></tr></tbody></table></div><p>See more system 
properties in this section below: <em>jmxAgent Properties Reference</em></p><h4 
id="CamelJMX-HowtouseauthenticationwithJMX">How to use authentication with 
JMX</h4><p>JMX in the JDK have features for a
 uthentication and also for using secure connections over SSL. You have to 
refer to the SUN documentation how to use this:</p><ul class="alternate"><li><a 
shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html"; 
rel="nofollow">http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html</a></li><li><a
 shape="rect" class="external-link" 
href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html"; 
rel="nofollow">http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html</a></li></ul><h4
 id="CamelJMX-JMXinsideanApplicationServer">JMX inside an Application 
Server</h4><h5 id="CamelJMX-Tomcat6">Tomcat 6</h5><p>See <a shape="rect" 
class="external-link" 
href="http://tomcat.apache.org/tomcat-6.0-doc/monitoring.html";>this page</a> 
for details about enabling JMX in Tomcat.</p><p>In short, modify 
your&#160;<strong><code>catalina.sh</code></strong> 
(or&#160;<strong><code>catalina.bat</code></strong> in Windows) f
 ile to set the following options...</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[ set 
CATALINA_OPTS=-Dcom.sun.management.jmxremote \
+</plain-text-body><p>When the connector port option is set, the JMX service 
URL will 
become:</p><plain-text-body>service:jmx:rmi://localhost:&lt;connectorPort&gt;/jndi/rmi://localhost:&lt;registryPort&gt;/&lt;serviceUrlPath&gt;
+</plain-text-body><h4 id="CamelJMX-SystemPropertiesforCamelJMXSupport">System 
Properties for Camel JMX Support</h4><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Property Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>value</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.jmx</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><strong><code>true/</code></strong><strong><code>false</code></strong></p></td><td
 colspan="1" rowspan="1" 
class="confluenceTd"><p>When&#160;<strong><code>true</code></strong> JMX in 
enabled in Camel.</p></td></tr></tbody></table></div><p>See more system 
properties in this section below: <em>jmxAgent Properties Reference</em></p><h4 
id="CamelJMX-HowtouseauthenticationwithJMX">How to use authentication with 
JMX</h4><p>JMX in the JDK have features
  for authentication and also for using secure connections over SSL. You have 
to refer to the SUN documentation how to use this:</p><ul 
class="alternate"><li><a shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html"; 
rel="nofollow">http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html</a></li><li><a
 shape="rect" class="external-link" 
href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html"; 
rel="nofollow">http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html</a></li></ul><h4
 id="CamelJMX-JMXinsideanApplicationServer">JMX inside an Application 
Server</h4><h5 id="CamelJMX-Tomcat6">Tomcat 6</h5><p>See <a shape="rect" 
class="external-link" 
href="http://tomcat.apache.org/tomcat-6.0-doc/monitoring.html";>this page</a> 
for details about enabling JMX in Tomcat.</p><p>In short, modify 
your&#160;<strong><code>catalina.sh</code></strong> 
(or&#160;<strong><code>catalina.bat</code></strong> in Wind
 ows) file to set the following options...</p><plain-text-body> set 
CATALINA_OPTS=-Dcom.sun.management.jmxremote \
     -Dcom.sun.management.jmxremote.port=1099 \
     -Dcom.sun.management.jmxremote.ssl=false \
     -Dcom.sun.management.jmxremote.authenticate=false
-]]></script>
-</div></div><h5 id="CamelJMX-JBossAS4">JBoss AS 4</h5><p>By default JBoss 
creates its own <strong><code>MBeanServer</code></strong>. To allow Camel to 
expose to the same server follow these steps:</p><ul><li>Tell Camel to use the 
Platform <strong><code>MBeanServer</code></strong> (This defaults to true in 
Camel 1.5)</li></ul><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camel:camelContext 
id=&quot;camelContext&quot;&gt;
-  &lt;camel:jmxAgent id=&quot;jmxAgent&quot; 
mbeanObjectDomainName=&quot;org.yourname&quot; 
usePlatformMBeanServer=&quot;true&quot;/&gt;
+</plain-text-body><h5 id="CamelJMX-JBossAS4">JBoss AS 4</h5><p>By default 
JBoss creates its own <strong><code>MBeanServer</code></strong>. To allow Camel 
to expose to the same server follow these steps:</p><ul><li>Tell Camel to use 
the Platform <strong><code>MBeanServer</code></strong> (This defaults to true 
in Camel 1.5)</li></ul><plain-text-body>&lt;camel:camelContext 
id="camelContext"&gt;
+  &lt;camel:jmxAgent id="jmxAgent" mbeanObjectDomainName="org.yourname" 
usePlatformMBeanServer="true"/&gt;
 &lt;/camel:camelContext&gt;
-]]></script>
-</div></div><ul><li>Alter your JBoss instance to use the Platform 
<strong><code>MBeanServer</code></strong>.</li><li>Add the following property 
to your&#160;<strong><code>JAVA_OPTS</code></strong> by 
editing&#160;<strong><code>run.sh</code></strong> 
or&#160;<strong><code>run.conf -Djboss.platform.mbeanserver</code></strong>. 
See <a shape="rect" class="external-link" 
href="http://wiki.jboss.org/wiki/JBossMBeansInJConsole"; 
rel="nofollow">http://wiki.jboss.org/wiki/JBossMBeansInJConsole</a></li></ul><h5
 id="CamelJMX-WebSphere">WebSphere</h5><p>Alter the 
<strong><code>mbeanServerDefaultDomain</code></strong> to 
be&#160;<strong><code>WebSphere</code></strong></p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camel:jmxAgent id=&quot;agent&quot; 
createConnector=&quot;true&quot; mbeanObjectDomainName=&quot;org.yourname&quot; 
usePlatformMBeanServer=&quot;false&quot; 
mbeanServerDefaultDomain=&quot;WebSphere&quot;/&gt;
-]]></script>
-</div></div><h5 id="CamelJMX-OracleOC4j">Oracle OC4j</h5><p>The Oracle OC4J 
J2EE application server will not allow Camel to access the platform 
<strong><code>MBeanServer</code></strong>. You can identify this in the log as 
Camel will log a <strong><code>WARN</code></strong>.</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[xxx xx, xxxx xx:xx:xx xx 
org.apache.camel.management.InstrumentationLifecycleStrategy onContextStart
+</plain-text-body><ul><li>Alter your JBoss instance to use the Platform 
<strong><code>MBeanServer</code></strong>.</li><li>Add the following property 
to your&#160;<strong><code>JAVA_OPTS</code></strong> by 
editing&#160;<strong><code>run.sh</code></strong> 
or&#160;<strong><code>run.conf -Djboss.platform.mbeanserver</code></strong>. 
See <a shape="rect" class="external-link" 
href="http://wiki.jboss.org/wiki/JBossMBeansInJConsole"; 
rel="nofollow">http://wiki.jboss.org/wiki/JBossMBeansInJConsole</a></li></ul><h5
 id="CamelJMX-WebSphere">WebSphere</h5><p>Alter the 
<strong><code>mbeanServerDefaultDomain</code></strong> to 
be&#160;<strong><code>WebSphere</code></strong></p><plain-text-body>&lt;camel:jmxAgent
 id="agent" createConnector="true" mbeanObjectDomainName="org.yourname" 
usePlatformMBeanServer="false" mbeanServerDefaultDomain="WebSphere"/&gt;
+</plain-text-body><h5 id="CamelJMX-OracleOC4j">Oracle OC4j</h5><p>The Oracle 
OC4J J2EE application server will not allow Camel to access the platform 
<strong><code>MBeanServer</code></strong>. You can identify this in the log as 
Camel will log a <strong><code>WARN</code></strong>.</p><plain-text-body>xxx 
xx, xxxx xx:xx:xx xx 
org.apache.camel.management.InstrumentationLifecycleStrategy onContextStart
 WARNING: Could not register CamelContext MBean
 java.lang.SecurityException: Unauthorized access from application: xx to 
MBean: java.lang:type=ClassLoading
         at 
oracle.oc4j.admin.jmx.shared.UserMBeanServer.checkRegisterAccess(UserMBeanServer.java:873)
-]]></script>
-</div></div><p>To resolve this you should disable the JMX agent in Camel, see 
section <em>Disabling JMX instrumentation agent in Camel</em></p><h4 
id="CamelJMX-AdvancedJMXConfiguration">Advanced JMX Configuration</h4><p>The 
Spring configuration file allows you to configure how Camel is exposed to JMX 
for management. In some cases, you could specify more information here, like 
the connector's port or the path name.</p><h4 
id="CamelJMX-Example:">Example:</h4><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext id=&quot;camel&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-  &lt;jmxAgent id=&quot;agent&quot; createConnector=&quot;true&quot; 
registryPort=&quot;2000&quot; 
mbeanServerDefaultDomain=&quot;org.apache.camel.test&quot;/&gt;
+</plain-text-body><p>To resolve this you should disable the JMX agent in 
Camel, see section <em>Disabling JMX instrumentation agent in Camel</em></p><h4 
id="CamelJMX-AdvancedJMXConfiguration">Advanced JMX Configuration</h4><p>The 
Spring configuration file allows you to configure how Camel is exposed to JMX 
for management. In some cases, you could specify more information here, like 
the connector's port or the path name.</p><h4 
id="CamelJMX-Example:">Example:</h4><plain-text-body>&lt;camelContext 
id="camel" xmlns="http://camel.apache.org/schema/spring"&gt;
+  &lt;jmxAgent id="agent" createConnector="true" registryPort="2000" 
mbeanServerDefaultDomain="org.apache.camel.test"/&gt;
     &lt;route&gt;
-      &lt;from uri=&quot;seda:start&quot;/&gt;
-      &lt;to uri=&quot;mock:result&quot;/&gt;
+      &lt;from uri="seda:start"/&gt;
+      &lt;to uri="mock:result"/&gt;
     &lt;/route&gt;
 &lt;/camelContext&gt;
-]]></script>
-</div></div><p>If you wish to change the Java 5 JMX settings you can use 
various <a shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html#properties";
 rel="nofollow">JMX system properties</a></p><p>For example you can enable 
remote JMX connections to the Sun JMX connector, via setting the following 
environment variable (using <strong>set</strong> or <strong>export</strong> 
depending on your platform). These settings only configure the Sun JMX 
connector within Java 1.5+, not the JMX connector that Camel creates by 
default.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[SUNJMX=-Dcom.sun.management.jmxremote=true 
-Dcom.sun.management.jmxremote.port=1616 \
+</plain-text-body><p>If you wish to change the Java 5 JMX settings you can use 
various <a shape="rect" class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html#properties";
 rel="nofollow">JMX system properties</a></p><p>For example you can enable 
remote JMX connections to the Sun JMX connector, via setting the following 
environment variable (using <strong>set</strong> or <strong>export</strong> 
depending on your platform). These settings only configure the Sun JMX 
connector within Java 1.5+, not the JMX connector that Camel creates by 
default.</p><plain-text-body>SUNJMX=-Dcom.sun.management.jmxremote=true 
-Dcom.sun.management.jmxremote.port=1616 \
 -Dcom.sun.management.jmxremote.authenticate=false 
-Dcom.sun.management.jmxremote.ssl=false
-]]></script>
-</div></div><p>(The&#160;<strong><code>SUNJMX</code></strong> environment 
variable is simple used by the startup script for Camel, as additional startup 
parameters for the JVM. If you start Camel directly, you'll have to pass these 
parameters yourself.)</p><h4 id="CamelJMX-jmxAgentPropertiesReference">jmxAgent 
Properties Reference</h4><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Spring property</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>System property</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>id</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>The JMX agent name, and i
 t is not optional.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>usePlatformMBeanServer</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.jmx.usePlatformMBeanServer</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code>, 
<code>true</code> - Release 1.5 or later</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>If <code>true</code>, it will use the 
<strong><code>MBeanServer</code></strong> from the JVM.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>mbeanServerDefaultDomain</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.jmx.mbeanServerDefaultDomain</code></p></td><td
 colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>The default JMX domain of the 
<strong><code>MBeanServer</code></strong>.</p></td></tr><tr><td colspan="1"
  rowspan="1" 
class="confluenceTd"><p><code>mbeanObjectDomainName</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.jmx.mbeanObjectDomainName</code></p></td><td
 colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>The JMX domain that all object names will 
use.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>createConnector</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.jmx.createRmiConnect</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>If we should create a JMX 
connector (to allow remote management) for the 
<strong><code>MBeanServer</code></strong>.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>registryPort</code></p></td><td 
colspan="1" rowspan="1" class="confluence
 Td"><p><code>org.apache.camel.jmx.rmiConnector.registryPort</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>1099</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The port that the JMX RMI 
registry will use.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>connectorPort</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.jmx.rmiConnector.connectorPort</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p>-1 (dynamic)</p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The port that the JMX RMI 
server will use.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>serviceUrlPath</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.jmx.serviceUrlPath</code></p></td><td
 colspan="1" rowspan="1" 
class="confluenceTd"><p><code>/jmxrmi/camel</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>T
 he path that JMX connector will be registered under.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>onlyRegisterProcessorWithCustomId</code></p></td><td
 colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.jmx.onlyRegisterProcessorWithCustomId</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.0:</strong> If 
this option is enabled then only processors with a custom id set will be 
registered. This allows you to filer out unwanted processors in the JMX 
console.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>statisticsLevel</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>All / Default</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.1:</strong> Configures the 
level for whether per
 formance statistics is enabled for the MBean. See section <em>Configuring 
level of granularity for performance statistics</em> for more details. 
</p><p><strong>From Camel 2.16</strong>: 
the&#160;<strong><code>All</code></strong> option is renamed to 
<strong><code>Default</code></strong>, and a 
new&#160;<strong><code>Extended</code></strong> option has been introduced 
which allows gathered additional run time JMX metrics.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>includeHostName</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.jmx.includeHostName</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.13:</strong> Whether to 
include the hostname in the MBean naming. <strong>From Camel 2.13</strong>: the 
default is <strong><code>false</code></strong>. Previously the default was 
<strong><code>true</code></strong>.</p><p>
 You can use this option to restore old behavior if really 
needed.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>useHostIPAddress</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.jmx.useHostIPAddress</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.16:</strong> 
Whether to use hostname or IP Address in the service url when creating the 
remote connector. By default the hostname will be used.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>loadStatisticsEnabled</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.jmx.loadStatisticsEnabled</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 
2.16:</strong>Whether load statistics is enabled 
 (gathers load statistics using a background thread per 
CamelContext).</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>endpointRuntimeStatisticsEnabled</code></p></td><td
 colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.jmx.endpointRuntimeStatisticsEnabled</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.16:</strong> 
Whether endpoint runtime statistics is enabled (gathers runtime usage of each 
incoming and outgoing endpoints).</p></td></tr></tbody></table></div><h4 
id="CamelJMX-ConfiguringWhethertoRegisterMBeansalways,ForNewRoutesorJustbyDefault">Configuring
 Whether to Register MBeans always, For New Routes or Just by 
Default</h4><p><strong>Available as of Camel 2.7</strong></p><p>Camel now 
offers 2 settings to control whether or not to register mbeans</p><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th c
 olspan="1" rowspan="1" class="confluenceTh"><p>Option</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>registerAlways</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>If enabled then MBeans is 
always registered.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>registerNewRoutes</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>If enabled then adding new routes after <a 
shape="rect" href="camelcontext.html">CamelContext</a> has been started will 
also register MBeans from that given 
route.</p></td></tr></tbody></table></div><p>By default Camel registers MBeans 
for all the routes configured when its starting.
  The <strong><code>registerNewRoutes</code></strong> option control if MBeans 
should also be registered if you add new routes thereafter. You can disable 
this, if you for example add and remove temporary routes where management is 
not needed.</p><p>Be a bit caution to use the 
<strong><code>registerAlways</code></strong> option when using dynamic <a 
shape="rect" href="eip.html">EIP</a> patterns such as the <a shape="rect" 
href="recipient-list.html">Recipient List</a> having unique endpoints. If so 
then each unique endpoint and its associated services/producers would also be 
registered. This could potential lead to degradation in system performance due 
the rising number of mbeans in the registry. A MBean is not a light-weight 
object and thus consumes memory.</p><h3 
id="CamelJMX-MonitoringCamelusingJMX">Monitoring Camel using JMX</h3><h4 
id="CamelJMX-UsingJConsoletomonitorCamel">Using JConsole to monitor 
Camel</h4><p>The <strong><code>CamelContext</code></strong> should appear in 
the l
 ist of local connections, if you are running JConsole on the same host as 
Camel.&#160; To connect to a remote Camel instance, or if the local process 
does not show up, use Remote Process option, and enter an URL.</p><p>Here is an 
example localhost 
URL:&#160;<strong><code>service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/camel</code></strong></p><p>Using
 the Apache Camel with JConsole</p><p><span 
class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image 
confluence-content-image-border" src="camel-jmx.data/camel-jmx.png" 
data-image-src="/confluence/download/attachments/85697/camel-jmx.png?version=1&amp;modificationDate=1224680681000&amp;api=v2"
 data-unresolved-comment-count="0" data-linked-resource-id="9224" 
data-linked-resource-version="1" data-linked-resource-type="attachment" 
data-linked-resource-default-alias="camel-jmx.png" 
data-base-url="https://cwiki.apache.org/confluence"; 
data-linked-resource-content-type="image/png" 
data-linked-resource-container-id="85
 697" data-linked-resource-container-version="85"></span></p><h4 
id="CamelJMX-Whichendpointsareregistered">Which endpoints are 
registered</h4><p>In <strong>Camel 2.1</strong> onward <strong>only</strong> 
<code>singleton</code> endpoints are registered as the overhead for non 
singleton will be substantial in cases where thousands or millions of endpoints 
are used. This can happens when using a <a shape="rect" 
href="recipient-list.html">Recipient List</a> EIP or from a 
<strong><code>ProducerTemplate</code></strong> that sends a lot of 
messages.</p><h4 id="CamelJMX-Whichprocessorsareregistered">Which processors 
are registered</h4><p>See <a shape="rect" 
href="why-is-my-processor-not-showing-up-in-jconsole.html">this FAQ</a>.</p><h4 
id="CamelJMX-HowtousetheJMXNotificationListenertolistenthecamelevents?">How to 
use the JMX NotificationListener to listen the camel events?</h4><p>The Camel 
notification events give a coarse grained overview what is happening. You can 
see lifecycle event from 
 context and endpoints and you can see exchanges being received by and sent to 
endpoints. From <strong>Camel 2.4</strong> you can use a custom JMX 
NotificationListener to listen the camel events.</p><p>First you need to set up 
a&#160;<strong><code>JmxNotificationEventNotifier</code></strong> before you 
start the CamelContext.</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-// Set up the JmxNotificationEventNotifier
-notifier = new JmxNotificationEventNotifier();
-notifier.setSource(&quot;MyCamel&quot;);
-notifier.setIgnoreCamelContextEvents(true);
-notifier.setIgnoreRouteEvents(true);
-notifier.setIgnoreServiceEvents(true);
-
-CamelContext context = new DefaultCamelContext(createRegistry());
-context.getManagementStrategy().addEventNotifier(notifier);
-
-]]></script>
-</div></div>Second you can register your listener for listening the event<div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-// register the NotificationListener
-ObjectName on = 
ObjectName.getInstance(&quot;org.apache.camel:context=camel-1,type=eventnotifiers,name=JmxEventNotifier&quot;);
-MyNotificationListener listener = new MyNotificationListener();   
-context.getManagementStrategy().getManagementAgent().getMBeanServer().addNotificationListener(on,
-    listener,                                                                  
                       
-    new NotificationFilter() {            
-        private static final long serialVersionUID = 1L;
-
-        public boolean isNotificationEnabled(Notification notification) {
-            return notification.getSource().equals(&quot;MyCamel&quot;);
-        }
-    }, null);
-
-]]></script>
-</div></div><h4 id="CamelJMX-UsingtheTracerMBeantogetfinegrainedtracing">Using 
the Tracer MBean to get fine grained tracing</h4><p>Additionally to the coarse 
grained notifications above <strong>Camel 2.9.0</strong> support JMX 
Notification for fine grained trace events. These can be found in the Tracer 
MBean. To activate fine grained tracing you first need to activate tracing on 
the context or on a route. This can either be done when configuring the context 
or on the context / route MBeans.</p><p>As a second step you have to set the 
<strong><code>jmxTraceNotifications</code></strong> attribute to 
<code>true</code> on the tracer. This can again be done when configuring the 
context or at run time on the tracer MBean.</p><p>Now you can register 
for&#160;<code>TraceEvent</code> Notifications on the Tracer MBean using 
JConsole. There will be one Notification for every step on the route with all 
exchange and message details.</p><p><span 
class="confluence-embedded-file-wrapper"><img class=
 "confluence-embedded-image confluence-content-image-border" 
src="camel-jmx.data/jconsole_trace_notifications.png" 
data-image-src="/confluence/download/attachments/85697/jconsole_trace_notifications.png?version=1&amp;modificationDate=1317961747000&amp;api=v2"
 data-unresolved-comment-count="0" data-linked-resource-id="28016788" 
data-linked-resource-version="1" data-linked-resource-type="attachment" 
data-linked-resource-default-alias="jconsole_trace_notifications.png" 
data-base-url="https://cwiki.apache.org/confluence"; 
data-linked-resource-content-type="image/png" 
data-linked-resource-container-id="85697" 
data-linked-resource-container-version="85"></span></p><h3 
id="CamelJMX-UsingJMXforyourownCamelCode">Using JMX for your own Camel 
Code</h3><h4 id="CamelJMX-RegisteringyourownManagedEndpoints">Registering your 
own Managed Endpoints</h4><p><strong>Available as of Camel 2.0</strong><br 
clear="none"> You can decorate your own endpoints with Spring managed 
annotations <strong><code>@Manage
 dResource</code></strong> to allow to register them in the Camel 
<strong><code>MBeanServer</code></strong> and thus access your custom MBeans 
using JMX.<br clear="none"> <strong>Notice:</strong> in <strong>Camel 
2.1</strong> we have changed this to apply other than just endpoints but then 
you need to implement the interface 
<strong><code>org.apache.camel.spi.ManagementAware</code></strong> as well. 
More about this later.</p><p>For example we have the following custom endpoint 
where we define some options to be managed:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-@ManagedResource(description = &quot;Our custom managed endpoint&quot;)
-public class CustomEndpoint extends MockEndpoint implements 
ManagementAware&lt;CustomEndpoint&gt; {
-
-    public CustomEndpoint(final String endpointUri, final Component component) 
{
-        super(endpointUri, component);
-    }
-
-    public Object getManagedObject(CustomEndpoint object) {
-        return this;
-    }
-
-    public boolean isSingleton() {
-        return true;
-    }
-
-    protected String createEndpointUri() {
-        return &quot;custom&quot;;
-    }
-
-    @ManagedAttribute
-    public String getFoo() {
-        return &quot;bar&quot;;
-    }
-
-    @ManagedAttribute
-    public String getEndpointUri() {
-        return super.getEndpointUri();
-    }
-}
-]]></script>
-</div></div><strong>From Camel 2.9:</strong> it's encouraged that you use the 
<strong><code>@ManagedResource</code></strong>, 
<strong><code>@ManagedAttribute</code></strong>, and 
<strong><code>@ManagedOperation</code></strong> attributes from the 
<strong><code>org.apache.camel.api.management</code></strong> package. This 
allows your custom code to not depend on Spring JARs.<h4 
id="CamelJMX-ProgrammingyourownManagedServices">Programming your own Managed 
Services</h4><p><strong>Available as of Camel 2.1</strong></p><p>Camel now 
offers to use your own MBeans when registering services for management. What 
that means is for example you can develop a custom Camel component and have it 
expose MBeans for endpoints, consumers and producers etc. All you need to do is 
to implement the interface 
<strong><code>org.apache.camel.spi.ManagementAware</code></strong> and return 
the managed object Camel should use.</p><p>Now before you think oh boys the JMX 
API is really painful and terrible, then yea
 h you are right. Lucky for us Spring though too and they created a range of 
annotations you can use to export management on an existing bean. That means 
that you often use that and just return <code>this</code> in the 
<strong><code>getManagedObject</code></strong> from the 
<strong><code>ManagementAware</code></strong> interface. For an example see the 
code example above with the 
<strong><code>CustomEndpoint</code></strong>.</p><p>Now in <strong>Camel 
2.1</strong> you can do this for all the objects that Camel registers for 
management which are quite a bunch, but not all.</p><p>For services which do 
not implement this <strong><code>ManagementAware</code></strong> interface then 
Camel will fallback to using default wrappers as defined in the table 
below:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th 
colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>MBean wrapper</p></th></tr><tr><td 
colspan="1" r
 owspan="1" class="confluenceTd"><p><code>CamelContext</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>ManagedCamelContext</code></p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Component</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>ManagedComponent</code></p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Endpoint</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>ManagedEndpoint</code></p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Consumer</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>ManagedConsumer</code></p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Producer</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>ManagedProducer</code></p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>Route</code></p></td><td 
colspan="1" rowspan="
 1" class="confluenceTd"><p><code>ManagedRoute</code></p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Processor</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>ManagedProcessor</code></p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>Tracer</code></p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>ManagedTracer</code></p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Service</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>ManagedService</code></p></td></tr></tbody></table></div><p>In
 addition to that there are some extended wrappers for specialized types such 
as</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th 
colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>MBean wrapper</p></th></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>ScheduledPol
 lConsumer</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>ManagedScheduledPollConsumer</code></p></td></tr><tr><td
 colspan="1" rowspan="1" 
class="confluenceTd"><p><code>BrowsableEndpoint</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>ManagedBrowseableEndpoint</code></p></td></tr><tr><td
 colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Throttler</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>ManagedThrottler</code></p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>Delayer</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>ManagedDelayer</code></p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>SendProcessor</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>ManagedSendProcessor</code></p></td></tr></tbody></table></div><p>And
 in the future we will add additional wrappers for more EIP patterns.</p><h4 
id="CamelJM
 X-ManagementNamingStrategy">ManagementNamingStrategy</h4><p><strong>Available 
as of Camel 2.1</strong></p><p>Camel provides a pluggable API for naming 
strategy by 
<strong><code>org.apache.camel.spi.ManagementNamingStrategy</code></strong>. A 
default implementation is used to compute the MBean names that all MBeans are 
registered with.</p><h4 id="CamelJMX-Managementnamingpattern">Management naming 
pattern</h4><p><strong>Available as of Camel 
2.10</strong></p><p><strong>From</strong> <strong>Camel 2.10</strong>: we made 
it easier to configure a naming pattern for the MBeans. The pattern is used as 
part of the <strong><code>ObjectName</code></strong> as they key after the 
domain name. By default Camel will use MBean names for the 
<strong><code>ManagedCamelContextMBean</code></strong> as follows:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[org.apache.camel:context=localhost/camel-1,type=context,name=camel-1
-]]></script>
-</div></div><p><strong>From Camel 2.13:</strong> 
the&#160;<strong><code>hostname</code></strong> is not included in the MBean 
names, so the above example would be as follows:</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[org.apache.camel:context=camel-1,type=context,name=camel-1
-]]></script>
-</div></div><p>If you configure a name on the 
<strong><code>CamelContext</code></strong> then that name is part of the 
<strong><code>ObjectName</code></strong> as well. For example if we 
have</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext id=&quot;myCamel&quot; 
...&gt;
-]]></script>
-</div></div><p>Then the MBean names will be as follows:</p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[org.apache.camel:context=localhost/myCamel,type=context,name=myCamel
-]]></script>
-</div></div><p>Now if there is a naming clash in the JVM, such as there 
already exists a MBean with that given name above, then Camel will by default 
try to auto correct this by finding a new free name in the 
<strong><code>JMXMBeanServer</code></strong> by using a counter. As shown below 
the counter is now appended, so we have <strong><code>myCamel-1</code></strong> 
as part of the <strong><code>ObjectName</code>:</strong></p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[org.apache.camel:context=localhost/myCamel-1,type=context,name=myCamel
-]]></script>
-</div></div><p>This is possible because Camel uses a naming pattern by default 
that supports the following tokens</p><ul 
class="alternate"><li><code>#camelId#</code> = the CamelContext id (eg the 
name)</li><li><code>#name#</code> - same as 
#camelId#</li><li><code>#counter#</code> - an incrementing 
counter</li><li><code>#bundleId#</code> - the OSGi bundle id (only for OSGi 
environments)</li><li><code>#symbolicName#</code> - the OSGi symbolic name 
(only for OSGi environments)</li><li><code>#version#</code> - the OSGi bundle 
version (only for OSGi environments)</li></ul><p>The default naming pattern is 
differentiated between OSGi and non-OSGi as follows:</p><ul 
class="alternate"><li>non 
OSGI:&#160;<code>#name#</code></li><li>OSGi:&#160;<code>#bundleId#-#name#</code></li><li>OSGi
 <strong>Camel 
2.13:</strong>&#160;<code>#symbolicName#</code></li></ul><p>However if there is 
a naming clash in the <strong><code>JMXMBeanServer</code></strong> then Camel 
will automatic fallback and use the #c
 ounter# in the pattern to remedy this. And thus the following patterns will 
then be used:</p><ul class="alternate"><li>non 
OSGI:&#160;<code>#name#-#counter#</code></li><li>OSGi:&#160;<code>#bundleId#-#name#-#counter#</code></li><li>OSGi
 <strong>Camel 
2.13:</strong>&#160;<code>#symbolicName#-#counter#</code></li></ul><p>If you 
set an explicit naming pattern, then that pattern is always used, and the 
default patterns above is <strong>not</strong> used. This allows us to have 
full control, very easily, of the naming for both the 
<strong><code>CamelContext</code></strong> id in the <a shape="rect" 
href="registry.html">Registry</a> as well the JMX MBeans in the 
<strong><code>JMXMBeanRegistry</code></strong>.</p><p>From&#160;<strong>Camel 
2.15</strong> onwards you can configure the default management name pattern 
using a JVM system property, to configure this globally for the JVM. Notice 
that you can override this pattern by configure it explicit, as shown in the 
examples further below.</
 p><p>Set a JVM system property to use a default management name pattern that 
prefixes the name with cool.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[System.setProperty(JmxSystemPropertyKeys.MANAGEMENT_NAME_PATTERN,
 &quot;cool-#name#&quot;);]]></script>
-</div></div><p>&#160;</p><p>So if we want to explicit name both the 
<strong><code>CamelContext</code></strong> and to use fixed MBean names, that 
do not change e.g., has no counters, then we can use the new 
<strong><code>managementNamePattern</code></strong> attribute:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext id=&quot;myCamel&quot; 
managementNamePattern=&quot;#name#&quot;&gt;
-]]></script>
-</div></div><p>Then the MBean names will always be as follows:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[org.apache.camel:context=localhost/myCamel,type=context,name=myCamel
-]]></script>
-</div></div><p>In Java, you can configure the 
<strong><code>managementNamePattern</code></strong> as follows:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[context.getManagementNameStrategy().setNamePattern(&quot;#name#&quot;);
-]]></script>
-</div></div><p>You can also use a different name in the 
<strong><code>managementNamePattern</code></strong> than the id, so for example 
we can do:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext id=&quot;myCamel&quot; 
managementNamePattern=&quot;coolCamel&quot;&gt;
-]]></script>
-</div></div><p>You may want to do this in OSGi environments in case you do not 
want the OSGi bundle id as part of the MBean names. As the OSGi bundle id can 
change if you restart the server, or uninstall and install the same 
application. You can then do as follows to not use the OSGi bundle id as part 
of the name:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext id=&quot;myCamel&quot; 
managementNamePattern=&quot;#name#&quot;&gt;
-]]></script>
-</div></div><p>Note this requires that <strong><code>myCamel</code></strong> 
is unique in the entire JVM. If you install a 2nd Camel application that has 
the same <strong><code>CamelContext</code></strong> id and 
<strong><code>managementNamePattern</code></strong> then Camel will fail upon 
starting, and report a MBean already exists exception.</p><h4 
id="CamelJMX-ManagementStrategy">ManagementStrategy</h4><p><strong>Available as 
of Camel 2.1</strong></p><p>Camel now provides a totally pluggable management 
strategy that allows you to be 100% in control of management. It is a rich 
interface with many methods for management. Not only for adding and removing 
managed objects from the <strong><code>MBeanServer</code></strong>, but also 
event notification is provided as well using the 
<strong><code>org.apache.camel.spi.EventNotifier</code></strong> API. What it 
does, for example, is make it easier to provide an adapter for other management 
products. In addition, it also allows you to provi
 de more details and features that are provided out of the box at 
Apache.</p><h4 
id="CamelJMX-Configuringlevelofgranularityforperformancestatistics">Configuring 
level of granularity for performance statistics</h4><p><strong>Available as of 
Camel 2.1</strong></p><p>You can now set a pre set level whether performance 
statistics is enabled or not when Camel start ups. The levels are</p><ul 
class="alternate"><li><p><span><strong><code>Extended</code></strong>&#160;- As 
default but with additional statistics gathered during runtime such as fine 
grained level of usage of endpoints and more. This options requires&#160;Camel 
2.16 *</span></p></li><li><strong><span style="font-family: monospace;">All / 
Default</span></strong>&#160;- Camel will enable statistics for both routes and 
processors (fine grained). <strong>From&#160;Camel 2.16</strong>: 
the&#160;<strong><code>All</code></strong> option was renamed to 
<strong><code>Default</code></strong>.</li><li><strong><code>RoutesOnly</code></stro
 ng> - Camel will only enable statistics for routes (coarse 
grained)</li><li><strong><code>Off</code></strong> - Camel will not enable 
statistics for any.</li></ul><p>From <strong>Camel 2.9</strong> onwards the 
performance statistics also include average load statistics per CamelContext 
and Route MBeans. The statistics is average load based on the number of 
in-flight exchanges, on a per 1, 5, and 15 minute rate. This is similar to load 
statistics on Unix systems. <strong>Camel 2.11</strong> onwards allows you to 
explicit disable load performance statistics by setting 
<strong><code>loadStatisticsEnabled=false</code></strong> on the 
<strong><code>&lt;jmxAgent&gt;</code></strong>. Note that it will be off if the 
statics level is configured to off as well. From <strong>Camel 2.13</strong> 
onwards the load performance statistics is by default disabled. You can enable 
this by 
setting&#160;<strong><code>loadStatisticsEnabled=true</code></strong>&#160;on 
the <strong><code>&lt;jmxAgent&gt;</c
 ode></strong>.</p><p>At runtime you can always use the management console 
(such as JConsole) to change on a given route or processor whether its 
statistics are enabled or not.</p><div class="confluence-information-macro 
confluence-information-macro-information"><p class="title">What does statistics 
enabled mean?</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>Statistics enabled means that 
Camel will do fine grained performance statistics for that particular MBean. 
The statistics you can see are many, such as: number of exchanges 
completed/failed, last/total/mina/max/mean processing time, first/last failed 
time, etc.</p></div></div><p>Using Java DSL you set this level by:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[// only enable routes when Camel starts

[... 45 lines stripped ...]

Reply via email to