camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r939502 - in /websites/production/camel/content: cache/main.pageCache camel-jmx.html
Date Mon, 09 Feb 2015 08:18:14 GMT
Author: buildbot
Date: Mon Feb  9 08:18:14 2015
New Revision: 939502

Log:
Production update by buildbot for camel

Modified:
    websites/production/camel/content/cache/main.pageCache
    websites/production/camel/content/camel-jmx.html

Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.

Modified: websites/production/camel/content/camel-jmx.html
==============================================================================
--- websites/production/camel/content/camel-jmx.html (original)
+++ websites/production/camel/content/camel-jmx.html Mon Feb  9 08:18:14 2015
@@ -87,11 +87,11 @@
         <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.<br clear="none"> 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><style type="text/css">/*<![CDATA[*/
-div.rbtoc1415539182254 {padding: 0px;}
-div.rbtoc1415539182254 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1415539182254 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1423469843024 {padding: 0px;}
+div.rbtoc1423469843024 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1423469843024 li {margin-left: 0px;padding-left: 0px;}
 
-/*]]>*/</style></p><div class="toc-macro rbtoc1415539182254">
+/*]]>*/</style></p><div class="toc-macro rbtoc1423469843024">
 <ul class="toc-indentation"><li><a shape="rect" href="#CamelJMX-CamelJMX">Camel
JMX</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#CamelJMX-ActivatingJMXinCamel">Activating
JMX in Camel</a>
 <ul class="toc-indentation"><li><a shape="rect" href="#CamelJMX-UsingJMXtomanageApacheCamel">Using
