You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2018/05/21 05:25:24 UTC
svn commit: r1030133 [10/14] - in /websites/production/camel/content: ./
cache/
Modified: websites/production/camel/content/quartz.html
==============================================================================
--- websites/production/camel/content/quartz.html (original)
+++ websites/production/camel/content/quartz.html Mon May 21 05:25:23 2018
@@ -89,57 +89,55 @@
<tbody>
<tr>
<td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="Quartz-QuartzComponent">Quartz Component</h2><p>The <strong>quartz:</strong> component provides a scheduled delivery of messages using the <a shape="rect" class="external-link" href="http://www.quartz-scheduler.org/" rel="nofollow">Quartz Scheduler 1.x </a>. <br clear="none"> Each endpoint represents a different timer (in Quartz terms, a Trigger and JobDetail).</p><div class="confluence-information-macro confluence-information-macro-tip"><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If you are using Quartz 2.x then from Camel 2.12 onwards there is a <a shape="rect" href="quartz2.html">Quartz2</a> component you should use</p></div></div><p>Maven users will need to add the following dependency to their <code>pom.xml</code> for this component:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent p
dl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[<dependency>
+<div class="wiki-content maincontent"><h2 id="Quartz-QuartzComponent">Quartz Component</h2><p>The <strong>quartz:</strong> component provides a scheduled delivery of messages using the <a shape="rect" class="external-link" href="http://www.quartz-scheduler.org/" rel="nofollow">Quartz Scheduler 1.x </a>. <br clear="none"> Each endpoint represents a different timer (in Quartz terms, a Trigger and JobDetail).</p><div class="confluence-information-macro confluence-information-macro-tip conf-macro output-block" data-hasbody="true" data-macro-name="tip"><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"> </span><div class="confluence-information-macro-body"><p>If you are using Quartz 2.x then from Camel 2.12 onwards there is a <a shape="rect" href="quartz2.html">Quartz2</a> component you should use</p></div></div><p>Maven users will need to add the following dependency to their <code>pom.xml</code> for this component:</p><div class="code panel pdl
conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default"><dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-quartz</artifactId>
<version>x.x.x</version>
<!-- use the same version as your Camel core version -->
</dependency>
-]]></script>
-</div></div><h3 id="Quartz-URIformat">URI format</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[quartz://timerName?options
+</pre>
+</div></div><h3 id="Quartz-URIformat">URI format</h3><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">quartz://timerName?options
quartz://groupName/timerName?options
quartz://groupName/timerName?cron=expression
quartz://timerName?cron=expression
-]]></script>
-</div></div><p>The component uses either a <code>CronTrigger</code> or a <code>SimpleTrigger</code>. If no cron expression is provided, the component uses a simple trigger. If no <code>groupName</code> is provided, the quartz component uses the <code>Camel</code> group name.</p><p>You can append query options to the URI in the following format, <code>?option=value&option=value&...</code></p><h3 id="Quartz-Options">Options</h3><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Parameter</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>cron</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><em>None</em></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Specifies a <code>cron</code> expres
sion (not compatible with the <code>trigger.*</code> or <code>job.*</code> options).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>trigger.repeatCount</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>SimpleTrigger: How many times should the timer repeat?</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>trigger.repeatInterval</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>SimpleTrigger: The amount of time in milliseconds between repeated triggers.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>job.name</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets the job name.</p></td></tr><tr><td colspan="1" rowspan="1" class="con
fluenceTd"><p><code>job.<em>XXX</em></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets the job option with the <code><em>XXX</em></code> setter name.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>trigger.<em>XXX</em></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets the trigger option with the <code><em>XXX</em></code> setter name.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>stateful</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Uses a Quartz <code>StatefulJob</code> instead of the default job.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>fireNow</code></p></td><td colspan="1" rowspan="1" class="conf
luenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>New to Camel 2.2.0, if it is true will fire the trigger when the route is start when using SimpleTrigger.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>deleteJob</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.12:</strong> If set to true, then the trigger automatically delete when route stop. Else if set to false, it will remain in scheduler. When set to false, it will also mean user may reuse pre-configured trigger with camel Uri. Just ensure the names match. Notice you cannot have both deleteJob and pauseJob set to true.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>pauseJob</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><str
ong>Camel 2.12:</strong> If set to true, then the trigger automatically pauses when route stop. Else if set to false, it will remain in scheduler. When set to false, it will also mean user may reuse pre-configured trigger with camel Uri. Just ensure the names match. Notice you cannot have both deleteJob and pauseJob set to true.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>usingFixedCamelContextName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong><strong>Camel 2.15.0: </strong></strong><span><span>If it is true, <span>JobDataMap </span></span></span><span>uses the CamelContext name directly to reference the camel context, </span><span>if it is false, <span>JobDataMap </span><span>uses </span>use the CamelContext management name which could be changed during the deploy time.</span></td></tr></tbody></table></div></div>
+</pre>
+</div></div><p>The component uses either a <code>CronTrigger</code> or a <code>SimpleTrigger</code>. If no cron expression is provided, the component uses a simple trigger. If no <code>groupName</code> is provided, the quartz component uses the <code>Camel</code> group name.</p><p>You can append query options to the URI in the following format, <code>?option=value&option=value&...</code></p><h3 id="Quartz-Options">Options</h3><div class="confluenceTableSmall conf-macro output-block" data-hasbody="true" data-macro-name="div"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Parameter</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>cron</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><em>None</em></p></td><td colspan="1" rowspa
n="1" class="confluenceTd"><p>Specifies a <code>cron</code> expression (not compatible with the <code>trigger.*</code> or <code>job.*</code> options).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>trigger.repeatCount</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>SimpleTrigger: How many times should the timer repeat?</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>trigger.repeatInterval</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>SimpleTrigger: The amount of time in milliseconds between repeated triggers.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>job.name</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets the
job name.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>job.<em>XXX</em></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets the job option with the <code><em>XXX</em></code> setter name.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>trigger.<em>XXX</em></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets the trigger option with the <code><em>XXX</em></code> setter name.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>stateful</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Uses a Quartz <code>StatefulJob</code> instead of the default job.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><c
ode>fireNow</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>New to Camel 2.2.0, if it is true will fire the trigger when the route is start when using SimpleTrigger.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>deleteJob</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.12:</strong> If set to true, then the trigger automatically delete when route stop. Else if set to false, it will remain in scheduler. When set to false, it will also mean user may reuse pre-configured trigger with camel Uri. Just ensure the names match. Notice you cannot have both deleteJob and pauseJob set to true.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>pauseJob</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.12:</strong> If set to true, then the trigger automatically pauses when route stop. Else if set to false, it will remain in scheduler. When set to false, it will also mean user may reuse pre-configured trigger with camel Uri. Just ensure the names match. Notice you cannot have both deleteJob and pauseJob set to true.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>usingFixedCamelContextName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" rowspan="1" class="confluenceTd"><strong><strong>Camel 2.15.0: </strong></strong><span><span>If it is true, <span>JobDataMap </span></span></span><span>uses the CamelContext name directly to reference the camel context, </span><span>if it is false, <span>JobDataMap </span><span>uses </span>use the CamelContext management name which could be changed during the deploy time.</span></td></tr></tb
ody></table></div></div>
-<p>For example, the following routing rule will fire two timer events to the <code>mock:results</code> endpoint:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-from("quartz://myGroup/myTimerName?trigger.repeatInterval=2&trigger.repeatCount=1").routeId("myRoute").to("mock:result");
-]]></script>
-</div></div><p>When using a <a shape="rect" class="external-link" href="http://quartz-scheduler.org/api/2.0.0/org/quartz/StatefulJob.html" rel="nofollow">StatefulJob</a>, the <a shape="rect" class="external-link" href="http://quartz-scheduler.org/api/2.0.0/org/quartz/JobDataMap.html" rel="nofollow">JobDataMap</a> is re-persisted after every execution of the job, thus preserving state for the next execution.</p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Running in OSGi and having multiple bundles with quartz routes</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>If you run in OSGi such as Apache ServiceMix, or Apache Karaf, and have multiple bundles with Camel routes that start from <a shape="rect" href="quartz.html">Quartz</a> endpoints, then make sure if you assign<br clear="none"> an <code>id</code> to the <camelContext&g
t; that this id is unique, as this is required by the <code>QuartzScheduler</code> in the OSGi container. If you do not set any <code>id</code> on <camelContext> then<br clear="none"> a unique id is auto assigned, and there is no problem.</p></div></div><h3 id="Quartz-Configuringquartz.propertiesfile">Configuring quartz.properties file</h3><p>By default Quartz will look for a <code>quartz.properties</code> file in the <code>org/quartz</code> directory of the classpath. If you are using WAR deployments this means just drop the quartz.properties in <code>WEB-INF/classes/org/quartz</code>.</p><p>However the Camel <a shape="rect" href="quartz.html">Quartz</a> component also allows you to configure properties:</p><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Parameter</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</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>properties</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Properties</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.4</strong>: You can configure a <code>java.util.Properties</code> instance.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>propertiesFile</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</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>Camel 2.4</strong>: File name of the properties to load from the classpath</p></td></tr></tbody></table></div></div>
+<p>For example, the following routing rule will fire two timer events to the <code>mock:results</code> endpoint:</p>Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
+from("quartz://myGroup/myTimerName?trigger.repeatInterval=2&trigger.repeatCount=1").routeId("myRoute").to("mock:result");
+</pre><p>When using a <a shape="rect" class="external-link" href="http://quartz-scheduler.org/api/2.0.0/org/quartz/StatefulJob.html" rel="nofollow">StatefulJob</a>, the <a shape="rect" class="external-link" href="http://quartz-scheduler.org/api/2.0.0/org/quartz/JobDataMap.html" rel="nofollow">JobDataMap</a> is re-persisted after every execution of the job, thus preserving state for the next execution.</p><div class="confluence-information-macro confluence-information-macro-information conf-macro output-block" data-hasbody="true" data-macro-name="info"><p class="title">Running in OSGi and having multiple bundles with quartz routes</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"> </span><div class="confluence-information-macro-body"><p>If you run in OSGi such as Apache ServiceMix, or Apache Karaf, and have multiple bundles with Camel routes that start from <a shape="rect" href="quartz.html">Quartz</a> endpoints, then make sure if you assign
<br clear="none"> an <code>id</code> to the <camelContext> that this id is unique, as this is required by the <code>QuartzScheduler</code> in the OSGi container. If you do not set any <code>id</code> on <camelContext> then<br clear="none"> a unique id is auto assigned, and there is no problem.</p></div></div><h3 id="Quartz-Configuringquartz.propertiesfile">Configuring quartz.properties file</h3><p>By default Quartz will look for a <code>quartz.properties</code> file in the <code>org/quartz</code> directory of the classpath. If you are using WAR deployments this means just drop the quartz.properties in <code>WEB-INF/classes/org/quartz</code>.</p><p>However the Camel <a shape="rect" href="quartz.html">Quartz</a> component also allows you to configure properties:</p><div class="confluenceTableSmall conf-macro output-block" data-hasbody="true" data-macro-name="div"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluence
Th"><p>Parameter</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</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>properties</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>Properties</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.4</strong>: You can configure a <code>java.util.Properties</code> instance.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>propertiesFile</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>null</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>Camel 2.4</strong>: File name of the properti
es to load from the classpath</p></td></tr></tbody></table></div></div>
-<p>To do this you can configure this in Spring XML as follows</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[<bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent">
- <property name="propertiesFile" value="com/mycompany/myquartz.properties"/>
+<p>To do this you can configure this in Spring XML as follows</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default"><bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent">
+ <property name="propertiesFile" value="com/mycompany/myquartz.properties"/>
</bean>
-]]></script>
-</div></div><h3 id="Quartz-EnablingQuartzschedulerinJMX">Enabling Quartz scheduler in JMX</h3><p>You need to configure the quartz scheduler properties to enable JMX.<br clear="none"> That is typically setting the option <code>"org.quartz.scheduler.jmx.export"</code> to a <code>true</code> value in the configuration file.</p><p>From Camel 2.13 onwards Camel will automatic set this option to true, unless explicit disabled.</p><h3 id="Quartz-StartingtheQuartzscheduler">Starting the Quartz scheduler</h3><p><strong>Available as of Camel 2.4</strong></p><p>The <a shape="rect" href="quartz.html">Quartz</a> component offers an option to let the Quartz scheduler be started delayed, or not auto started at all.</p><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Parameter</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" class="confluenceT
h"><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>startDelayedSeconds</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>int</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.4</strong>: Seconds to wait before starting the quartz scheduler.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>autoStartScheduler</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>boolean</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.4:</strong> Whether or not the scheduler should be auto started.</p></td></tr></tbody></table></div></div>
+</pre>
+</div></div><h3 id="Quartz-EnablingQuartzschedulerinJMX">Enabling Quartz scheduler in JMX</h3><p>You need to configure the quartz scheduler properties to enable JMX.<br clear="none"> That is typically setting the option <code>"org.quartz.scheduler.jmx.export"</code> to a <code>true</code> value in the configuration file.</p><p>From Camel 2.13 onwards Camel will automatic set this option to true, unless explicit disabled.</p><h3 id="Quartz-StartingtheQuartzscheduler">Starting the Quartz scheduler</h3><p><strong>Available as of Camel 2.4</strong></p><p>The <a shape="rect" href="quartz.html">Quartz</a> component offers an option to let the Quartz scheduler be started delayed, or not auto started at all.</p><div class="confluenceTableSmall conf-macro output-block" data-hasbody="true" data-macro-name="div"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Parameter</p></th><th colspan="1" rowspan="1" class="confluenceTh"
><p>Default</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>startDelayedSeconds</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>int</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.4</strong>: Seconds to wait before starting the quartz scheduler.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>autoStartScheduler</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>boolean</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.4:</strong> Whether or not the scheduler should be auto started.</p></td></tr></tbody></table></div></div>
-<p>To do this you can configure this in Spring XML as follows</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[<bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent">
- <property name="startDelayedSeconds" value="5"/>
+<p>To do this you can configure this in Spring XML as follows</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default"><bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent">
+ <property name="startDelayedSeconds" value="5"/>
</bean>
-]]></script>
-</div></div><h3 id="Quartz-Clustering">Clustering</h3><p><strong>Available as of Camel 2.4</strong></p><p>If you use Quartz in clustered mode, e.g. the <code>JobStore</code> is clustered. Then from Camel 2.4 onwards the <a shape="rect" href="quartz.html">Quartz</a> component will <strong>not</strong> pause/remove triggers when a node is being stopped/shutdown. This allows the trigger to keep running on the other nodes in the cluster.</p><p><strong>Note</strong>: When running in clustered node no checking is done to ensure unique job name/group for endpoints.</p><h3 id="Quartz-MessageHeaders">Message Headers</h3><p>Camel adds the getters from the Quartz Execution Context as header values. The following headers are added:<br clear="none"> <code>calendar</code>, <code>fireTime</code>, <code>jobDetail</code>, <code>jobInstance</code>, <code>jobRuntTime</code>, <code>mergedJobDataMap</code>, <code>nextFireTime</code>, <code>previousFireTime</code>, <code>refireCount</code>, <code>result<
/code>, <code>scheduledFireTime</code>, <code>scheduler</code>, <code>trigger</code>, <code>triggerName</code>, <code>triggerGroup</code>.</p><p>The <code>fireTime</code> header contains the <code>java.util.Date</code> of when the exchange was fired.</p><h3 id="Quartz-UsingCronTriggers">Using Cron Triggers</h3><p>Quartz supports <a shape="rect" class="external-link" href="http://www.quartz-scheduler.org/documentation/quartz-2.1.x/tutorials/crontrigger" rel="nofollow">Cron-like expressions</a> for specifying timers in a handy format. You can use these expressions in the <code>cron</code> URI parameter; though to preserve valid URI encoding we allow + to be used instead of spaces. Quartz provides a <a shape="rect" class="external-link" href="http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html" rel="nofollow">little tutorial</a> on how to use cron expressions.</p><p>For example, the following will fire a message every five minutes starting at 12pm (noon) to 6pm on weekdays:
</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI").to("activemq:Totally.Rocks");
-]]></script>
-</div></div><p>which is equivalent to using the cron expression</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[0 0/5 12-18 ? * MON-FRI
-]]></script>
-</div></div><p>The following table shows the URI character encodings we use to preserve valid URI syntax:</p><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>URI Character</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Cron character</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>+</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><em>Space</em></p></td></tr></tbody></table></div></div>
+</pre>
+</div></div><h3 id="Quartz-Clustering">Clustering</h3><p><strong>Available as of Camel 2.4</strong></p><p>If you use Quartz in clustered mode, e.g. the <code>JobStore</code> is clustered. Then from Camel 2.4 onwards the <a shape="rect" href="quartz.html">Quartz</a> component will <strong>not</strong> pause/remove triggers when a node is being stopped/shutdown. This allows the trigger to keep running on the other nodes in the cluster.</p><p><strong>Note</strong>: When running in clustered node no checking is done to ensure unique job name/group for endpoints.</p><h3 id="Quartz-MessageHeaders">Message Headers</h3><p>Camel adds the getters from the Quartz Execution Context as header values. The following headers are added:<br clear="none"> <code>calendar</code>, <code>fireTime</code>, <code>jobDetail</code>, <code>jobInstance</code>, <code>jobRuntTime</code>, <code>mergedJobDataMap</code>, <code>nextFireTime</code>, <code>previousFireTime</code>, <code>refireCount</code>, <code>result<
/code>, <code>scheduledFireTime</code>, <code>scheduler</code>, <code>trigger</code>, <code>triggerName</code>, <code>triggerGroup</code>.</p><p>The <code>fireTime</code> header contains the <code>java.util.Date</code> of when the exchange was fired.</p><h3 id="Quartz-UsingCronTriggers">Using Cron Triggers</h3><p>Quartz supports <a shape="rect" class="external-link" href="http://www.quartz-scheduler.org/documentation/quartz-2.1.x/tutorials/crontrigger" rel="nofollow">Cron-like expressions</a> for specifying timers in a handy format. You can use these expressions in the <code>cron</code> URI parameter; though to preserve valid URI encoding we allow + to be used instead of spaces. Quartz provides a <a shape="rect" class="external-link" href="http://www.quartz-scheduler.org/docs/tutorials/crontrigger.html" rel="nofollow">little tutorial</a> on how to use cron expressions.</p><p>For example, the following will fire a message every five minutes starting at 12pm (noon) to 6pm on weekdays:
</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">from("quartz://myGroup/myTimerName?cron=0+0/5+12-18+?+*+MON-FRI").to("activemq:Totally.Rocks");
+</pre>
+</div></div><p>which is equivalent to using the cron expression</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">0 0/5 12-18 ? * MON-FRI
+</pre>
+</div></div><p>The following table shows the URI character encodings we use to preserve valid URI syntax:</p><div class="confluenceTableSmall conf-macro output-block" data-hasbody="true" data-macro-name="div"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>URI Character</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Cron character</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>+</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><em>Space</em></p></td></tr></tbody></table></div></div>
-<h3 id="Quartz-Specifyingtimezone">Specifying time zone</h3><p><strong>Available as of Camel 2.8.1</strong><br clear="none"> The Quartz Scheduler allows you to configure time zone per trigger. For example to use a timezone of your country, then you can do as follows:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[quartz://groupName/timerName?cron=0+0/5+12-18+?+*+MON-FRI&trigger.timeZone=Europe/Stockholm
-]]></script>
-</div></div><p>The timeZone value is the values accepted by <code>java.util.TimeZone</code>.</p><p>In Camel 2.8.0 or older versions you would have to provide your custom <code>String</code> to <code>java.util.TimeZone</code> <a shape="rect" href="type-converter.html">Type Converter</a> to be able configure this from the endpoint uri.<br clear="none"> From Camel 2.8.1 onwards we have included such a <a shape="rect" href="type-converter.html">Type Converter</a> in the camel-core.</p><p></p><h3 id="Quartz-SeeAlso">See Also</h3>
-<ul><li><a shape="rect" href="configuring-camel.html">Configuring Camel</a></li><li><a shape="rect" href="component.html">Component</a></li><li><a shape="rect" href="endpoint.html">Endpoint</a></li><li><a shape="rect" href="getting-started.html">Getting Started</a></li></ul><ul><li><a shape="rect" href="quartz2.html">Quartz2</a></li><li><a shape="rect" href="timer.html">Timer</a></li></ul></div>
+<h3 id="Quartz-Specifyingtimezone">Specifying time zone</h3><p><strong>Available as of Camel 2.8.1</strong><br clear="none"> The Quartz Scheduler allows you to configure time zone per trigger. For example to use a timezone of your country, then you can do as follows:</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">quartz://groupName/timerName?cron=0+0/5+12-18+?+*+MON-FRI&trigger.timeZone=Europe/Stockholm
+</pre>
+</div></div><p>The timeZone value is the values accepted by <code>java.util.TimeZone</code>.</p><p>In Camel 2.8.0 or older versions you would have to provide your custom <code>String</code> to <code>java.util.TimeZone</code> <a shape="rect" href="type-converter.html">Type Converter</a> to be able configure this from the endpoint uri.<br clear="none"> From Camel 2.8.1 onwards we have included such a <a shape="rect" href="type-converter.html">Type Converter</a> in the camel-core.</p><p></p><div class="conf-macro output-block" data-hasbody="false" data-macro-name="include"><h3 id="Quartz-SeeAlso">See Also</h3>
+<ul><li><a shape="rect" href="configuring-camel.html">Configuring Camel</a></li><li><a shape="rect" href="component.html">Component</a></li><li><a shape="rect" href="endpoint.html">Endpoint</a></li><li><a shape="rect" href="getting-started.html">Getting Started</a></li></ul></div><ul><li><a shape="rect" href="quartz2.html">Quartz2</a></li><li><a shape="rect" href="timer.html">Timer</a></li></ul></div>
</td>
<td valign="top">
<div class="navigation">
Modified: websites/production/camel/content/ref.html
==============================================================================
--- websites/production/camel/content/ref.html (original)
+++ websites/production/camel/content/ref.html Mon May 21 05:25:23 2018
@@ -95,21 +95,21 @@
<h3 id="Ref-URIformat">URI format</h3>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">
ref:someName[?options]
-]]></script>
+</pre>
</div></div>
<p>Where <strong>someName</strong> is the name of an endpoint in the <a shape="rect" href="registry.html">Registry</a> (usually, but not always, the Spring registry). If you are using the Spring registry, <code>someName</code> would be the bean ID of an endpoint in the Spring registry.</p>
<h3 id="Ref-Runtimelookup">Runtime lookup</h3>
<p>This component can be used when you need dynamic discovery of endpoints in the <a shape="rect" href="registry.html">Registry</a> where you can compute the URI at runtime. Then you can look up the endpoint using the following code:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">
// lookup the endpoint
- String myEndpointRef = "bigspenderOrder";
- Endpoint endpoint = context.getEndpoint("ref:" + myEndpointRef);
+ String myEndpointRef = "bigspenderOrder";
+ Endpoint endpoint = context.getEndpoint("ref:" + myEndpointRef);
Producer producer = endpoint.createProducer();
Exchange exchange = producer.createExchange();
@@ -117,55 +117,53 @@ ref:someName[?options]
// send the exchange
producer.process(exchange);
...
-]]></script>
+</pre>
</div></div>
<p>And you could have a list of endpoints defined in the <a shape="rect" href="registry.html">Registry</a> such as:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
- <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
- <endpoint id="normalOrder" uri="activemq:order.slow"/>
- <endpoint id="bigspenderOrder" uri="activemq:order.high"/>
+<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">
+ <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
+ <endpoint id="normalOrder" uri="activemq:order.slow"/>
+ <endpoint id="bigspenderOrder" uri="activemq:order.high"/>
...
</camelContext>
-]]></script>
+</pre>
</div></div>
<h3 id="Ref-Sample">Sample</h3>
<p>In the sample below we use the <code>ref:</code> in the URI to reference the endpoint with the spring ID, <code>endpoint2</code>:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-<bean id="mybean" class="org.apache.camel.spring.example.DummyBean">
- <property name="endpoint" ref="endpoint1"/>
+Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
+<bean id="mybean" class="org.apache.camel.spring.example.DummyBean">
+ <property name="endpoint" ref="endpoint1"/>
</bean>
-<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
- <jmxAgent id="agent" disabled="true"/>
- <endpoint id="endpoint1" uri="direct:start"/>
- <endpoint id="endpoint2" uri="mock:end"/>
+<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
+ <jmxAgent id="agent" disabled="true"/>
+ <endpoint id="endpoint1" uri="direct:start"/>
+ <endpoint id="endpoint2" uri="mock:end"/>
<route>
- <from ref="endpoint1"/>
- <to uri="ref:endpoint2"/>
+ <from ref="endpoint1"/>
+ <to uri="ref:endpoint2"/>
</route>
</camelContext>
-]]></script>
-</div></div>
+</pre>
<p>You could, of course, have used the <code>ref</code> attribute instead:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
- <to ref="endpoint2"/>
-]]></script>
+<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">
+ <to ref="endpoint2"/>
+</pre>
</div></div>
<p>Which is the more common way to write it. </p>
-<h3 id="Ref-SeeAlso">See Also</h3>
-<ul><li><a shape="rect" href="configuring-camel.html">Configuring Camel</a></li><li><a shape="rect" href="component.html">Component</a></li><li><a shape="rect" href="endpoint.html">Endpoint</a></li><li><a shape="rect" href="getting-started.html">Getting Started</a></li></ul></div>
+<div class="conf-macro output-block" data-hasbody="false" data-macro-name="include"><h3 id="Ref-SeeAlso">See Also</h3>
+<ul><li><a shape="rect" href="configuring-camel.html">Configuring Camel</a></li><li><a shape="rect" href="component.html">Component</a></li><li><a shape="rect" href="endpoint.html">Endpoint</a></li><li><a shape="rect" href="getting-started.html">Getting Started</a></li></ul></div></div>
</td>
<td valign="top">
<div class="navigation">
Modified: websites/production/camel/content/request-reply.html
==============================================================================
--- websites/production/camel/content/request-reply.html (original)
+++ websites/production/camel/content/request-reply.html Mon May 21 05:25:23 2018
@@ -100,7 +100,7 @@
<ul><li>create by default a temporary inbound queue</li><li>set the JMSReplyTo destination on the request message</li><li>set the JMSCorrelationID on the request message</li><li>send the request message</li><li>consume the response and associate the inbound message to the request using the JMSCorrelationID (as you may be performing many concurrent request/responses).</li></ul>
-<div class="confluence-information-macro confluence-information-macro-tip"><p class="title">Related</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"></span><div class="confluence-information-macro-body">
+<div class="confluence-information-macro confluence-information-macro-tip conf-macro output-block" data-hasbody="true" data-macro-name="tip"><p class="title">Related</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"> </span><div class="confluence-information-macro-body">
<p>See the related <a shape="rect" href="event-message.html">Event Message</a> message</p></div></div>
<h3 id="RequestReply-ExplicitlyspecifyingInOut">Explicitly specifying InOut</h3>
@@ -109,95 +109,91 @@
<p>You can explicitly force an endpoint to be in Request Reply mode by setting the exchange pattern on the URI. e.g.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">
jms:MyQueue?exchangePattern=InOut
-]]></script>
+</pre>
</div></div>
<p>You can specify the exchange pattern in DSL rule or Spring configuration.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
// Send to an endpoint using InOut
-from("direct:testInOut").inOut("mock:result");
+from("direct:testInOut").inOut("mock:result");
// Send to an endpoint using InOut
-from("direct:testInOnly").inOnly("mock:result");
+from("direct:testInOnly").inOnly("mock:result");
// Set the exchange pattern to InOut, then send it from direct:inOnly to mock:result endpoint
-from("direct:testSetToInOnlyThenTo")
+from("direct:testSetToInOnlyThenTo")
.setExchangePattern(ExchangePattern.InOnly)
- .to("mock:result");
-from("direct:testSetToInOutThenTo")
+ .to("mock:result");
+from("direct:testSetToInOutThenTo")
.setExchangePattern(ExchangePattern.InOut)
- .to("mock:result");
+ .to("mock:result");
// Or we can pass the pattern as a parameter to the to() method
-from("direct:testToWithInOnlyParam").to(ExchangePattern.InOnly, "mock:result");
-from("direct:testToWithInOutParam").to(ExchangePattern.InOut, "mock:result");
-from("direct:testToWithRobustInOnlyParam").to(ExchangePattern.RobustInOnly, "mock:result");
+from("direct:testToWithInOnlyParam").to(ExchangePattern.InOnly, "mock:result");
+from("direct:testToWithInOutParam").to(ExchangePattern.InOut, "mock:result");
+from("direct:testToWithRobustInOnlyParam").to(ExchangePattern.RobustInOnly, "mock:result");
// Set the exchange pattern to InOut, then send it on
-from("direct:testSetExchangePatternInOnly")
- .setExchangePattern(ExchangePattern.InOnly).to("mock:result");
-]]></script>
-</div></div>
+from("direct:testSetExchangePatternInOnly")
+ .setExchangePattern(ExchangePattern.InOnly).to("mock:result");
+</pre>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-<camelContext xmlns="http://camel.apache.org/schema/spring">
+Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
+<camelContext xmlns="http://camel.apache.org/schema/spring">
<!-- Send the exchange as InOnly -->
<route>
- <from uri="direct:testInOut"/>
- <inOut uri="mock:result"/>
+ <from uri="direct:testInOut"/>
+ <inOut uri="mock:result"/>
</route>
<!-- Send the exchange as InOnly -->
<route>
- <from uri="direct:testInOnly"/>
- <inOnly uri="mock:result"/>
+ <from uri="direct:testInOnly"/>
+ <inOnly uri="mock:result"/>
</route>
<!-- lets set the exchange pattern then send it on -->
<route>
- <from uri="direct:testSetToInOnlyThenTo"/>
- <setExchangePattern pattern="InOnly"/>
- <to uri="mock:result"/>
+ <from uri="direct:testSetToInOnlyThenTo"/>
+ <setExchangePattern pattern="InOnly"/>
+ <to uri="mock:result"/>
</route>
<route>
- <from uri="direct:testSetToInOutThenTo"/>
- <setExchangePattern pattern="InOut"/>
- <to uri="mock:result"/>
+ <from uri="direct:testSetToInOutThenTo"/>
+ <setExchangePattern pattern="InOut"/>
+ <to uri="mock:result"/>
</route>
<route>
- <from uri="direct:testSetExchangePatternInOnly"/>
- <setExchangePattern pattern="InOnly"/>
- <to uri="mock:result"/>
+ <from uri="direct:testSetExchangePatternInOnly"/>
+ <setExchangePattern pattern="InOnly"/>
+ <to uri="mock:result"/>
</route>
<!-- Lets pass the pattern as an argument in the to element -->
<route>
- <from uri="direct:testToWithInOnlyParam"/>
- <to uri="mock:result" pattern="InOnly"/>
+ <from uri="direct:testToWithInOnlyParam"/>
+ <to uri="mock:result" pattern="InOnly"/>
</route>
<route>
- <from uri="direct:testToWithInOutParam"/>
- <to uri="mock:result" pattern="InOut"/>
+ <from uri="direct:testToWithInOutParam"/>
+ <to uri="mock:result" pattern="InOut"/>
</route>
<route>
- <from uri="direct:testToWithRobustInOnlyParam"/>
- <to uri="mock:result" pattern="RobustInOnly"/>
+ <from uri="direct:testToWithRobustInOnlyParam"/>
+ <to uri="mock:result" pattern="RobustInOnly"/>
</route>
</camelContext>
-]]></script>
-</div></div>
+</pre>
-<h4 id="RequestReply-UsingThisPattern">Using This Pattern</h4>
+<div class="conf-macro output-block" data-hasbody="false" data-macro-name="include"><h4 id="RequestReply-UsingThisPattern">Using This Pattern</h4>
-<p>If you would like to use this EIP Pattern then please read the <a shape="rect" href="getting-started.html">Getting Started</a>, you may also find the <a shape="rect" href="architecture.html">Architecture</a> useful particularly the description of <a shape="rect" href="endpoint.html">Endpoint</a> and <a shape="rect" href="uris.html">URIs</a>. Then you could try out some of the <a shape="rect" href="examples.html">Examples</a> first before trying this pattern out.</p></div>
+<p>If you would like to use this EIP Pattern then please read the <a shape="rect" href="getting-started.html">Getting Started</a>, you may also find the <a shape="rect" href="architecture.html">Architecture</a> useful particularly the description of <a shape="rect" href="endpoint.html">Endpoint</a> and <a shape="rect" href="uris.html">URIs</a>. Then you could try out some of the <a shape="rect" href="examples.html">Examples</a> first before trying this pattern out.</p></div></div>
</td>
<td valign="top">
<div class="navigation">
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 Mon May 21 05:25:23 2018
@@ -129,22 +129,20 @@
<h3 id="RouteThrottlingExample-Howtochange">How to change</h3>
<p>You can check the file <code>src/main/resources/META-INF/spring/camel-server.xml</code> file where you can see the configuration of the dynamic throttler. By default its configured as:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-<bean id="myPolicy" class="org.apache.camel.impl.ThrottlingInflightRoutePolicy">
+Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
+<bean id="myPolicy" class="org.apache.camel.impl.ThrottlingInflightRoutePolicy">
<!-- define the scope to be context scoped so we measure against total inflight exchanges
that means for both route1, route2 and route3 all together -->
- <property name="scope" value="Context"/>
+ <property name="scope" value="Context"/>
<!-- when we hit > 20 inflight exchanges then kick in and suspend the routes -->
- <property name="maxInflightExchanges" value="20"/>
+ <property name="maxInflightExchanges" value="20"/>
<!-- when we hit lower than 10% of the max = 2 then kick in and resume the routes
the default percentage is 70% but in this demo we want a low value -->
- <property name="resumePercentOfMax" value="10"/>
+ <property name="resumePercentOfMax" value="10"/>
<!-- output throttling activity at WARN level -->
- <property name="loggingLevel" value="WARN"/>
+ <property name="loggingLevel" value="WARN"/>
</bean>
-]]></script>
-</div></div>
+</pre>
<p>You can then change this and restart the server to see the changes in effect.</p>
@@ -153,7 +151,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="24"></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="25"></span></p>
<p>See more at <a shape="rect" href="camel-jmx.html">using JMX with Camel</a>.</p>
@@ -162,8 +160,8 @@ For example you can change the option <c
<p>When running the example you should see a lot of activity logged to the console. <br clear="none">
Below is a snippet when the example runs to an end when the 10000 messages have been processed. What you should notice is that the throttling ensures that the JMS consumer is not taking in more messages than we can process. That means that ++<span style="text-decoration: underline;">JMS</span>++ and ++<span style="text-decoration: underline;">SEDA</span>++ are completing at nearly the same time. </p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">
[ultMessageListenerContainer-42] +++JMS +++ INFO Received: 9800 messages so far. Last group took: 673 millis which is: 148.588 messages per second. average: 159.734
[currentConsumers=25&size=25000] ThrottlingInflightRoutePolicy WARN Throttling consumer: 25 > 20 inflight exchange by suspending consumer.
[currentConsumers=25&size=25000] +++SEDA+++ INFO Received: 9800 messages so far. Last group took: 733 millis which is: 136.426 messages per second. average: 159.789
@@ -182,13 +180,13 @@ Below is a snippet when the example runs
[currentConsumers=25&size=25000] ThrottlingInflightRoutePolicy WARN Throttling consumer: 2 <= 2 inflight exchange by resuming consumer.
[ultMessageListenerContainer-76] +++JMS +++ INFO Received: 10000 messages so far. Last group took: 732 millis which is: 136.612 messages per second. average: 159.129
[currentConsumers=25&size=25000] +++SEDA+++ INFO Received: 10000 messages so far. Last group took: 732 millis which is: 136.612 messages per second. average: 159.589
-]]></script>
+</pre>
</div></div>
<p>However if you run the example <strong>without</strong> the throttling you will notice that the JMS consumer runs faster than we can process the messages. Towards the end we have more than 2000 messages pending on the internal SEDA queue, when the JMS consumer finishes.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">
[ultMessageListenerContainer-41] +++JMS +++ INFO Received: 9800 messages so far. Last group took: 304 millis which is: 328.947 messages per second. average: 225.272
[currentConsumers=25&size=25000] +++SEDA+++ INFO Received: 7800 messages so far. Last group took: 645 millis which is: 155.039 messages per second. average: 178.461
[ultMessageListenerContainer-65] +++JMS +++ INFO Received: 9900 messages so far. Last group took: 543 millis which is: 184.162 messages per second. average: 224.765
@@ -215,7 +213,7 @@ Below is a snippet when the example runs
[currentConsumers=25&size=25000] +++SEDA+++ INFO Received: 9800 messages so far. Last group took: 410 millis which is: 243.902 messages per second. average: 188.024
[currentConsumers=25&size=25000] +++SEDA+++ INFO Received: 9900 messages so far. Last group took: 579 millis which is: 172.712 messages per second. average: 187.856
[currentConsumers=25&size=25000] +++SEDA+++ INFO Received: 10000 messages so far. Last group took: 404 millis which is: 247.525 messages per second. average: 188.31
-]]></script>
+</pre>
</div></div>
<p>So by using the <code>ThrottlingInflightRoutePolicy</code> we can throttle the intake of messages to be on a pair with the speed we can process messages. And since its pluggable you can implement your own custom logic to throttle according to your needs.</p>
Modified: websites/production/camel/content/routes.html
==============================================================================
--- websites/production/camel/content/routes.html (original)
+++ websites/production/camel/content/routes.html Mon May 21 05:25:23 2018
@@ -89,81 +89,69 @@
<tbody>
<tr>
<td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="Routes-Routes">Routes</h2><p>Camel supports the definition of routing rules using a Java <a shape="rect" href="dsl.html">DSL</a> (domain specific language) which avoids the need for cumbersome XML using a <a shape="rect" href="routebuilder.html">RouteBuilder</a>.</p><p>For example a simple route can be created as follows.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+<div class="wiki-content maincontent"><h2 id="Routes-Routes">Routes</h2><p>Camel supports the definition of routing rules using a Java <a shape="rect" href="dsl.html">DSL</a> (domain specific language) which avoids the need for cumbersome XML using a <a shape="rect" href="routebuilder.html">RouteBuilder</a>.</p><p>For example a simple route can be created as follows.</p>Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
RouteBuilder builder = new RouteBuilder() {
public void configure() {
- errorHandler(deadLetterChannel("mock:error"));
+ errorHandler(deadLetterChannel("mock:error"));
- from("direct:a").to("direct:b");
+ from("direct:a").to("direct:b");
}
};
-]]></script>
-</div></div><p>As you can see from the above Camel uses <a shape="rect" href="uris.html">URIs</a> to wire endpoints together.</p><h3 id="Routes-URIStringformatting">URI String formatting</h3><p><strong>Available as of Camel 2.0</strong></p><p>If you have endpoint URIs that accept options and you want to be able to substitute the value, e.g. build the URI by concat the strings together, then you can use the <code>java.lang.String.format</code> method. But in Camel 2.0 we have added two convenient methods in the Java DSL so you can do <code>fromF</code> and <code>toF</code> that uses String formatting to build the URI.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-from("direct:start").toF("file://%s?fileName=%s", path, name);
+</pre><p>As you can see from the above Camel uses <a shape="rect" href="uris.html">URIs</a> to wire endpoints together.</p><h3 id="Routes-URIStringformatting">URI String formatting</h3><p><strong>Available as of Camel 2.0</strong></p><p>If you have endpoint URIs that accept options and you want to be able to substitute the value, e.g. build the URI by concat the strings together, then you can use the <code>java.lang.String.format</code> method. But in Camel 2.0 we have added two convenient methods in the Java DSL so you can do <code>fromF</code> and <code>toF</code> that uses String formatting to build the URI.</p>Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
+from("direct:start").toF("file://%s?fileName=%s", path, name);
-fromF("file://%s?include=%s", path, pattern).toF("mock:%s", result);
-]]></script>
-</div></div><h3 id="Routes-Filters">Filters</h3><p>You can combine simple routes with filters which can be arbitrary <a shape="rect" href="predicate.html">Predicate</a> implementations.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+fromF("file://%s?include=%s", path, pattern).toF("mock:%s", result);
+</pre><h3 id="Routes-Filters">Filters</h3><p>You can combine simple routes with filters which can be arbitrary <a shape="rect" href="predicate.html">Predicate</a> implementations.</p>Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
RouteBuilder builder = new RouteBuilder() {
public void configure() {
- errorHandler(deadLetterChannel("mock:error"));
+ errorHandler(deadLetterChannel("mock:error"));
- from("direct:a")
- .filter(header("foo").isEqualTo("bar"))
- .to("direct:b");
+ from("direct:a")
+ .filter(header("foo").isEqualTo("bar"))
+ .to("direct:b");
}
};
-]]></script>
-</div></div><h3 id="Routes-Choices">Choices</h3><p>With a choice you provide a list of predicates and outcomes along with an optional default otherwise clause which is invoked if none of the conditions are met.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+</pre><h3 id="Routes-Choices">Choices</h3><p>With a choice you provide a list of predicates and outcomes along with an optional default otherwise clause which is invoked if none of the conditions are met.</p>Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
RouteBuilder builder = new RouteBuilder() {
public void configure() {
- errorHandler(deadLetterChannel("mock:error"));
+ errorHandler(deadLetterChannel("mock:error"));
- from("direct:a")
+ from("direct:a")
.choice()
- .when(header("foo").isEqualTo("bar"))
- .to("direct:b")
- .when(header("foo").isEqualTo("cheese"))
- .to("direct:c")
+ .when(header("foo").isEqualTo("bar"))
+ .to("direct:b")
+ .when(header("foo").isEqualTo("cheese"))
+ .to("direct:c")
.otherwise()
- .to("direct:d");
+ .to("direct:d");
}
};
-]]></script>
-</div></div><h4 id="Routes-Usingacustomprocessor">Using a custom processor</h4><p>Here is an example of using a custom <a shape="rect" href="processor.html">Processor</a></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+</pre><h4 id="Routes-Usingacustomprocessor">Using a custom processor</h4><p>Here is an example of using a custom <a shape="rect" href="processor.html">Processor</a></p>Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
myProcessor = new Processor() {
public void process(Exchange exchange) {
- log.debug("Called with exchange: " + exchange);
+ log.debug("Called with exchange: " + exchange);
}
};
RouteBuilder builder = new RouteBuilder() {
public void configure() {
- errorHandler(deadLetterChannel("mock:error"));
+ errorHandler(deadLetterChannel("mock:error"));
- from("direct:a")
+ from("direct:a")
.process(myProcessor);
}
};
-]]></script>
-</div></div><p>You can mix and match custom processors with filters and choices.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+</pre><p>You can mix and match custom processors with filters and choices.</p>Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
RouteBuilder builder = new RouteBuilder() {
public void configure() {
- errorHandler(deadLetterChannel("mock:error"));
+ errorHandler(deadLetterChannel("mock:error"));
- from("direct:a")
- .filter(header("foo").isEqualTo("bar"))
+ from("direct:a")
+ .filter(header("foo").isEqualTo("bar"))
.process(myProcessor);
}
};
-]]></script>
-</div></div></div>
+</pre></div>
</td>
<td valign="top">
<div class="navigation">
Modified: websites/production/camel/content/running-camel-standalone-and-have-it-keep-running.html
==============================================================================
--- websites/production/camel/content/running-camel-standalone-and-have-it-keep-running.html (original)
+++ websites/production/camel/content/running-camel-standalone-and-have-it-keep-running.html Mon May 21 05:25:23 2018
@@ -102,8 +102,7 @@
<p>The following example shows how you can create your main class, named <code>MainExample</code> and use the <code>Main</code> class from Camel.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeHeader panelHeader pdl" style="border-bottom-width: 1px;"><b>MainExample</b></div><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
public class MainExample {
private Main main;
@@ -117,34 +116,34 @@ public class MainExample {
// create a Main instance
main = new Main();
// bind MyBean into the registry
- main.bind("foo", new MyBean());
+ main.bind("foo", new MyBean());
// add routes
main.addRouteBuilder(new MyRouteBuilder());
// add event listener
main.addMainListener(new Events());
// set the properties from a file
- main.setPropertyPlaceholderLocations("example.properties");
+ main.setPropertyPlaceholderLocations("example.properties");
// run until you terminate the JVM
- System.out.println("Starting Camel. Use ctrl + c to terminate the JVM.\n");
+ System.out.println("Starting Camel. Use ctrl + c to terminate the JVM.\n");
main.run();
}
private static class MyRouteBuilder extends RouteBuilder {
@Override
public void configure() throws Exception {
- from("timer:foo?delay={{millisecs}}")
+ from("timer:foo?delay={{millisecs}}")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
- System.out.println("Invoked timer at " + new Date());
+ System.out.println("Invoked timer at " + new Date());
}
})
- .bean("foo");
+ .bean("foo");
}
}
public static class MyBean {
public void callMe() {
- System.out.println("MyBean.callMe method has been called");
+ System.out.println("MyBean.callMe method has been called");
}
}
@@ -152,17 +151,16 @@ public class MainExample {
@Override
public void afterStart(MainSupport main) {
- System.out.println("MainExample with Camel is now started!");
+ System.out.println("MainExample with Camel is now started!");
}
@Override
public void beforeStop(MainSupport main) {
- System.out.println("MainExample with Camel is now being stopped!");
+ System.out.println("MainExample with Camel is now being stopped!");
}
}
}
-]]></script>
-</div></div>
+</pre>
<h3 id="RunningCamelstandaloneandhaveitkeeprunning-Usingcamel-springJARexample">Using <code>camel-spring</code> JAR example</h3>
Modified: websites/production/camel/content/scatter-gather.html
==============================================================================
--- websites/production/camel/content/scatter-gather.html (original)
+++ websites/production/camel/content/scatter-gather.html Mon May 21 05:25:23 2018
@@ -99,97 +99,88 @@
<p>In this example we want to get the best quote for beer from several different vendors. We use a dynamic <a shape="rect" href="recipient-list.html">Recipient List</a> to get the request for a quote to all vendors and an <a shape="rect" href="aggregator.html">Aggregator</a> to pick the best quote out of all the responses. The routes for this are defined as:</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-<camelContext xmlns="http://camel.apache.org/schema/spring">
+Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
+<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
- <from uri="direct:start"/>
+ <from uri="direct:start"/>
<recipientList>
<header>listOfVendors</header>
</recipientList>
</route>
<route>
- <from uri="seda:quoteAggregator"/>
- <aggregate strategyRef="aggregatorStrategy" completionTimeout="1000">
+ <from uri="seda:quoteAggregator"/>
+ <aggregate strategyRef="aggregatorStrategy" completionTimeout="1000">
<correlationExpression>
<header>quoteRequestId</header>
</correlationExpression>
- <to uri="mock:result"/>
+ <to uri="mock:result"/>
</aggregate>
</route>
</camelContext>
-]]></script>
-</div></div>
+</pre>
<p>So in the first route you see that the <a shape="rect" href="recipient-list.html">Recipient List</a> is looking at the <code>listOfVendors</code> header for the list of recipients. So, we need to send a message like</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
Map<String, Object> headers = new HashMap<>();
-headers.put("listOfVendors", "bean:vendor1, bean:vendor2, bean:vendor3");
-headers.put("quoteRequestId", "quoteRequest-1");
-template.sendBodyAndHeaders("direct:start", "<quote_request item=\"beer\"/>", headers);
-]]></script>
-</div></div>
+headers.put("listOfVendors", "bean:vendor1, bean:vendor2, bean:vendor3");
+headers.put("quoteRequestId", "quoteRequest-1");
+template.sendBodyAndHeaders("direct:start", "<quote_request item=\"beer\"/>", headers);
+</pre>
<p>This message will be distributed to the following <a shape="rect" href="endpoint.html">Endpoint</a>s: <code>bean:vendor1</code>, <code>bean:vendor2</code>, and <code>bean:vendor3</code>. These are all beans which look like</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
public class MyVendor {
private int beerPrice;
- @Produce(uri = "seda:quoteAggregator")
+ @Produce(uri = "seda:quoteAggregator")
private ProducerTemplate quoteAggregator;
public MyVendor(int beerPrice) {
this.beerPrice = beerPrice;
}
- public void getQuote(@XPath("/quote_request/@item") String item, Exchange exchange) throws Exception {
- if ("beer".equals(item)) {
+ public void getQuote(@XPath("/quote_request/@item") String item, Exchange exchange) throws Exception {
+ if ("beer".equals(item)) {
exchange.getIn().setBody(beerPrice);
quoteAggregator.send(exchange);
} else {
- throw new Exception("No quote available for " + item);
+ throw new Exception("No quote available for " + item);
}
}
}
-]]></script>
-</div></div>
+</pre>
<p>and are loaded up in Spring like</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-<bean id="aggregatorStrategy" class="org.apache.camel.spring.processor.scattergather.LowestQuoteAggregationStrategy"/>
+Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
+<bean id="aggregatorStrategy" class="org.apache.camel.spring.processor.scattergather.LowestQuoteAggregationStrategy"/>
-<bean id="vendor1" class="org.apache.camel.spring.processor.scattergather.MyVendor">
+<bean id="vendor1" class="org.apache.camel.spring.processor.scattergather.MyVendor">
<constructor-arg>
<value>1</value>
</constructor-arg>
</bean>
-<bean id="vendor2" class="org.apache.camel.spring.processor.scattergather.MyVendor">
+<bean id="vendor2" class="org.apache.camel.spring.processor.scattergather.MyVendor">
<constructor-arg>
<value>2</value>
</constructor-arg>
</bean>
-<bean id="vendor3" class="org.apache.camel.spring.processor.scattergather.MyVendor">
+<bean id="vendor3" class="org.apache.camel.spring.processor.scattergather.MyVendor">
<constructor-arg>
<value>3</value>
</constructor-arg>
</bean>
-]]></script>
-</div></div>
+</pre>
<p>Each bean is loaded with a different price for beer. When the message is sent to each bean endpoint, it will arrive at the <code>MyVendor.getQuote</code> method. This method does a simple check whether this quote request is for beer and then sets the price of beer on the exchange for retrieval at a later step. The message is forwarded on to the next step using <a shape="rect" href="pojo-producing.html">POJO Producing</a> (see the @Produce annotation).</p>
<p>At the next step we want to take the beer quotes from all vendors and find out which one was the best (i.e. the lowest!). To do this we use an <a shape="rect" href="aggregator.html">Aggregator</a> with a custom aggregation strategy. The <a shape="rect" href="aggregator.html">Aggregator</a> needs to be able to compare only the messages from this particular quote; this is easily done by specifying a correlationExpression equal to the value of the quoteRequestId header. As shown above in the message sending snippet, we set this header to <code>quoteRequest-1</code>. This correlation value should be unique or you may include responses that are not part of this quote. To pick the lowest quote out of the set, we use a custom aggregation strategy like </p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
public class LowestQuoteAggregationStrategy implements AggregationStrategy {
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
// the first time we only have the new exchange
@@ -204,16 +195,13 @@ public class LowestQuoteAggregationStrat
}
}
}
-]]></script>
-</div></div>
+</pre>
<p>Finally, we expect to get the lowest quote of $1 out of $1, $2, and $3.</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
+Error rendering macro 'code': Invalid value specified for parameter 'java.lang.NullPointerException'<pre class="conf-macro output-inline" data-hasbody="true" data-macro-name="unmigrated-inline-wiki-markup">
result.expectedBodiesReceived(1); // expect the lowest quote
-]]></script>
-</div></div>
+</pre>
<p>You can find the full example source here:</p>
@@ -224,24 +212,24 @@ result.expectedBodiesReceived(1); // exp
<p>You can lock down which recipients are used in the Scatter-Gather by using a static <a shape="rect" href="recipient-list.html">Recipient List</a>. It looks something like this</p>
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[
-from("direct:start").multicast().to("seda:vendor1", "seda:vendor2", "seda:vendor3");
-
-from("seda:vendor1").to("bean:vendor1").to("seda:quoteAggregator");
-from("seda:vendor2").to("bean:vendor2").to("seda:quoteAggregator");
-from("seda:vendor3").to("bean:vendor3").to("seda:quoteAggregator");
-
-from("seda:quoteAggregator")
- .aggregate(header("quoteRequestId"), new LowestQuoteAggregationStrategy()).to("mock:result")
-]]></script>
+<div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">
+from("direct:start").multicast().to("seda:vendor1", "seda:vendor2", "seda:vendor3");
+
+from("seda:vendor1").to("bean:vendor1").to("seda:quoteAggregator");
+from("seda:vendor2").to("bean:vendor2").to("seda:quoteAggregator");
+from("seda:vendor3").to("bean:vendor3").to("seda:quoteAggregator");
+
+from("seda:quoteAggregator")
+ .aggregate(header("quoteRequestId"), new LowestQuoteAggregationStrategy()).to("mock:result")
+</pre>
</div></div>
<p>A full example of the static Scatter-Gather configuration can be found in the <a shape="rect" href="loan-broker-example.html">Loan Broker Example</a>.</p>
-<h4 id="Scatter-Gather-UsingThisPattern">Using This Pattern</h4>
+<div class="conf-macro output-block" data-hasbody="false" data-macro-name="include"><h4 id="Scatter-Gather-UsingThisPattern">Using This Pattern</h4>
-<p>If you would like to use this EIP Pattern then please read the <a shape="rect" href="getting-started.html">Getting Started</a>, you may also find the <a shape="rect" href="architecture.html">Architecture</a> useful particularly the description of <a shape="rect" href="endpoint.html">Endpoint</a> and <a shape="rect" href="uris.html">URIs</a>. Then you could try out some of the <a shape="rect" href="examples.html">Examples</a> first before trying this pattern out.</p></div>
+<p>If you would like to use this EIP Pattern then please read the <a shape="rect" href="getting-started.html">Getting Started</a>, you may also find the <a shape="rect" href="architecture.html">Architecture</a> useful particularly the description of <a shape="rect" href="endpoint.html">Endpoint</a> and <a shape="rect" href="uris.html">URIs</a>. Then you could try out some of the <a shape="rect" href="examples.html">Examples</a> first before trying this pattern out.</p></div></div>
</td>
<td valign="top">
<div class="navigation">