Modified: websites/production/camel/content/camel-jmx.html ============================================================================== --- websites/production/camel/content/camel-jmx.html (original) +++ websites/production/camel/content/camel-jmx.html Tue Sep 26 19:19:34 2017 @@ -140,7 +140,7 @@ java.lang.SecurityException: Unauthorize </camelContext> </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 -</plain-text-body><p>(The <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> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </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 <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 colsp an="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="conf luenceTd"><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> </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 wheth er performance 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 <strong><code>All</code></strong> option is renamed to <strong><code>Default</code></strong>, and a new <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> </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 en abled (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 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 >MBeans for all the routes configured when its sta rting. 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 list of local connections, if you are running JConsole on the same host as Camel.  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: <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&modificationDate=1224680681000&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="85697" data-linked-resource-container-version="86"></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 <strong><code>JmxNotificationEventNotifier</code></strong> before you start the CamelContext.<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java}</plain-text-body>Second you can register your listener for listening the event<plain-text-body>{snippet:id=e2|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java}</plain-text-body></p><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 c an 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 <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&modificationDate=1317961747000&api=v2" data-unresolved-com ment-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="86"></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>@ManagedResource</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 endpoin ts 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:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/management/CustomEndpoint.java}</plain-text-body><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.</p><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 t hat 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 yeah 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" rowspan="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>ScheduledPollConsumer</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="CamelJMX-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><plain-text-body>org.apache.camel:context=localhost/camel-1,type=context,name=camel-1 +</plain-text-body><p>(The <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> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </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 <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 colsp an="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="conf luenceTd"><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> </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 wheth er performance 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 <strong><code>All</code></strong> option is renamed to <strong><code>Default</code></strong>, and a new <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> </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 en abled (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 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 >MBeans for all the routes configured when its sta rting. 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 list of local connections, if you are running JConsole on the same host as Camel.  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: <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&modificationDate=1224680681000&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="85697" data-linked-resource-container-version="87"></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 <strong><code>JmxNotificationEventNotifier</code></strong> before you start the CamelContext.<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java}</plain-text-body>Second you can register your listener for listening the event<plain-text-body>{snippet:id=e2|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java}</plain-text-body></p><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 c an 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 <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&modificationDate=1317961747000&api=v2" data-unresolved-com ment-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="87"></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>@ManagedResource</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 endpoin ts 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:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/management/CustomEndpoint.java}</plain-text-body><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.</p><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 t hat 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 yeah 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" rowspan="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>ScheduledPollConsumer</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="CamelJMX-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><plain-text-body>org.apache.camel:context=localhost/camel-1,type=context,name=camel-1 </plain-text-body><p><strong>From Camel 2.13:</strong> the <strong><code>hostname</code></strong> is not included in the MBean names, so the above example would be as follows:</p><plain-text-body>org.apache.camel:context=camel-1,type=context,name=camel-1 </plain-text-body><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><parameter ac:name="">xml</parameter><plain-text-body><camelContext id="myCamel" ...> </plain-text-body><p>Then the MBean names will be as follows:</p><plain-text-body>org.apache.camel:context=localhost/myCamel,type=context,name=myCamel
Modified: websites/production/camel/content/console-example.html ============================================================================== --- websites/production/camel/content/console-example.html (original) +++ websites/production/camel/content/console-example.html Tue Sep 26 19:19:34 2017 @@ -109,7 +109,7 @@ Enter something: <p>Next, navigate to the <code>org.apache.camel.example.console.CamelConsoleMain</code> class, right-click, and select Run As → Java Application.</p> <rich-text-body> <p>Click on the screenshot below, to make it bigger.</p></rich-text-body> -<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image confluence-thumbnail" src="console-example.thumbs/run-as.png" data-image-src="/confluence/download/attachments/27843710/run-as.png?version=1&modificationDate=1334026057000&api=v2" data-unresolved-comment-count="0" data-linked-resource-id="28017569" data-linked-resource-version="1" data-linked-resource-type="attachment" data-linked-resource-default-alias="run-as.png" data-base-url="https://cwiki.apache.org/confluence" data-linked-resource-content-type="image/png" data-linked-resource-container-id="27843710" data-linked-resource-container-version="21"></span></p> +<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image confluence-thumbnail" src="console-example.thumbs/run-as.png" data-image-src="/confluence/download/attachments/27843710/run-as.png?version=1&modificationDate=1334026057000&api=v2" data-unresolved-comment-count="0" data-linked-resource-id="28017569" data-linked-resource-version="1" data-linked-resource-type="attachment" data-linked-resource-default-alias="run-as.png" data-base-url="https://cwiki.apache.org/confluence" data-linked-resource-content-type="image/png" data-linked-resource-container-id="27843710" data-linked-resource-container-version="22"></span></p> <h3 id="ConsoleExample-Seealso">See also</h3> Modified: websites/production/camel/content/debugger.html ============================================================================== --- websites/production/camel/content/debugger.html (original) +++ websites/production/camel/content/debugger.html Tue Sep 26 19:19:34 2017 @@ -76,7 +76,7 @@ <tr> <td valign="top" width="100%"> <div class="wiki-content maincontent"><h2 id="Debugger-Debugger">Debugger</h2><p><strong>Available as of Camel 2.6</strong></p><p>Camel <a shape="rect" href="debugger.html">Debugger</a> is much related to <a shape="rect" href="tracer.html">Tracer</a>, in fact they are sisters. Debugger is a enhanced tracer with a debugger framework so that tooling can be developed to easily monitor Camel routes, trace messages and set breakpoints at points in a route etc.</p><rich-text-body><p>There is also a <a shape="rect" href="backlogdebugger.html">BacklogDebugger</a> which allows to debug from JMX, and 3rd party tooling.</p></rich-text-body><h3 id="Debugger-AbouttheDebugger">About the Debugger</h3><p>The Debugger allows tooling or the likes to attach breakpoints which is being invoked when <a shape="rect" href="exchange.html">Exchange</a>s are being routed.</p><h3 id="Debugger-DefaultImplementation">Default Implementation</h3><p>Camel provides a default implementation <strong><code>org.apache.c amel.impl.DefaultDebugger</code></strong> which you can set on the <strong><code>CamelContext</code></strong> using the <strong><code>setDebugger</code></strong> method. Likewise you can get hold of the <a shape="rect" href="debugger.html">Debugger</a> using the <strong><code>getDebugger</code></strong> method on <strong><code>CamelContext</code></strong>.</p><p>The <strong><code>org.apache.camel.spi.Debugger</code></strong> has methods to attach and remove breakpoints. And to suspend/resume all breakpoints etc. You can also attach a condition to the breakpoint so it only reacts if the condition matches.</p><h3 id="Debugger-DebuggingCamelRoutesUsingcamel-test">Debugging Camel Routes Using <code>camel-test</code></h3><p>If you are developing unit tests using the <strong><code>camel-test</code></strong> component, then the <a shape="rect" href="debugger.html">Debugger</a> comes out of the box. From <strong>Camel 2.9</strong>: you would need to explicit enable the debugger, by overridi ng <strong><code>isUseDebugger()</code></strong> method and return <strong><code>true</code></strong>.</p><h4 id="Debugger-Example">Example</h4><p>In this unit test</p><plain-text-body>public class DebugTest extends CamelTestSupport -</plain-text-body><p>We want to debug the following route:<plain-text-body>{snippet:id=e2|lang=java|url=camel/trunk/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugTest.java}</plain-text-body>Which can easily done by overriding the <strong><code>debugBefore</code></strong> method as shown:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugTest.java}</plain-text-body>Then from your Java editor just add a breakpoint inside the <strong><code>debugBefore</code></strong> method. Then fire up the unit test and wait for the Java editor to hit the breakpoint. Then you can inspect the <a shape="rect" href="exchange.html">Exchange</a> during debugging while it advances during routing. The <strong><code>ProcessorDefinition</code></strong> and the <strong><code>id</code></strong> and <strong><code>shortName</code></strong> parameters is all information which tells you where in the route the br eakpoint was hit.</p><rich-text-body><p>There is also a <strong><code>debugAfter</code></strong> method which is invoked after the processor has been invoked. This allows you to <em>see</em> what happens to the <a shape="rect" href="exchange.html">Exchange</a> right after it has invoked a processor in the route.</p></rich-text-body><p>The screenshot below shows the <a shape="rect" href="debugger.html">Debugger</a> in action. The IDE (IDEA) has hit the breakpoint and we can inspect the parameters. Notice how we can see that the message is to be send to the <strong><code>mock:a</code></strong> endpoint:</p><p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="debugger.data/debug.png" data-image-src="/confluence/download/attachments/86210/debug.png?version=1&modificationDate=1288586116000&api=v2" data-unresolved-comment-count="0" data-linked-resource-id="24346680" data-linked-resource-version="1" data-linked-resource-type="attachment " data-linked-resource-default-alias="debug.png" data-base-url="https://cwiki.apache.org/confluence" data-linked-resource-content-type="image/png" data-linked-resource-container-id="86210" data-linked-resource-container-version="39"></span></p><h3 id="Debugger-SeeAlso">See Also</h3><ul class="alternate"><li><a shape="rect" href="tracer.html">Tracer</a></li><li><a shape="rect" href="backlogdebugger.html">BacklogDebugger</a></li></ul></div> +</plain-text-body><p>We want to debug the following route:<plain-text-body>{snippet:id=e2|lang=java|url=camel/trunk/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugTest.java}</plain-text-body>Which can easily done by overriding the <strong><code>debugBefore</code></strong> method as shown:<plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/components/camel-test/src/test/java/org/apache/camel/test/patterns/DebugTest.java}</plain-text-body>Then from your Java editor just add a breakpoint inside the <strong><code>debugBefore</code></strong> method. Then fire up the unit test and wait for the Java editor to hit the breakpoint. Then you can inspect the <a shape="rect" href="exchange.html">Exchange</a> during debugging while it advances during routing. The <strong><code>ProcessorDefinition</code></strong> and the <strong><code>id</code></strong> and <strong><code>shortName</code></strong> parameters is all information which tells you where in the route the br eakpoint was hit.</p><rich-text-body><p>There is also a <strong><code>debugAfter</code></strong> method which is invoked after the processor has been invoked. This allows you to <em>see</em> what happens to the <a shape="rect" href="exchange.html">Exchange</a> right after it has invoked a processor in the route.</p></rich-text-body><p>The screenshot below shows the <a shape="rect" href="debugger.html">Debugger</a> in action. The IDE (IDEA) has hit the breakpoint and we can inspect the parameters. Notice how we can see that the message is to be send to the <strong><code>mock:a</code></strong> endpoint:</p><p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="debugger.data/debug.png" data-image-src="/confluence/download/attachments/86210/debug.png?version=1&modificationDate=1288586116000&api=v2" data-unresolved-comment-count="0" data-linked-resource-id="24346680" data-linked-resource-version="1" data-linked-resource-type="attachment " data-linked-resource-default-alias="debug.png" data-base-url="https://cwiki.apache.org/confluence" data-linked-resource-content-type="image/png" data-linked-resource-container-id="86210" data-linked-resource-container-version="40"></span></p><h3 id="Debugger-SeeAlso">See Also</h3><ul class="alternate"><li><a shape="rect" href="tracer.html">Tracer</a></li><li><a shape="rect" href="backlogdebugger.html">BacklogDebugger</a></li></ul></div> </td> <td valign="top"> <div class="navigation"> Modified: websites/production/camel/content/pojo-messaging-example.html ============================================================================== --- websites/production/camel/content/pojo-messaging-example.html (original) +++ websites/production/camel/content/pojo-messaging-example.html Tue Sep 26 19:19:34 2017 @@ -99,7 +99,7 @@ mvn compile camel:run <p>When you start the example up you'll see a whole bunch of logs that won't really mean anything to you <img class="emoticon emoticon-smile" src="https://cwiki.apache.org/confluence/s/en_GB/5997/6f42626d00e36f53fe51440403446ca61552e2a2.1/_/images/icons/emoticons/smile.png" data-emoticon-name="smile" alt="(smile)"> The interesting stuff is happening in the background. Here's a diagram of whats going on.</p> -<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="pojo-messaging-example.data/pojo-messaging.jpg" data-image-src="/confluence/download/attachments/108577/pojo-messaging.jpg?version=1&modificationDate=1233062777000&api=v2" data-unresolved-comment-count="0" data-linked-resource-id="9645" data-linked-resource-version="1" data-linked-resource-type="attachment" data-linked-resource-default-alias="pojo-messaging.jpg" data-base-url="https://cwiki.apache.org/confluence" data-linked-resource-content-type="image/jpeg" data-linked-resource-container-id="108577" data-linked-resource-container-version="27"></span></p> +<p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="pojo-messaging-example.data/pojo-messaging.jpg" data-image-src="/confluence/download/attachments/108577/pojo-messaging.jpg?version=1&modificationDate=1233062777000&api=v2" data-unresolved-comment-count="0" data-linked-resource-id="9645" data-linked-resource-version="1" data-linked-resource-type="attachment" data-linked-resource-default-alias="pojo-messaging.jpg" data-base-url="https://cwiki.apache.org/confluence" data-linked-resource-content-type="image/jpeg" data-linked-resource-container-id="108577" data-linked-resource-container-version="28"></span></p> <p>At step 1 the <code>SendFileRecordsToQueueBean</code> polls the <code>./src/data</code> directory for new files. There are 3 files in this directory so 3 messages will be created. As shown below, the <a shape="rect" href="pojo-consuming.html"><code>@Consume</code></a> annotation will cause any new messages coming from the <code>file:src/data endpoint</code> to be sent to the <code>onFileSendToQueue</code> method.</p> Modified: websites/production/camel/content/route-throttling-example.html ============================================================================== --- websites/production/camel/content/route-throttling-example.html (original) +++ websites/production/camel/content/route-throttling-example.html Tue Sep 26 19:19:34 2017 @@ -150,7 +150,7 @@ For example you can change the option <code>maxInflightExchanges</code> while its running to find a more suitable value.</p> <p>The screenshot below illustrates it from a JConsole.<br clear="none"> -<span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="route-throttling-example.data/throttling%20services.png" data-image-src="/confluence/download/attachments/5604305/throttling%20services.png?version=1&modificationDate=1257166177000&api=v2" data-unresolved-comment-count="0" data-linked-resource-id="5865480" data-linked-resource-version="1" data-linked-resource-type="attachment" data-linked-resource-default-alias="throttling services.png" data-base-url="https://cwiki.apache.org/confluence" data-linked-resource-content-type="image/png" data-linked-resource-container-id="5604305" data-linked-resource-container-version="22"></span></p> +<span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="route-throttling-example.data/throttling%20services.png" data-image-src="/confluence/download/attachments/5604305/throttling%20services.png?version=1&modificationDate=1257166177000&api=v2" data-unresolved-comment-count="0" data-linked-resource-id="5865480" data-linked-resource-version="1" data-linked-resource-type="attachment" data-linked-resource-default-alias="throttling services.png" data-base-url="https://cwiki.apache.org/confluence" data-linked-resource-content-type="image/png" data-linked-resource-container-id="5604305" data-linked-resource-container-version="23"></span></p> <p>See more at <a shape="rect" href="camel-jmx.html">using JMX with Camel</a>.</p> Modified: websites/production/camel/content/tracer-example.html ============================================================================== --- websites/production/camel/content/tracer-example.html (original) +++ websites/production/camel/content/tracer-example.html Tue Sep 26 19:19:34 2017 @@ -78,7 +78,7 @@ <div class="wiki-content maincontent"><h2 id="TracerExample-TracerExample">Tracer Example</h2><h3 id="TracerExample-Introduction">Introduction</h3><p>This example demonstrates the <a shape="rect" href="tracer.html">Tracer</a>. <a shape="rect" href="tracer.html">Tracer</a> is a tracing feature build in camel core to log snapshots of <a shape="rect" href="exchange.html">Exchange</a>s while they are routed. This allows you to see:</p><ul class="alternate"><li>how a given <a shape="rect" href="exchange.html">Exchange</a> was routed</li><li>a snapshot of the content of the <a shape="rect" href="exchange.html">Exchange</a> at any given node it passed in the route</li></ul><p>When used Camel will by default log the snapshot at <strong><code>INFO</code></strong> level. This example demonstrates how to persist trace snapshots using <a shape="rect" href="jpa.html">JPA</a> into a database. This allows you to store this information and query them from a SQL prompt, giving you full power to analyze the data.</p><h3 id="TracerExample-Requirements">Requirements</h3><p>This requires Camel 2.0, the <strong><code>camel-jpa</code></strong> component and configuration of the target database.</p><h3 id="TracerExample-DataModel">Data Model</h3><p>Camel uses the <strong><code>org.apache.camel.processor.interceptor.JpaTraceEventMessage</code></strong> JPA @Entity as data model. This class has been enhanced with <a shape="rect" href="jpa.html">JPA</a> annotations.</p><p>The class has the following properties in the <a shape="rect" href="jpa.html">JPA</a> model:</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Property</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Body</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>S tring</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The <a shape="rect" href="exchange.html">Exchange</a> <strong><code>IN</code></strong> body dumped as a <strong><code>String</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>BodyType</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The <a shape="rect" href="exchange.html">Exchange</a> <strong><code>IN</code></strong> body java type such as <strong><code>String</code></strong>, <strong><code>org.w3c.Document</code></strong>, <strong><code>com.mycompany.MyOrder</code></strong> etc.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CausedByException</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The <a shape="rect" href="exchange.html">Ex change</a> exception (if any) dumped as a String including stacktrace.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ExchangeId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Unique id of the <a shape="rect" href="exchange.html">Exchange.</a></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ExchangePattern</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The <a shape="rect" href="exchange-pattern.html">Exchange Pattern</a> such as <strong><code>InOnly</code></strong> or <strong><code>InOut</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>FromEndpoint</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenc eTd"><p>the URI of the starting consumer the <a shape="rect" href="exchange.html">Exchange</a> was created (usually a from in the route).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Headers</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The <a shape="rect" href="exchange.html">Exchange</a> <strong><code>IN</code></strong> headers dumped as a <strong><code>String</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Id</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Long</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Primary key that is generated by the database.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>OutBody</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" cla ss="confluenceTd"><p>The <a shape="rect" href="exchange.html">Exchange</a> <strong><code>OUT</code></strong> body (if any) dumped as a <strong><code>String</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>OutBodyType</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The <a shape="rect" href="exchange.html">Exchange</a> <strong><code>OUT</code></strong> body (if any) java type such as <strong><code>String</code></strong>, <strong><code>org.w3c.Document</code></strong>, <strong><code>com.mycompany.MyOrder</code></strong> etc.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>OutHeaders</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The <a shape="rect" href="exchange.html">Exchange</a> <strong><code>OUT</c ode></strong> (if any) headers dumped as a <strong><code>String</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>PreviousNode</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong><code>id</code></strong> of the previous step in the route. Is <strong><code>null</code></strong> if there wasn't a previous node such as the start.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Properties</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The <a shape="rect" href="exchange.html">Exchange</a> properties dumped as a <strong><code>String</code></strong>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>ShortExchangeId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>String</code ></p></td><td colspan="1" rowspan="1" >class="confluenceTd"><p><strong><code>id</code></strong> of the <a >shape="rect" href="exchange.html">Exchange</a> without the machine >name.</p></td></tr><tr><td colspan="1" rowspan="1" >class="confluenceTd"><p><code>Timestamp</code></p></td><td colspan="1" >rowspan="1" class="confluenceTd"><p><code>Date</code></p></td><td colspan="1" >rowspan="1" class="confluenceTd"><p>Timestamp when the snapshot was >generated. Is the system time of the JMV in which Camel is >running.</p></td></tr><tr><td colspan="1" rowspan="1" >class="confluenceTd"><p><code>ToNode</code></p></td><td colspan="1" >rowspan="1" class="confluenceTd"><p><code>String</code></p></td><td >colspan="1" rowspan="1" >class="confluenceTd"><p><strong><code>id</code></strong> of the next step in >the route.</p></td></tr></tbody></table></div><p>The table name for >persisting trace events is: ><strong><code>CAMEL_MESSAGETRACED</code></strong></p><h3 >id="TracerExample-Configurationofthedatabase">Configur ation of the database</h3><p>The <a shape="rect" href="tracer.html">Tracer</a> uses standard <a shape="rect" href="jpa.html">JPA</a> configuration for setting the database. In the <strong><code>META-INF/persistence.xml</code></strong> file we setup the service unit and the database configuration as:<plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/examples/camel-example-tracer/src/main/resources/META-INF/persistence.xml}</plain-text-body>What is important is to add the <strong><code>JpaTraceEventMessage</code></strong> as a class in the <strong><code>persistence.xml</code></strong> file to register our data model:</p><parameter ac:name="">xml</parameter><plain-text-body><class>org.apache.camel.processor.interceptor.JpaTraceEventMessage</class> </plain-text-body><p>In this example we use Hibernate JPA and a HSQLDB as database.</p><h3 id="TracerExample-RunningtheExample">Running the Example</h3><p>The <strong><code>README.txt</code></strong> states how to run the example from either ANT or Maven.</p><p>Here we show running with Maven:</p><plain-text-body>mvn camel:run </plain-text-body><p>When the application starts it start:</p><ul class="alternate"><li>in the console</li><li>a GUI for browsing the SQL database</li></ul><p>Select the console where the application should prompt you to enter some words. Try entering: <strong><code>Camel</code></strong>. The application should respond with a text quote.</p><p>You can also enter multiple quotes separate with space, and the response should be the best quote based on the list of words given. See the file <strong><code>src/main/resources/META-INF/spring/camel-context.xml</code></strong> to give you an idea how it works.</p><p>You can enter: <strong><code>Camel Beer</code></strong> and it should be smart enough to find a quote for the beer <img class="emoticon emoticon-wink" src="https://cwiki.apache.org/confluence/s/en_GB/5997/6f42626d00e36f53fe51440403446ca61552e2a2.1/_/images/icons/emoticons/wink.png" data-emoticon-name="wink" alt="(wink)"></p><h3 id="TracerExample-SeeingtheTraceEvents">Seeing the Tr ace Events</h3><p>When the program was started a GUI application was started as well. Its a SQL prompt for the database. So try entering:</p><parameter ac:name="language">sql</parameter><plain-text-body>select * from camel_messagetraced -</plain-text-body><p>And it should return the list of trace events in the SQL.</p><p>We enter this SQL:</p><parameter ac:name="language">sql</parameter><plain-text-body>select id, shortExchangeId, previousNode, toNode, body from camel_messagetraced</plain-text-body><p>and get the output as the picture below:</p><p><br clear="none"> <span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="tracer-example.data/tracer_sql.png" data-image-src="/confluence/download/attachments/107823/tracer_sql.png?version=1&modificationDate=1232323775000&api=v2" data-unresolved-comment-count="0" data-linked-resource-id="9605" data-linked-resource-version="1" data-linked-resource-type="attachment" data-linked-resource-default-alias="tracer_sql.png" data-base-url="https://cwiki.apache.org/confluence" data-linked-resource-content-type="image/png" data-linked-resource-container-id="107823" data-linked-resource-container-version="27"></span></p><h3 id="TracerExample-R outing">Routing</h3><p>The diagram below illustrates the route diagram generated using <a shape="rect" href="visualisation.html">Visualisation</a>.<br clear="none"> <span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="tracer-example.data/tracer_dot.png" data-image-src="/confluence/download/attachments/107823/tracer_dot.png?version=1&modificationDate=1232326207000&api=v2" data-unresolved-comment-count="0" data-linked-resource-id="9606" data-linked-resource-version="1" data-linked-resource-type="attachment" data-linked-resource-default-alias="tracer_dot.png" data-base-url="https://cwiki.apache.org/confluence" data-linked-resource-content-type="image/png" data-linked-resource-container-id="107823" data-linked-resource-container-version="27"></span></p><p>We receive an Exchange from the in stream, then its split using the <strong><code>splitWords</code></strong> method. Then the quote method is invoked before it's aggregated and finally sent to the stream out to be printed in the console.</p><h3 id="TracerExample-TracetheRouting">Trace the Routing</h3><p>If we look at the 6 rows from the traced SQL (the first picture) and with the route diagram in mind we can get a better understand how the <a shape="rect" href="exchange.html">Exchange</a> was routed.</p><ol><li>The <a shape="rect" href="exchange.html">Exchange</a> does not have a previousNode so its the first step where its consumed from the input stream and that its going to the splitter.</li><li>The exchange id has changed and this is the output of the splitter as it creates a new Exchange. We can also see this one has one word in the body. This <a shape="rect" href="exchange.html">Exchange</a> is being routed to the quote bean next.</li><li>This is the 2nd output from the splitter containing the 2nd word. This <a shape="rect" href="exchange.html">Exchange</a> is being routed to the quote bean next.</li><li>This is the Beer <a shape="rect" href="exchange.html">Excha nge</a> where we can see the output from the quote server and that its being routed to the aggregator.</li><li>This is the Camel <a shape="rect" href="exchange.html">Exchange</a> where we can see the output from the quote server and that its being routed to the aggregator.</li><li>This is the result of the aggregator where the <a shape="rect" href="exchange.html">Exchange</a> ending with id <strong><code>0-2</code></strong> "was the winner" and is being routed as the aggregated result to the stream out.</li></ol><h3 id="TracerExample-ConfigurationofTracinginCamel">Configuration of <a shape="rect" href="jpa.html">JPA</a> Tracing in Camel</h3><p>In Camel you need to configure it to use JPA for tracing. We do this as by adding a tracer in the <strong><code>META-INF/camel-context.mxl</code></strong> file:<plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/examples/camel-example-tracer/src/main/resources/META-INF/spring/camel-context.xml}</plain-text-body>To properly configure <a shape="rect" href="jpa.html">JPA</a> for tracing we must complete these two steps:</p><ol><li>Enable the <a shape="rect" href="jpa.html">JPA</a> tracing by setting the property <strong><code>useJpa=true</code></strong>.</li><li>Set the destination or <strong><code>destinationUri</code></strong> to a <a shape="rect" href="jpa.html">JPA</a> producer endpoint.</li></ol><p>In this example we set the destintation to refer to an endpoint defined in the camel context:<plain-text-body>{snippet:id=e3|lang=xml|url=camel/trunk/examples/camel-example-tracer/src/main/resources/META-INF/spring/camel-context.xml}</plain-text-body>Here it's important that the endpoint is configure with the <strong><code>org.apache.camel.processor.interceptor.JpaTraceEventMessage</code></strong> as entity name and the <strong><code>persistenceUnit</code></strong> as an option. In out example we use tracer.</p><p>Then the following is standard Spring <a shape="rect" href="jpa.html">JPA</a> configura tion:<plain-text-body>{snippet:id=e2|lang=xml|url=camel/trunk/examples/camel-example-tracer/src/main/resources/META-INF/spring/camel-context.xml}</plain-text-body>However we must set the <strong><code>persistenceUnitName</code></strong> to the same unit name we defined in <strong><code>persistence.xml</code></strong>, such as <strong><code>tracer</code></strong> as we are using in this example.</p><p>And if you are wondering how the Camel route is defined then its here:<plain-text-body>{snippet:id=e4|lang=xml|url=camel/trunk/examples/camel-example-tracer/src/main/resources/META-INF/spring/camel-context.xml}</plain-text-body></p><h3 id="TracerExample-Seealso">See also</h3><ul class="alternate"><li><a shape="rect" href="tracer.html">Tracer</a></li><li><a shape="rect" href="examples.html">Examples</a></li><li><a shape="rect" href="tutorials.html">Tutorials</a></li><li><a shape="rect" href="user-guide.html">User Guide</a></li></ul></div> +</plain-text-body><p>And it should return the list of trace events in the SQL.</p><p>We enter this SQL:</p><parameter ac:name="language">sql</parameter><plain-text-body>select id, shortExchangeId, previousNode, toNode, body from camel_messagetraced</plain-text-body><p>and get the output as the picture below:</p><p><br clear="none"> <span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="tracer-example.data/tracer_sql.png" data-image-src="/confluence/download/attachments/107823/tracer_sql.png?version=1&modificationDate=1232323775000&api=v2" data-unresolved-comment-count="0" data-linked-resource-id="9605" data-linked-resource-version="1" data-linked-resource-type="attachment" data-linked-resource-default-alias="tracer_sql.png" data-base-url="https://cwiki.apache.org/confluence" data-linked-resource-content-type="image/png" data-linked-resource-container-id="107823" data-linked-resource-container-version="28"></span></p><h3 id="TracerExample-R outing">Routing</h3><p>The diagram below illustrates the route diagram generated using <a shape="rect" href="visualisation.html">Visualisation</a>.<br clear="none"> <span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="tracer-example.data/tracer_dot.png" data-image-src="/confluence/download/attachments/107823/tracer_dot.png?version=1&modificationDate=1232326207000&api=v2" data-unresolved-comment-count="0" data-linked-resource-id="9606" data-linked-resource-version="1" data-linked-resource-type="attachment" data-linked-resource-default-alias="tracer_dot.png" data-base-url="https://cwiki.apache.org/confluence" data-linked-resource-content-type="image/png" data-linked-resource-container-id="107823" data-linked-resource-container-version="28"></span></p><p>We receive an Exchange from the in stream, then its split using the <strong><code>splitWords</code></strong> method. Then the quote method is invoked before it's aggregated and finally sent to the stream out to be printed in the console.</p><h3 id="TracerExample-TracetheRouting">Trace the Routing</h3><p>If we look at the 6 rows from the traced SQL (the first picture) and with the route diagram in mind we can get a better understand how the <a shape="rect" href="exchange.html">Exchange</a> was routed.</p><ol><li>The <a shape="rect" href="exchange.html">Exchange</a> does not have a previousNode so its the first step where its consumed from the input stream and that its going to the splitter.</li><li>The exchange id has changed and this is the output of the splitter as it creates a new Exchange. We can also see this one has one word in the body. This <a shape="rect" href="exchange.html">Exchange</a> is being routed to the quote bean next.</li><li>This is the 2nd output from the splitter containing the 2nd word. This <a shape="rect" href="exchange.html">Exchange</a> is being routed to the quote bean next.</li><li>This is the Beer <a shape="rect" href="exchange.html">Excha nge</a> where we can see the output from the quote server and that its being routed to the aggregator.</li><li>This is the Camel <a shape="rect" href="exchange.html">Exchange</a> where we can see the output from the quote server and that its being routed to the aggregator.</li><li>This is the result of the aggregator where the <a shape="rect" href="exchange.html">Exchange</a> ending with id <strong><code>0-2</code></strong> "was the winner" and is being routed as the aggregated result to the stream out.</li></ol><h3 id="TracerExample-ConfigurationofTracinginCamel">Configuration of <a shape="rect" href="jpa.html">JPA</a> Tracing in Camel</h3><p>In Camel you need to configure it to use JPA for tracing. We do this as by adding a tracer in the <strong><code>META-INF/camel-context.mxl</code></strong> file:<plain-text-body>{snippet:id=e1|lang=xml|url=camel/trunk/examples/camel-example-tracer/src/main/resources/META-INF/spring/camel-context.xml}</plain-text-body>To properly configure <a shape="rect" href="jpa.html">JPA</a> for tracing we must complete these two steps:</p><ol><li>Enable the <a shape="rect" href="jpa.html">JPA</a> tracing by setting the property <strong><code>useJpa=true</code></strong>.</li><li>Set the destination or <strong><code>destinationUri</code></strong> to a <a shape="rect" href="jpa.html">JPA</a> producer endpoint.</li></ol><p>In this example we set the destintation to refer to an endpoint defined in the camel context:<plain-text-body>{snippet:id=e3|lang=xml|url=camel/trunk/examples/camel-example-tracer/src/main/resources/META-INF/spring/camel-context.xml}</plain-text-body>Here it's important that the endpoint is configure with the <strong><code>org.apache.camel.processor.interceptor.JpaTraceEventMessage</code></strong> as entity name and the <strong><code>persistenceUnit</code></strong> as an option. In out example we use tracer.</p><p>Then the following is standard Spring <a shape="rect" href="jpa.html">JPA</a> configura tion:<plain-text-body>{snippet:id=e2|lang=xml|url=camel/trunk/examples/camel-example-tracer/src/main/resources/META-INF/spring/camel-context.xml}</plain-text-body>However we must set the <strong><code>persistenceUnitName</code></strong> to the same unit name we defined in <strong><code>persistence.xml</code></strong>, such as <strong><code>tracer</code></strong> as we are using in this example.</p><p>And if you are wondering how the Camel route is defined then its here:<plain-text-body>{snippet:id=e4|lang=xml|url=camel/trunk/examples/camel-example-tracer/src/main/resources/META-INF/spring/camel-context.xml}</plain-text-body></p><h3 id="TracerExample-Seealso">See also</h3><ul class="alternate"><li><a shape="rect" href="tracer.html">Tracer</a></li><li><a shape="rect" href="examples.html">Examples</a></li><li><a shape="rect" href="tutorials.html">Tutorials</a></li><li><a shape="rect" href="user-guide.html">User Guide</a></li></ul></div> </td> <td valign="top"> <div class="navigation"> Modified: websites/production/camel/content/tutorial-jmsremoting.html ============================================================================== --- websites/production/camel/content/tutorial-jmsremoting.html (original) +++ websites/production/camel/content/tutorial-jmsremoting.html Tue Sep 26 19:19:34 2017 @@ -87,7 +87,7 @@ </plain-text-body><p>All that is required is a new plugin definition in your Maven POM. As we have already placed our Camel config in the default location (camel-server.xml has been placed in META-INF/spring/) we do not need to tell the plugin where the route definitions are located. Simply run <code>mvn camel:run</code>.</p><h2 id="Tutorial-JmsRemoting-UsingCamelJMX">Using Camel JMX</h2><p>Camel has extensive support for JMX and allows us to inspect the Camel Server at runtime. As we have enabled the JMXAgent in our tutorial we can fire up the jconsole and connect to the following service URI: <code>service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi/camel</code>. Notice that Camel will log at INFO level the JMX Connector URI:</p><plain-text-body>... DefaultInstrumentationAgent INFO JMX connector thread started on service:jmx:rmi:///jndi/rmi://claus-acer:1099/jmxrmi/camel ... -</plain-text-body><p>In the screenshot below we can see the route and its performance metrics:<br clear="none"> <span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="tutorial-jmsremoting.data/jconsole_jms_tutorial.PNG" data-image-src="/confluence/download/attachments/82923/jconsole_jms_tutorial.PNG?version=1&modificationDate=1214345078000&api=v2" data-unresolved-comment-count="0" data-linked-resource-id="59672517" data-linked-resource-version="1" data-linked-resource-type="attachment" data-linked-resource-default-alias="jconsole_jms_tutorial.PNG" data-base-url="https://cwiki.apache.org/confluence" data-linked-resource-content-type="image/png" data-linked-resource-container-id="82923" data-linked-resource-container-version="43"></span></p><h2 id="Tutorial-JmsRemoting-SeeAlso">See Also</h2><ul><li><a shape="rect" class="external-link" href="http://aminsblog.wordpress.com/2008/05/06/15/" rel="nofollow">Spring Remoting with JMS Example</a> on <a shape="rect" class="external-link" href="http://aminsblog.wordpress.com/" rel="nofollow">Amin Abbaspour's Weblog</a></li></ul></div> +</plain-text-body><p>In the screenshot below we can see the route and its performance metrics:<br clear="none"> <span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image" src="tutorial-jmsremoting.data/jconsole_jms_tutorial.PNG" data-image-src="/confluence/download/attachments/82923/jconsole_jms_tutorial.PNG?version=1&modificationDate=1214345078000&api=v2" data-unresolved-comment-count="0" data-linked-resource-id="59672517" data-linked-resource-version="1" data-linked-resource-type="attachment" data-linked-resource-default-alias="jconsole_jms_tutorial.PNG" data-base-url="https://cwiki.apache.org/confluence" data-linked-resource-content-type="image/png" data-linked-resource-container-id="82923" data-linked-resource-container-version="44"></span></p><h2 id="Tutorial-JmsRemoting-SeeAlso">See Also</h2><ul><li><a shape="rect" class="external-link" href="http://aminsblog.wordpress.com/2008/05/06/15/" rel="nofollow">Spring Remoting with JMS Example</a> on <a shape="rect" class="external-link" href="http://aminsblog.wordpress.com/" rel="nofollow">Amin Abbaspour's Weblog</a></li></ul></div> </td> <td valign="top"> <div class="navigation">