JMX to manage Apache Camel</a></li><li><a shape="rect" href="#CamelJMX-DisablingJMXinstrumentationagentinCamel">Disabling
JMX instrumentation agent in Camel</a></li><li><a shape="rect" href="#CamelJMX-LocatingaMBeanServerintheJavaVM">Locating
a MBeanServer in the Java VM</a></li><li><a shape="rect" href="#CamelJMX-CreatingJMXRMIConnectorServer">Creating
JMX RMI Connector Server</a></li><li><a shape="rect" href="#CamelJMX-JMXServiceURL">JMX
Service URL</a></li><li><a shape="rect" href="#CamelJMX-TheSystemPropertiesforCamelJMXsupport">The
System Properties for Camel JMX support</a></li><li><a shape="rect" href="#CamelJMX-HowtouseauthenticationwithJMX">How
to use authentication with JMX</a></li><li><a shape="rect" href="#CamelJMX-JMXinsideanApplicationServer">JMX
inside an Application Server</a>
@@ -240,7 +240,7 @@ java.lang.SecurityException: Unauthorize
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[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 SUNJMX 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 it 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 <code>MBeanServer</code> 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 <code>MBeanServer</code></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 <code>MBeanServer</code></p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>registryPort</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><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>The 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</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.1:</strong>
Configures the level for whether performance statistics is enabled for the MBean. See section
<em>Configuring level of granularity for perfo
 rmance statistics</em> for more details.</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. From Camel 2.13 onwards this is default
<code>false</code>, where as in older releases its default <code>true</code>.
You can use this option to restore old behavior if really needed.</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-wr
 ap"><table class="confluenceTable"><tbody><tr><th colspan="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 MBea
 ns for all the routes configured when its starting. The <code>registerNewRoutes</code>
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 <code>registerAlways</code> 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 system degration 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 <code>CamelContext</code> should appear
in the list of local conn
 ections, if you are running JConsole on the same host as Camel.</p><p>To connect
to a remote Camel instance, or if the local process does not show up, use Remote Process option,
and enter an URL. Here is an example localhost URL:service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/camel</p><p>Using
the Apache Camel with JConsole</p><p><img class="confluence-embedded-image
confluence-content-image-border" src="https://cwiki.apache.org/confluence/download/attachments/85697/camel-jmx.png?version=1&amp;modificationDate=1224680681000&amp;api=v2"
data-image-src="/confluence/download/attachments/85697/camel-jmx.png?version=1&amp;modificationDate=1224680681000&amp;api=v2"></p><h4
id="CamelJMX-Whichendpointsareregistered">Which endpoints are registered</h4><p>In
<strong>Camel 2.1</strong> onwards <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 happen
 s when using a <a shape="rect" href="recipient-list.html">Recipient List</a>
EIP or from a <code>ProducerTemplate</code> 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.</p><p>From
<strong>Camel 2.4</strong> you can use a custom JMX NotificationListener to listen
the camel events.<br clear="none"> First you need to set up a JmxNotificationEventNotifier
before you start the CamelContext.</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelC
 ontent pdl">
+</div></div><p>(The SUNJMX 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 it 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 <code>MBeanServer</code> 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 <code>MBeanServer</code></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 <code>MBeanServer</code></p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>registryPort</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><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>The 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</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.1:</strong>
Configures the level for whether performance statistics is enabled for the MBean. See section
<em>Configuring level of granularity for perfo
 rmance statistics</em> for more details.</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. From Camel 2.13 onwards this is default
<code>false</code>, where as in older releases its default <code>true</code>.
You can use this option to restore old behavior if really needed.</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-wr
 ap"><table class="confluenceTable"><tbody><tr><th colspan="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 MBea
 ns for all the routes configured when its starting. The <code>registerNewRoutes</code>
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 <code>registerAlways</code> 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 system degration 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 <code>CamelContext</code> should appear
in the list of local conn
 ections, if you are running JConsole on the same host as Camel.</p><p>To connect
to a remote Camel instance, or if the local process does not show up, use Remote Process option,
and enter an URL. Here is an example localhost URL:service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/camel</p><p>Using
the Apache Camel with JConsole</p><p><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"></p><h4
id="CamelJMX-Whichendpointsareregistered">Which endpoints are registered</h4><p>In
<strong>Camel 2.1</strong> onwards <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 <code>Produce
 rTemplate</code> 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.</p><p>From
<strong>Camel 2.4</strong> you can use a custom JMX NotificationListener to listen
the camel events.<br clear="none"> First you need to set up a JmxNotificationEventNotifier
before you start the CamelContext.</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 // Set up the JmxNotificationEventNotifier
 notifier = new JmxNotificationEventNotifier();
@@ -273,7 +273,7 @@ context.getManagementStrategy().getManag
     }, 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.<br clear="none"> 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.<br clear="none"> 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 <code>jmxTraceNotifications</code>
attribute to <code>true</code> on the tracer. This can again be done when configuring
the context or at runtime on the tracer MBean.</p><p>Now you can register for
TraceEvent 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><img
class="confluence-embedded-image confluence-content-ima
 ge-border" src="https://cwiki.apache.org/confluence/download/attachments/85697/jconsole_trace_notifications.png?version=1&amp;modificationDate=1317961747000&amp;api=v2"
data-image-src="/confluence/download/attachments/85697/jconsole_trace_notifications.png?version=1&amp;modificationDate=1317961747000&amp;api=v2"></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 <code>@ManagedResource</code> to allow to register
them in the Camel <code>MBeanServer</code> 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 <code>org.apache.camel.spi.ManagementAware</code> as
we
 ll. 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">
+</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.<br clear="none"> 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.<br clear="none"> 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 <code>jmxTraceNotifications</code>
attribute to <code>true</code> on the tracer. This can again be done when configuring
the context or at runtime on the tracer MBean.</p><p>Now you can register for
TraceEvent 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><img
class="confluence-embedded-image confluence-content-ima
 ge-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"></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 <code>@ManagedResource</code> to allow to register
them in the Camel <code>MBeanServer</code> 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 <code>org.apache.camel.spi.ManagementAware</code> 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="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 @ManagedResource(description = &quot;Our custom managed endpoint&quot;)
 public class CustomEndpoint extends MockEndpoint implements ManagementAware&lt;CustomEndpoint&gt;
{
@@ -320,7 +320,9 @@ public class CustomEndpoint extends Mock
 </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 <code>JMXMBeanServer</code> by
using a counter. As shown below the counter is now appended, so we have <code>myCamel-1</code>
as part of the <code>ObjectName</code>:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="theme: Default; brush: java; gutter: false" 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>#camelId#
= the CamelContext id (eg the name)</li><li>#name# - same as #camelId#</li><li>#counter#
- an incrementing counter</li><li>#bundleId# - the OSGi bundle id (only for OSGi
environments)</li><li>#symbolicName# - the OSGi symbolic name (only for OSGi environments)</li><li>#version#
- 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: #name#</li><li>OSGi: #bundleId#-#name#</li><li>OSGi <strong>Camel
2.13:</strong> #symbolicName#</li></ul><p>However if there is a naming
clash in the <code>JMXMBeanServer</code> then Camel will automatic fallback and
use the #counter# in the pattern to remedy this. And thus the following patterns will then
be used:</p><ul class="alternate"><li>non OSGI: #name#-#counter#</li
 ><li>OSGi: #bundleId#-#name#-#counter#</li><li>OSGi <strong>Camel
2.13:</strong> #symbolicName#-#counter#</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.<br clear="none"> This allows us to have full
control, very easily, of the naming for both the <code>CamelContext</code> id
in the <a shape="rect" href="registry.html">Registry</a> as well the JMX MBeans
in the <code>JMXMBeanRegistry</code>.</p><p>So if we want to explicit
name both the <code>CamelContext</code> and to use fixed MBean names, that do
not change (eg has no counters), then we can use the new <code>managementNamePattern</code>
attribute:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+</div></div><p>This is possible because Camel uses a naming pattern by
default that supports the following tokens</p><ul class="alternate"><li>#camelId#
= the CamelContext id (eg the name)</li><li>#name# - same as #camelId#</li><li>#counter#
- an incrementing counter</li><li>#bundleId# - the OSGi bundle id (only for OSGi
environments)</li><li>#symbolicName# - the OSGi symbolic name (only for OSGi environments)</li><li>#version#
- 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: #name#</li><li>OSGi: #bundleId#-#name#</li><li>OSGi <strong>Camel
2.13:</strong> #symbolicName#</li></ul><p>However if there is a naming
clash in the <code>JMXMBeanServer</code> then Camel will automatic fallback and
use the #counter# in the pattern to remedy this. And thus the following patterns will then
be used:</p><ul class="alternate"><li>non OSGI: #name#-#counter#</li
 ><li>OSGi: #bundleId#-#name#-#counter#</li><li>OSGi <strong>Camel
2.13:</strong> #symbolicName#-#counter#</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.<br clear="none"> This allows us to have full
control, very easily, of the naming for both the <code>CamelContext</code> id
in the <a shape="rect" href="registry.html">Registry</a> as well the JMX MBeans
in the <code>JMXMBeanRegistry</code>.</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="theme: Default; brush: java; gutter: false" 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 <code>CamelContext</code> and to use fixed MBean names, that do not change
(eg has no counters), then we can use the new <code>managementNamePattern</code>
attribute:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
 <script class="theme: Default; brush: xml; gutter: false" 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">



Mime
View raw message