Modified: websites/production/camel/content/book-languages-appendix.html
==============================================================================
--- websites/production/camel/content/book-languages-appendix.html (original)
+++ websites/production/camel/content/book-languages-appendix.html Tue Sep 22 
14:26:24 2015
@@ -413,7 +413,7 @@ This is done using the following syntax:
 <route>
   <from uri="direct:a" />
   <recipientList>
-    <property>myProperty</property>
+    <exchangeProperty>myProperty</exchangeProperty>
   </recipientList>
 </route>
 ]]></script>
@@ -439,10 +439,6 @@ from(&quot;direct:a&quot;).recipientList
 <h3 id="BookLanguagesAppendix-ScriptContext">ScriptContext</h3><p>The JSR-223 
scripting languages ScriptContext is pre configured with the following 
attributes all set at <code>ENGINE_SCOPE</code>:</p><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>context</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context ( It cannot 
be used in groovy)</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span>camelContext</span></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="conflue
 nceTd"><p>The Camel Context</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>exchange</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Exchange</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The current 
Exchange</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>request</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The message (IN 
message)</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>response</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The OUT message. The OUT message if null by default. Use IN message 
instead.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>properties</p></td><td colspan="1" rowsp
 an="1" 
class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> 
Function with a <code>resolve</code> method to make it easier to use Camels <a 
shape="rect" href="properties.html">Properties</a> component from scripts. See 
further below for example.</p></td></tr></tbody></table></div><p>See <a 
shape="rect" href="scripting-languages.html">Scripting Languages</a> for the 
list of languages with explicit DSL support.</p><h3 
id="BookLanguagesAppendix-AdditionalargumentstoScriptingEngine">Additional 
arguments to ScriptingEngine</h3><p><strong>Available as of Camel 
2.8</strong></p><p>You can provide additional arguments to the 
<code>ScriptingEngine</code> using a header on the Camel message with the key 
<code>CamelScriptArguments</code>.<br clear="none"> See this example:</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[
 public void testArgumentsExample() throws Exception {
-    if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
-        return;
-    }
-
     getMockEndpoint(&quot;mock:result&quot;).expectedMessageCount(0);
     getMockEndpoint(&quot;mock:unmatched&quot;).expectedMessageCount(1);
 
@@ -517,10 +513,6 @@ result = body * 2 + 1
 <h3 id="BookLanguagesAppendix-ScriptContext.1">ScriptContext</h3><p>The 
JSR-223 scripting languages ScriptContext is pre configured with the following 
attributes all set at <code>ENGINE_SCOPE</code>:</p><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>context</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context ( It cannot 
be used in groovy)</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span>camelContext</span></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confl
 uenceTd"><p>The Camel Context</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>exchange</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Exchange</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The current 
Exchange</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>request</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The message (IN 
message)</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>response</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The OUT message. The OUT message if null by default. Use IN message 
instead.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>properties</p></td><td colspan="1" row
 span="1" 
class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> 
Function with a <code>resolve</code> method to make it easier to use Camels <a 
shape="rect" href="properties.html">Properties</a> component from scripts. See 
further below for example.</p></td></tr></tbody></table></div><p>See <a 
shape="rect" href="scripting-languages.html">Scripting Languages</a> for the 
list of languages with explicit DSL support.</p><h3 
id="BookLanguagesAppendix-AdditionalargumentstoScriptingEngine.1">Additional 
arguments to ScriptingEngine</h3><p><strong>Available as of Camel 
2.8</strong></p><p>You can provide additional arguments to the 
<code>ScriptingEngine</code> using a header on the Camel message with the key 
<code>CamelScriptArguments</code>.<br clear="none"> See this example:</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[
 public void testArgumentsExample() throws Exception {
-    if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
-        return;
-    }
-
     getMockEndpoint(&quot;mock:result&quot;).expectedMessageCount(0);
     getMockEndpoint(&quot;mock:unmatched&quot;).expectedMessageCount(1);
 
@@ -605,10 +597,6 @@ result = body * 2 + 1
 <h3 id="BookLanguagesAppendix-ScriptContext.2">ScriptContext</h3><p>The 
JSR-223 scripting languages ScriptContext is pre configured with the following 
attributes all set at <code>ENGINE_SCOPE</code>:</p><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>context</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context ( It cannot 
be used in groovy)</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span>camelContext</span></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confl
 uenceTd"><p>The Camel Context</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>exchange</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Exchange</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The current 
Exchange</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>request</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The message (IN 
message)</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>response</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The OUT message. The OUT message if null by default. Use IN message 
instead.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>properties</p></td><td colspan="1" row
 span="1" 
class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> 
Function with a <code>resolve</code> method to make it easier to use Camels <a 
shape="rect" href="properties.html">Properties</a> component from scripts. See 
further below for example.</p></td></tr></tbody></table></div><p>See <a 
shape="rect" href="scripting-languages.html">Scripting Languages</a> for the 
list of languages with explicit DSL support.</p><h3 
id="BookLanguagesAppendix-AdditionalargumentstoScriptingEngine.2">Additional 
arguments to ScriptingEngine</h3><p><strong>Available as of Camel 
2.8</strong></p><p>You can provide additional arguments to the 
<code>ScriptingEngine</code> using a header on the Camel message with the key 
<code>CamelScriptArguments</code>.<br clear="none"> See this example:</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[
 public void testArgumentsExample() throws Exception {
-    if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
-        return;
-    }
-
     getMockEndpoint(&quot;mock:result&quot;).expectedMessageCount(0);
     getMockEndpoint(&quot;mock:unmatched&quot;).expectedMessageCount(1);
 
@@ -651,7 +639,7 @@ result = body * 2 + 1
 ]]></script>
 </div></div><p>For example you could use the <strong>groovy</strong> function 
to create an <a shape="rect" href="predicate.html">Predicate</a> in a <a 
shape="rect" href="message-filter.html">Message Filter</a> or as an <a 
shape="rect" href="expression.html">Expression</a> for a <a shape="rect" 
href="recipient-list.html">Recipient List</a></p><h3 
id="BookLanguagesAppendix-CustomizingGroovyShell">Customizing Groovy 
Shell</h3><p>Sometimes you may need to use custom <code>GroovyShell</code> 
instance in your Groovy expressions. To provide custom 
<code>GroovyShell</code>, add implementation of 
the&#160;<code>org.apache.camel.language.groovy.GroovyShellFactory</code> SPI 
interface to your Camel registry. For example after adding the following bean 
to your Spring context...</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[public class CustomGroovyShellFactory 
implements GroovyShellFactory {
-?
+ 
   public GroovyShell createGroovyShell(Exchange exchange) {
     ImportCustomizer importCustomizer = new ImportCustomizer();
     importCustomizer.addStaticStars(&quot;com.example.Utils&quot;);
@@ -677,10 +665,6 @@ from(&quot;queue:foo&quot;).filter(groov
 </div></div><p></p><h3 
id="BookLanguagesAppendix-ScriptContext.3">ScriptContext</h3><p>The JSR-223 
scripting languages ScriptContext is pre configured with the following 
attributes all set at <code>ENGINE_SCOPE</code>:</p><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>context</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context ( It cannot 
be used in groovy)</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span>camelContext</span></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowsp
 an="1" class="confluenceTd"><p>The Camel Context</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p>exchange</p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Exchange</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The current 
Exchange</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>request</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The message (IN 
message)</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>response</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The OUT message. The OUT message if null by default. Use IN message 
instead.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>properties</p></td>
 <td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> 
Function with a <code>resolve</code> method to make it easier to use Camels <a 
shape="rect" href="properties.html">Properties</a> component from scripts. See 
further below for example.</p></td></tr></tbody></table></div><p>See <a 
shape="rect" href="scripting-languages.html">Scripting Languages</a> for the 
list of languages with explicit DSL support.</p><h3 
id="BookLanguagesAppendix-AdditionalargumentstoScriptingEngine.3">Additional 
arguments to ScriptingEngine</h3><p><strong>Available as of Camel 
2.8</strong></p><p>You can provide additional arguments to the 
<code>ScriptingEngine</code> using a header on the Camel message with the key 
<code>CamelScriptArguments</code>.<br clear="none"> See this example:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeConten
 t panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 public void testArgumentsExample() throws Exception {
-    if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
-        return;
-    }
-
     getMockEndpoint(&quot;mock:result&quot;).expectedMessageCount(0);
     getMockEndpoint(&quot;mock:unmatched&quot;).expectedMessageCount(1);
 
@@ -745,10 +729,6 @@ result = body * 2 + 1
 </div></div><p></p><h3 
id="BookLanguagesAppendix-ScriptContext.4">ScriptContext</h3><p>The JSR-223 
scripting languages ScriptContext is pre configured with the following 
attributes all set at <code>ENGINE_SCOPE</code>:</p><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>context</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context ( It cannot 
be used in groovy)</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span>camelContext</span></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowsp
 an="1" class="confluenceTd"><p>The Camel Context</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p>exchange</p></td><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Exchange</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The current 
Exchange</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>request</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The message (IN 
message)</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>response</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The OUT message. The OUT message if null by default. Use IN message 
instead.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>properties</p></td>
 <td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> 
Function with a <code>resolve</code> method to make it easier to use Camels <a 
shape="rect" href="properties.html">Properties</a> component from scripts. See 
further below for example.</p></td></tr></tbody></table></div><p>See <a 
shape="rect" href="scripting-languages.html">Scripting Languages</a> for the 
list of languages with explicit DSL support.</p><h3 
id="BookLanguagesAppendix-AdditionalargumentstoScriptingEngine.4">Additional 
arguments to ScriptingEngine</h3><p><strong>Available as of Camel 
2.8</strong></p><p>You can provide additional arguments to the 
<code>ScriptingEngine</code> using a header on the Camel message with the key 
<code>CamelScriptArguments</code>.<br clear="none"> See this example:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeConten
 t panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 public void testArgumentsExample() throws Exception {
-    if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
-        return;
-    }
-
     getMockEndpoint(&quot;mock:result&quot;).expectedMessageCount(0);
     getMockEndpoint(&quot;mock:unmatched&quot;).expectedMessageCount(1);
 
@@ -803,10 +783,6 @@ result = body * 2 + 1
 <h3 id="BookLanguagesAppendix-ScriptContext.5">ScriptContext</h3><p>The 
JSR-223 scripting languages ScriptContext is pre configured with the following 
attributes all set at <code>ENGINE_SCOPE</code>:</p><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>context</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context ( It cannot 
be used in groovy)</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span>camelContext</span></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confl
 uenceTd"><p>The Camel Context</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>exchange</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Exchange</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The current 
Exchange</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>request</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The message (IN 
message)</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>response</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The OUT message. The OUT message if null by default. Use IN message 
instead.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>properties</p></td><td colspan="1" row
 span="1" 
class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> 
Function with a <code>resolve</code> method to make it easier to use Camels <a 
shape="rect" href="properties.html">Properties</a> component from scripts. See 
further below for example.</p></td></tr></tbody></table></div><p>See <a 
shape="rect" href="scripting-languages.html">Scripting Languages</a> for the 
list of languages with explicit DSL support.</p><h3 
id="BookLanguagesAppendix-AdditionalargumentstoScriptingEngine.5">Additional 
arguments to ScriptingEngine</h3><p><strong>Available as of Camel 
2.8</strong></p><p>You can provide additional arguments to the 
<code>ScriptingEngine</code> using a header on the Camel message with the key 
<code>CamelScriptArguments</code>.<br clear="none"> See this example:</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[
 public void testArgumentsExample() throws Exception {
-    if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
-        return;
-    }
-
     getMockEndpoint(&quot;mock:result&quot;).expectedMessageCount(0);
     getMockEndpoint(&quot;mock:unmatched&quot;).expectedMessageCount(1);
 
@@ -891,10 +867,6 @@ result = body * 2 + 1
 <h3 id="BookLanguagesAppendix-ScriptContext.6">ScriptContext</h3><p>The 
JSR-223 scripting languages ScriptContext is pre configured with the following 
attributes all set at <code>ENGINE_SCOPE</code>:</p><div 
class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Attribute</p></th><th colspan="1" 
rowspan="1" class="confluenceTh"><p>Type</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Value</p></th></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>context</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The Camel Context ( It cannot 
be used in groovy)</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><span>camelContext</span></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.CamelContext</code></p></td><td 
colspan="1" rowspan="1" class="confl
 uenceTd"><p>The Camel Context</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>exchange</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Exchange</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The current 
Exchange</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>request</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>The message (IN 
message)</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>response</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>org.apache.camel.Message</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Deprecated</strong>: 
The OUT message. The OUT message if null by default. Use IN message 
instead.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p>properties</p></td><td colspan="1" row
 span="1" 
class="confluenceTd"><p><code>org.apache.camel.builder.script.PropertiesFunction</code></p></td><td
 colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> 
Function with a <code>resolve</code> method to make it easier to use Camels <a 
shape="rect" href="properties.html">Properties</a> component from scripts. See 
further below for example.</p></td></tr></tbody></table></div><p>See <a 
shape="rect" href="scripting-languages.html">Scripting Languages</a> for the 
list of languages with explicit DSL support.</p><h3 
id="BookLanguagesAppendix-AdditionalargumentstoScriptingEngine.6">Additional 
arguments to ScriptingEngine</h3><p><strong>Available as of Camel 
2.8</strong></p><p>You can provide additional arguments to the 
<code>ScriptingEngine</code> using a header on the Camel message with the key 
<code>CamelScriptArguments</code>.<br clear="none"> See this example:</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[
 public void testArgumentsExample() throws Exception {
-    if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
-        return;
-    }
-
     getMockEndpoint(&quot;mock:result&quot;).expectedMessageCount(0);
     getMockEndpoint(&quot;mock:unmatched&quot;).expectedMessageCount(1);
 
@@ -997,7 +969,7 @@ simple(&quot;There are ${body.length} li
 </div></div><p>Some examples:</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[// exact equals match
 simple(&quot;${in.header.foo} == &#39;foo&#39;&quot;)
-?
+ 
 // ignore case when comparing, so if the header has value FOO this will match
 simple(&quot;${in.header.foo} =~ &#39;foo&#39;&quot;)
 

Modified: websites/production/camel/content/book-pattern-appendix.html
==============================================================================
--- websites/production/camel/content/book-pattern-appendix.html (original)
+++ websites/production/camel/content/book-pattern-appendix.html Tue Sep 22 
14:26:24 2015
@@ -1039,7 +1039,6 @@ public String slip(String body, @Propert
     &lt;route&gt;
         &lt;from uri=&quot;direct:foo&quot;/&gt;
         &lt;transform&gt;&lt;constant&gt;Bye 
World&lt;/constant&gt;&lt;/transform&gt;
-        &lt;to uri=&quot;mock:foo&quot;/&gt;
     &lt;/route&gt;
 
 &lt;/camelContext&gt;
@@ -2732,16 +2731,7 @@ from(&quot;seda:a&quot;).throttle(3).tim
 </div></div><p>So the above example will throttle messages all messages 
received on <strong>seda:a</strong> before being sent to 
<strong>mock:result</strong> ensuring that a maximum of 3 messages are sent in 
any 10 second window.</p><p>Note that since <code>timePeriodMillis</code> 
defaults to 1000 milliseconds, just setting the 
<code>maximumRequestsPerPeriod</code> has the effect of setting the maximum 
number of requests per second. So to throttle requests at 100 requests per 
second between two endpoints, it would look more 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(&quot;seda:a&quot;).throttle(100).to(&quot;seda:b&quot;);
 ]]></script>
-</div></div><p>For further examples of this pattern in use you could look at 
the <a shape="rect" class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlerTest.java?view=markup";>junit
 test case</a></p><p><strong>Using the <a shape="rect" 
href="spring-xml-extensions.html">Spring XML Extensions</a></strong></p><h4 
id="BookPatternAppendix-Camel2.7.xorolder">Camel 2.7.x or older</h4><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-&lt;route&gt;
-  &lt;from uri=&quot;seda:a&quot; /&gt;
-  &lt;throttle maximumRequestsPerPeriod=&quot;3&quot; 
timePeriodMillis=&quot;10000&quot;&gt;
-    &lt;to uri=&quot;mock:result&quot; /&gt;
-  &lt;/throttle&gt;
-&lt;/route&gt;
-]]></script>
-</div></div><h4 id="BookPatternAppendix-Camel2.8onwards">Camel 2.8 
onwards</h4><p>In Camel 2.8 onwards you must set the maximum period as an <a 
shape="rect" href="expression.html">Expression</a> as shown below where we use 
a <a shape="rect" href="constant.html">Constant</a> expression:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div><p>For further examples of this pattern in use you could look at 
the <a shape="rect" class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThrottlerTest.java?view=markup";>junit
 test case</a></p><p><strong>Using the <a shape="rect" 
href="spring-xml-extensions.html">Spring XML Extensions</a></strong></p><h4 
id="BookPatternAppendix-Camel2.7.xorolder">Camel 2.7.x or older</h4>An error 
occurred: Unable to retrieve the URL: 
https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob_plain;hb=HEAD;f=tags/camel-2.7.0/components/camel-spring/src/test/resources/org/apache/camel/spring/processor/throttler.xml
 status code: 404. The error has been recorded.<h4 
id="BookPatternAppendix-Camel2.8onwards">Camel 2.8 onwards</h4><p>In Camel 2.8 
onwards you must set the maximum period as an <a shape="rect" 
href="expression.html">Expression</a> as shown below where we use a <a 
shape="rect" href="constant.html">Constant</a> expr
 ession:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 &lt;route&gt;
     &lt;from uri=&quot;seda:a&quot;/&gt;
@@ -2880,6 +2870,7 @@ from(&quot;seda:b&quot;).delay(1000).to(
 </div></div><h4 id="BookPatternAppendix-SpringDSL">Spring DSL</h4><p>The 
sample below demonstrates the delay in Spring DSL:</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 &lt;bean id=&quot;myDelayBean&quot; 
class=&quot;org.apache.camel.processor.MyDelayCalcBean&quot;/&gt;
+&lt;bean id=&quot;exchangeAwareBean&quot; 
class=&quot;org.apache.camel.processor.ExchangeAwareDelayCalcBean&quot;/&gt;
 
 &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
     &lt;route&gt;
@@ -2903,6 +2894,13 @@ from(&quot;seda:b&quot;).delay(1000).to(
         &lt;/delay&gt;
         &lt;to uri=&quot;mock:result&quot;/&gt;
     &lt;/route&gt;
+    &lt;route&gt;
+        &lt;from uri=&quot;seda:d&quot;/&gt;
+        &lt;delay&gt;
+            &lt;method ref=&quot;exchangeAwareBean&quot; 
method=&quot;delayMe&quot;/&gt;
+        &lt;/delay&gt;
+        &lt;to uri=&quot;mock:result&quot;/&gt;
+    &lt;/route&gt;
 &lt;/camelContext&gt;
 ]]></script>
 </div></div><p>For further examples of this pattern in use you could look at 
the <a shape="rect" class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/DelayerTest.java?view=markup";>junit
 test case</a></p><h3 
id="BookPatternAppendix-Asynchronousdelaying.1">Asynchronous 
delaying</h3><p><strong>Available as of Camel 2.4</strong></p><p>You can let 
the <a shape="rect" href="delayer.html">Delayer</a> use non blocking 
asynchronous delaying, which means Camel will use a scheduler to schedule a 
task to be executed in the future. The task will then continue routing. This 
allows the caller thread to not block and be able to service other messages 
etc.</p><h4 id="BookPatternAppendix-FromJavaDSL">From Java DSL</h4><p>You use 
the <code>asyncDelayed()</code> to enable the async behavior.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
@@ -4016,52 +4014,7 @@ public class SpringConsumerTemplateTest
 
 }
 ]]></script>
-</div></div><h4 id="BookPatternAppendix-Timerbasedpollingconsumer">Timer based 
polling consumer</h4><p>In this sample we use a <a shape="rect" 
href="timer.html">Timer</a> to schedule a route to be started every 5th second 
and invoke our bean <strong>MyCoolBean</strong> where we implement the business 
logic for the <a shape="rect" href="polling-consumer.html">Polling 
Consumer</a>. Here we want to consume all messages from a JMS queue, process 
the message and send them to the next queue.</p><p>First we setup our route 
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[
-MyCoolBean cool = new MyCoolBean();
-cool.setProducer(template);
-cool.setConsumer(consumer);
-
-from(&quot;timer://foo?period=5000&quot;).bean(cool, 
&quot;someBusinessLogic&quot;);
-
-from(&quot;activemq:queue.foo&quot;).to(&quot;mock:result&quot;);
-]]></script>
-</div></div>And then we have out logic in our bean:<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[
-public static class MyCoolBean {
-
-    private int count;
-    private ConsumerTemplate consumer;
-    private ProducerTemplate producer;
-
-    public void setConsumer(ConsumerTemplate consumer) {
-        this.consumer = consumer;
-    }
-
-    public void setProducer(ProducerTemplate producer) {
-        this.producer = producer;
-    }
-
-    public void someBusinessLogic() {
-        // loop to empty queue
-        while (true) {
-            // receive the message from the queue, wait at most 3 sec
-            String msg = 
consumer.receiveBody(&quot;activemq:queue.inbox&quot;, 3000, String.class);
-            if (msg == null) {
-                // no more messages in queue
-                break;
-            }
-
-            // do something with body
-            msg = &quot;Hello &quot; + msg;
-
-            // send it to the next queue
-            producer.sendBodyAndHeader(&quot;activemq:queue.foo&quot;, msg, 
&quot;number&quot;, count++);
-        }
-    }
-}
-]]></script>
-</div></div><h3 id="BookPatternAppendix-ScheduledPollComponents">Scheduled 
Poll Components</h3><p>Quite a few inbound Camel endpoints use a scheduled poll 
pattern to receive messages and push them through the Camel processing routes. 
That is to say externally from the client the endpoint appears to use an <a 
shape="rect" href="event-driven-consumer.html">Event Driven Consumer</a> but 
internally a scheduled poll is used to monitor some kind of state or resource 
and then fire message exchanges.</p><p>Since this a such a common pattern, 
polling components can extend the <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/ScheduledPollConsumer.html";>ScheduledPollConsumer</a>
 base class which makes it simpler to implement this pattern.</p><p>There is 
also the <a shape="rect" href="quartz.html">Quartz Component</a> which provides 
scheduled delivery of messages using the Quartz enterprise scheduler.</p><p>For 
more detai
 ls see:</p><ul><li><a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/PollingConsumer.html";>PollingConsumer</a></li><li>Scheduled
 Polling Components<ul><li><a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/ScheduledPollConsumer.html";>ScheduledPollConsumer</a></li><li><a
 shape="rect" href="scheduler.html">Scheduler</a></li><li><a shape="rect" 
href="atom.html">Atom</a></li><li><a shape="rect" 
href="beanstalk.html">Beanstalk</a></li><li><a shape="rect" 
href="file2.html">File</a></li><li><a shape="rect" 
href="ftp2.html">FTP</a></li><li><a shape="rect" 
href="hbase.html">hbase</a></li><li><a shape="rect" 
href="ibatis.html">iBATIS</a></li><li><a shape="rect" 
href="jpa.html">JPA</a></li><li><a shape="rect" 
href="mail.html">Mail</a></li><li><a shape="rect" 
href="mybatis.html">MyBatis</a></li><li><a shape="rect" 
href="quartz.html">Quartz</a></li><li><a sh
 ape="rect" href="snmp.html">SNMP</a></li><li><a shape="rect" 
href="aws-s3.html">AWS-S3</a></li><li><a shape="rect" 
href="aws-sqs.html">AWS-SQS</a></li></ul></li></ul><h3 
id="BookPatternAppendix-ScheduledPollConsumerOptions">ScheduledPollConsumer 
Options</h3><p>The ScheduledPollConsumer supports the following 
options:</p><div class="confluenceTableSmall"><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>pollStrategy</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>A pluggable 
<code>org.apache.camel.PollingConsumerPollingStrategy</code> allowing you to 
provide your custom implementation to control error handling usually occ
 urred during the <code>poll</code> operation <strong>before</strong> an <a 
shape="rect" href="exchange.html">Exchange</a> have been created and being 
routed in Camel. In other words the error occurred while the polling was 
gathering information, for instance access to a file network failed so Camel 
cannot access it to scan for files. The default implementation will log the 
caused exception at <code>WARN</code> level and ignore it.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>sendEmptyMessageWhenIdle</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.9:</strong> If 
the polling consumer did not poll any files, you can enable this option to send 
an empty message (no body) instead.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>startScheduler</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>true</
 code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Whether the 
scheduler should be auto started.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>initialDelay</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>1000</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Milliseconds before the first poll 
starts.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>delay</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>500</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Milliseconds before the next poll.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>useFixedDelay</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Controls if fixed delay or fixed rate is used. See <a 
shape="rect" class="external-link" href="http://java.sun.com/j2se/1.5.0/
 docs/api/java/util/concurrent/ScheduledExecutorService.html" 
rel="nofollow">ScheduledExecutorService</a> in JDK for details. In 
<strong>Camel 2.7.x</strong> or older the default value is <code>false</code>. 
From <strong>Camel 2.8</strong> onwards the default value is 
<code>true</code>.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>timeUnit</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>TimeUnit.MILLISECONDS</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>time unit for 
<code>initialDelay</code> and <code>delay</code> options.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>runLoggingLevel</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>TRACE</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:</strong> The consumer 
logs a start/complete log line when it polls. This option allows you to 
configure the logging level for that.</p><
 /td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>scheduledExecutorService</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong> 
Allows for configuring a custom/shared thread pool to use for the consumer. By 
default each consumer has its own single threaded thread pool. This option 
allows you to share a thread pool among multiple 
consumers.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>greedy</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.10.6/2.11.1:</strong> If greedy is 
enabled, then the ScheduledPollConsumer will run immediately again, if the 
previous run polled 1 or more messages.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>scheduler</code></p></td><td 
colspan="1" row
 span="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> Allow to 
plugin a custom 
<code>org.apache.camel.spi.ScheduledPollConsumerScheduler</code> to use as the 
scheduler for firing when the polling consumer runs. The default implementation 
uses the <code>ScheduledExecutorService</code> and there is a <a shape="rect" 
href="quartz2.html">Quartz2</a>, and <a shape="rect" 
href="spring.html">Spring</a> based which supports CRON expressions. 
<strong>Notice:</strong> If using a custom scheduler then the options for 
<code>initialDelay</code>, <code>useFixedDelay</code>, <code>timeUnit</code>, 
and <code>scheduledExecutorService</code> may not be in use. Use the text 
<code>quartz2</code> to refer to use the <a shape="rect" 
href="quartz2.html">Quartz2</a> scheduler; and use the text <code>spring</code> 
to use the <a shape="rect" href="spring.html">Spring</a> based; and use the 
text <code>#myScheduler</code> to 
 refer to a custom scheduler by its id in the <a shape="rect" 
href="registry.html">Registry</a>. See <a shape="rect" 
href="quartz2.html">Quartz2</a> page for an example.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>scheduler.xxx</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> To configure 
additional properties when using a custom <code>scheduler</code> or any of the 
<a shape="rect" href="quartz2.html">Quartz2</a>, <a shape="rect" 
href="spring.html">Spring</a> based scheduler.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>backoffMultiplier</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> To 
let the scheduled polling consumer backoff if there has been a number of 
subsequent idles/erro
 rs in a row. The multiplier is then the number of polls that will be skipped 
before the next actual attempt is happening again. When this option is in use 
then <code>backoffIdleThreshold</code> and/or 
<code>backoffErrorThreshold</code> must also be 
configured.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>backoffIdleThreshold</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> 
The number of subsequent idle polls that should happen before the 
<code>backoffMultipler</code> should kick-in.</p></td></tr><tr><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>backoffErrorThreshold</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> 
The number of subsequent error polls (failed due some error) that should happen 
before th
 e <code>backoffMultipler</code> should 
kick-in.</p></td></tr></tbody></table></div></div><h3 
id="BookPatternAppendix-Usingbackofftolettheschedulerbelessaggressive">Using 
backoff to let the scheduler be less aggressive</h3><p><strong>Available as of 
Camel 2.12</strong></p><p>The scheduled <a shape="rect" 
href="polling-consumer.html">Polling Consumer</a> is by default static by using 
the same poll frequency whether or not there is messages to pickup or not. From 
Camel 2.12 onwards you can configure the scheduled <a shape="rect" 
href="polling-consumer.html">Polling Consumer</a> to be more dynamic by using 
backoff. This allows the scheduler to skip N number of polls when it becomes 
idle, or there has been X number of errors in a row. See more details in the 
table above for the <code>backoffXXX</code> options.</p><p>For example to let a 
FTP consumer backoff if its becoming idle for a while you can do:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent panel
 Content pdl">
+</div></div><h4 id="BookPatternAppendix-Timerbasedpollingconsumer">Timer based 
polling consumer</h4><p>In this sample we use a <a shape="rect" 
href="timer.html">Timer</a> to schedule a route to be started every 5th second 
and invoke our bean <strong>MyCoolBean</strong> where we implement the business 
logic for the <a shape="rect" href="polling-consumer.html">Polling 
Consumer</a>. Here we want to consume all messages from a JMS queue, process 
the message and send them to the next queue.</p><p>First we setup our route 
as:An error occurred: Unable to retrieve the URL: 
https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob_plain;hb=HEAD;f=tags/camel-2.6.0/components/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTimerBasedPollingConsumerTest.java
 status code: 404. The error has been recorded.And then we have out logic in 
our bean:An error occurred: Unable to retrieve the URL: 
https://git-wip-us.apache.org/repos/asf?p=camel.git;a=blob_plain;hb=HEAD;f=tags/camel-2.6.0/compo
 
nents/camel-jms/src/test/java/org/apache/camel/component/jms/JmsTimerBasedPollingConsumerTest.java
 status code: 404. The error has been recorded.</p><h3 
id="BookPatternAppendix-ScheduledPollComponents">Scheduled Poll 
Components</h3><p>Quite a few inbound Camel endpoints use a scheduled poll 
pattern to receive messages and push them through the Camel processing routes. 
That is to say externally from the client the endpoint appears to use an <a 
shape="rect" href="event-driven-consumer.html">Event Driven Consumer</a> but 
internally a scheduled poll is used to monitor some kind of state or resource 
and then fire message exchanges.</p><p>Since this a such a common pattern, 
polling components can extend the <a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/ScheduledPollConsumer.html";>ScheduledPollConsumer</a>
 base class which makes it simpler to implement this pattern.</p><p>There is 
also the <a shape="rect" href="qu
 artz.html">Quartz Component</a> which provides scheduled delivery of messages 
using the Quartz enterprise scheduler.</p><p>For more details 
see:</p><ul><li><a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/PollingConsumer.html";>PollingConsumer</a></li><li>Scheduled
 Polling Components<ul><li><a shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/impl/ScheduledPollConsumer.html";>ScheduledPollConsumer</a></li><li><a
 shape="rect" href="scheduler.html">Scheduler</a></li><li><a shape="rect" 
href="atom.html">Atom</a></li><li><a shape="rect" 
href="beanstalk.html">Beanstalk</a></li><li><a shape="rect" 
href="file2.html">File</a></li><li><a shape="rect" 
href="ftp2.html">FTP</a></li><li><a shape="rect" 
href="hbase.html">hbase</a></li><li><a shape="rect" 
href="ibatis.html">iBATIS</a></li><li><a shape="rect" 
href="jpa.html">JPA</a></li><li><a shape="rect" href="mail.h
 tml">Mail</a></li><li><a shape="rect" 
href="mybatis.html">MyBatis</a></li><li><a shape="rect" 
href="quartz.html">Quartz</a></li><li><a shape="rect" 
href="snmp.html">SNMP</a></li><li><a shape="rect" 
href="aws-s3.html">AWS-S3</a></li><li><a shape="rect" 
href="aws-sqs.html">AWS-SQS</a></li></ul></li></ul><h3 
id="BookPatternAppendix-ScheduledPollConsumerOptions">ScheduledPollConsumer 
Options</h3><p>The ScheduledPollConsumer supports the following 
options:</p><div class="confluenceTableSmall"><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>pollStrategy</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>A pluggable <code>org.ap
 ache.camel.PollingConsumerPollingStrategy</code> allowing you to provide your 
custom implementation to control error handling usually occurred during the 
<code>poll</code> operation <strong>before</strong> an <a shape="rect" 
href="exchange.html">Exchange</a> have been created and being routed in Camel. 
In other words the error occurred while the polling was gathering information, 
for instance access to a file network failed so Camel cannot access it to scan 
for files. The default implementation will log the caused exception at 
<code>WARN</code> level and ignore it.</p></td></tr><tr><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>sendEmptyMessageWhenIdle</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.9:</strong> If 
the polling consumer did not poll any files, you can enable this option to send 
an empty message (no body) instead.</p></td></tr><tr><td colspan="1"
  rowspan="1" class="confluenceTd"><p><code>startScheduler</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>Whether the scheduler should be 
auto started.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>initialDelay</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>1000</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Milliseconds before the first poll 
starts.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>delay</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>500</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Milliseconds before the next poll.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>useFixedDelay</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="conflu
 enceTd"><p>Controls if fixed delay or fixed rate is used. See <a shape="rect" 
class="external-link" 
href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ScheduledExecutorService.html";
 rel="nofollow">ScheduledExecutorService</a> in JDK for details. In 
<strong>Camel 2.7.x</strong> or older the default value is <code>false</code>. 
From <strong>Camel 2.8</strong> onwards the default value is 
<code>true</code>.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>timeUnit</code></p></td><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>TimeUnit.MILLISECONDS</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>time unit for 
<code>initialDelay</code> and <code>delay</code> options.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>runLoggingLevel</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>TRACE</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.8:
 </strong> The consumer logs a start/complete log line when it polls. This 
option allows you to configure the logging level for that.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>scheduledExecutorService</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong> 
Allows for configuring a custom/shared thread pool to use for the consumer. By 
default each consumer has its own single threaded thread pool. This option 
allows you to share a thread pool among multiple 
consumers.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>greedy</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.10.6/2.11.1:</strong> If greedy is 
enabled, then the ScheduledPollConsumer will run immediately again, if the 
previous run polled 1 
 or more messages.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>scheduler</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> Allow to 
plugin a custom 
<code>org.apache.camel.spi.ScheduledPollConsumerScheduler</code> to use as the 
scheduler for firing when the polling consumer runs. The default implementation 
uses the <code>ScheduledExecutorService</code> and there is a <a shape="rect" 
href="quartz2.html">Quartz2</a>, and <a shape="rect" 
href="spring.html">Spring</a> based which supports CRON expressions. 
<strong>Notice:</strong> If using a custom scheduler then the options for 
<code>initialDelay</code>, <code>useFixedDelay</code>, <code>timeUnit</code>, 
and <code>scheduledExecutorService</code> may not be in use. Use the text 
<code>quartz2</code> to refer to use the <a shape="rect" 
href="quartz2.html">Quartz2</a> scheduler; and use th
 e text <code>spring</code> to use the <a shape="rect" 
href="spring.html">Spring</a> based; and use the text <code>#myScheduler</code> 
to refer to a custom scheduler by its id in the <a shape="rect" 
href="registry.html">Registry</a>. See <a shape="rect" 
href="quartz2.html">Quartz2</a> page for an example.</p></td></tr><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><p><code>scheduler.xxx</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>null</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> To configure 
additional properties when using a custom <code>scheduler</code> or any of the 
<a shape="rect" href="quartz2.html">Quartz2</a>, <a shape="rect" 
href="spring.html">Spring</a> based scheduler.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>backoffMultiplier</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td 
colspan="1" rowspan="1" class="conflu
 enceTd"><p><strong>Camel 2.12:</strong> To let the scheduled polling consumer 
backoff if there has been a number of subsequent idles/errors in a row. The 
multiplier is then the number of polls that will be skipped before the next 
actual attempt is happening again. When this option is in use then 
<code>backoffIdleThreshold</code> and/or <code>backoffErrorThreshold</code> 
must also be configured.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>backoffIdleThreshold</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.12:</strong> 
The number of subsequent idle polls that should happen before the 
<code>backoffMultipler</code> should kick-in.</p></td></tr><tr><td colspan="1" 
rowspan="1" 
class="confluenceTd"><p><code>backoffErrorThreshold</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>0</code></p></td><td 
colspan="1" rowspan="1" class
 ="confluenceTd"><p><strong>Camel 2.12:</strong> The number of subsequent error 
polls (failed due some error) that should happen before the 
<code>backoffMultipler</code> should 
kick-in.</p></td></tr></tbody></table></div></div><h3 
id="BookPatternAppendix-Usingbackofftolettheschedulerbelessaggressive">Using 
backoff to let the scheduler be less aggressive</h3><p><strong>Available as of 
Camel 2.12</strong></p><p>The scheduled <a shape="rect" 
href="polling-consumer.html">Polling Consumer</a> is by default static by using 
the same poll frequency whether or not there is messages to pickup or not. From 
Camel 2.12 onwards you can configure the scheduled <a shape="rect" 
href="polling-consumer.html">Polling Consumer</a> to be more dynamic by using 
backoff. This allows the scheduler to skip N number of polls when it becomes 
idle, or there has been X number of errors in a row. See more details in the 
table above for the <code>backoffXXX</code> options.</p><p>For example to let a 
FTP consumer bac
 koff if its becoming idle for a while you can do:</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(&quot;ftp://myserver?username=foo&amp;passowrd=secret?delete=true&amp;delay=5s&amp;backoffMultiplier=6&amp;backoffIdleThreshold=5&quot;)
       .to(&quot;bean:processFile&quot;);
 ]]></script>
@@ -4310,7 +4263,7 @@ RouteBuilder builder = new RouteBuilder(
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 from(&quot;direct:start&quot;).idempotentConsumer(
         header(&quot;messageId&quot;),
-        jpaMessageIdRepository(lookup(JpaTemplate.class), PROCESSOR_NAME)
+        jpaMessageIdRepository(lookup(EntityManagerFactory.class), 
PROCESSOR_NAME)
 ).to(&quot;mock:result&quot;);
 ]]></script>
 </div></div><p>In the above <a shape="rect" class="external-link" 
href="https://svn.apache.org/repos/asf/camel/trunk/components/camel-jpa/src/test/java/org/apache/camel/processor/jpa/JpaIdempotentConsumerTest.java";>example</a>
 we are using the header <strong>messageId</strong> to filter out duplicates 
and using the collection <strong>myProcessorName</strong> to indicate the 
Message ID Repository to use. This name is important as you could process the 
same message by many different processors; so each may require its own logical 
Message ID Repository.</p><p>For further examples of this pattern in use you 
could look at the <a shape="rect" class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/IdempotentConsumerTest.java?view=markup";>junit
 test case</a></p><h3 id="BookPatternAppendix-SpringXMLexample">Spring XML 
example</h3><p>The following example will use the header 
<strong>myMessageId</strong> to filter out duplicates
 </p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
@@ -4359,7 +4312,7 @@ from(&quot;direct:start&quot;)
             &lt;!-- we will to handle duplicate messages using a filter --&gt;
             &lt;filter&gt;
                 &lt;!-- the filter will only react on duplicate messages, if 
this property is set on the Exchange --&gt;
-                &lt;property&gt;CamelDuplicateMessage&lt;/property&gt;
+                
&lt;exchangeProperty&gt;CamelDuplicateMessage&lt;/exchangeProperty&gt;
                 &lt;!-- and send the message to this mock, due its part of an 
unit test --&gt;
                 &lt;!-- but you can of course do anything as its part of the 
route --&gt;
                 &lt;to uri=&quot;mock:duplicate&quot;/&gt;
@@ -4380,7 +4333,7 @@ from(&quot;direct:start&quot;)
 </div></div><p>You have to define how long the repository should hold each 
message id (default is to delete it never). To avoid that you run out of memory 
you should create an eviction strategy based on the <a shape="rect" 
class="external-link" 
href="http://www.hazelcast.com/documentation.jsp#MapEviction"; 
rel="nofollow">Hazelcast configuration</a>. For additional information see <a 
shape="rect" href="hazelcast-component.html">camel-hazelcast</a>.</p><p>See 
this <a shape="rect" 
href="hazelcast-idempotent-repository-tutorial.html">little tutorial</a>, how 
setup such an idempotent repository on two cluster nodes using Apache 
Karaf.</p><p><strong>Available as of Camel <strong> 
2.13.0</strong></strong></p><p>Another option for using Idempotent Consumer in 
a clustered environment is Infinispan. Infinispan is a data grid with 
replication and distribution clustering support. For additional information 
see<strong> <a shape="rect" href="infinispan.html">camel-infinispan</a>.<br 
clear="none"><
 /strong></p><p></p><h4 id="BookPatternAppendix-UsingThisPattern.42">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>
-<h3 id="BookPatternAppendix-TransactionalClient">Transactional 
Client</h3><p>Camel recommends supporting the <a shape="rect" 
class="external-link" 
href="http://www.enterpriseintegrationpatterns.com/TransactionalClient.html"; 
rel="nofollow">Transactional Client</a> from the <a shape="rect" 
href="enterprise-integration-patterns.html">EIP patterns</a> using spring 
transactions.</p><p><span class="confluence-embedded-file-wrapper"><img 
class="confluence-embedded-image confluence-external-resource" 
src="http://www.enterpriseintegrationpatterns.com/img/TransactionalClientSolution.gif";
 
data-image-src="http://www.enterpriseintegrationpatterns.com/img/TransactionalClientSolution.gif";></span></p><p>Transaction
 Oriented Endpoints (<a shape="rect" href="what-is-a-camel-toe.html">Camel 
Toes</a>) like <a shape="rect" href="jms.html">JMS</a> support using a 
transaction for both inbound and outbound message exchanges. Endpoints that 
support transactions will participate in the current transaction co
 ntext that they are called from.</p><div class="confluence-information-macro 
confluence-information-macro-tip"><p class="title">Configuration of 
Redelivery</p><span class="aui-icon aui-icon-small aui-iconfont-approve 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>The redelivery in transacted mode 
is <strong>not</strong> handled by Camel but by the backing system (the 
transaction manager). In such cases you should resort to the backing system how 
to configure the redelivery.</p></div></div><p>You should use the <a 
shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-spring/apidocs/org/apache/camel/spring/SpringRouteBuilder.html";>SpringRouteBuilder</a>
 to setup the routes since you will need to setup the spring context with the 
TransactionTemplates that will define the transaction manager configuration and 
policies.</p><p>For inbound endpoint to be transacted, they normally need to be 
configured to use a Spri
 ng PlatformTransactionManager. In the case of the JMS component, this can be 
done by looking it up in the spring context.</p><p>You first define needed 
object in the spring configuration.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<h3 id="BookPatternAppendix-TransactionalClient">Transactional 
Client</h3><p>Camel recommends supporting the <a shape="rect" 
class="external-link" 
href="http://www.enterpriseintegrationpatterns.com/TransactionalClient.html"; 
rel="nofollow">Transactional Client</a> from the <a shape="rect" 
href="enterprise-integration-patterns.html">EIP patterns</a> using spring 
transactions.</p><p><span class="confluence-embedded-file-wrapper"><img 
class="confluence-embedded-image confluence-external-resource" 
src="http://www.enterpriseintegrationpatterns.com/img/TransactionalClientSolution.gif";
 
data-image-src="http://www.enterpriseintegrationpatterns.com/img/TransactionalClientSolution.gif";></span></p><p>Transaction
 Oriented Endpoints like <a shape="rect" href="jms.html">JMS</a> support using 
a transaction for both inbound and outbound message exchanges. Endpoints that 
support transactions will participate in the current transaction context that 
they are called from.</p><div class="confluence-inform
 ation-macro confluence-information-macro-tip"><p class="title">Configuration 
of Redelivery</p><span class="aui-icon aui-icon-small aui-iconfont-approve 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>The redelivery in transacted mode 
is <strong>not</strong> handled by Camel but by the backing system (the 
transaction manager). In such cases you should resort to the backing system how 
to configure the redelivery.</p></div></div><p>You should use the <a 
shape="rect" class="external-link" 
href="http://camel.apache.org/maven/current/camel-spring/apidocs/org/apache/camel/spring/SpringRouteBuilder.html";>SpringRouteBuilder</a>
 to setup the routes since you will need to setup the spring context with the 
TransactionTemplates that will define the transaction manager configuration and 
policies.</p><p>For inbound endpoint to be transacted, they normally need to be 
configured to use a Spring PlatformTransactionManager. In the case of the JMS 
component, 
 this can be done by looking it up in the spring context.</p><p>You first 
define needed object in the spring configuration.</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;bean 
id=&quot;jmsTransactionManager&quot; 
class=&quot;org.springframework.jms.connection.JmsTransactionManager&quot;&gt;
     &lt;property name=&quot;connectionFactory&quot; 
ref=&quot;jmsConnectionFactory&quot; /&gt;
   &lt;/bean&gt;
@@ -4453,7 +4406,7 @@ from(&quot;direct:start&quot;)
     &lt;property name=&quot;dataSource&quot; ref=&quot;dataSource&quot;/&gt;
 &lt;/bean&gt;
 ]]></script>
-</div></div><p>Then we are ready to define our Camel routes. We have two 
routes: 1 for success conditions, and 1 for a forced rollback condition.<br 
clear="none"> This is after all based on a unit test. Notice that we mark each 
route as transacted using the <strong>transacted</strong> tag.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div>Then we are ready to define our Camel routes. We have two routes: 
1 for success conditions, and 1 for a forced rollback condition.<br 
clear="none"> This is after all based on a unit test. Notice that we mark each 
route as transacted using the <strong>transacted</strong> tag.<div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
     &lt;route&gt;
@@ -4489,10 +4442,10 @@ from(&quot;direct:start&quot;)
     &lt;/route&gt;
 &lt;/camelContext&gt;
 ]]></script>
-</div></div><p>That is all that is needed to configure a Camel route as being 
transacted. Just remember to use the <strong>transacted</strong> DSL. The rest 
is standard Spring XML to setup the transaction manager.</p><h3 
id="BookPatternAppendix-JMSSample">JMS Sample</h3><p>In this sample we want to 
listen for messages on a queue and process the messages with our business logic 
java code and send them along. Since its based on a <a shape="rect" 
class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionMinimalConfigurationTest.java?view=log";>unit
 test</a> the destination is a mock endpoint.</p><p>First we configure the 
standard Spring XML to declare a JMS connection factory, a JMS transaction 
manager and our ActiveMQ component that we use in our routing.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div>That is all that is needed to configure a Camel route as being 
transacted. Just remember to use the <strong>transacted</strong> DSL. The rest 
is standard Spring XML to setup the transaction manager.<h3 
id="BookPatternAppendix-JMSSample">JMS Sample</h3><p>In this sample we want to 
listen for messages on a queue and process the messages with our business logic 
java code and send them along. Since its based on a <a shape="rect" 
class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/components/camel-jms/src/test/java/org/apache/camel/component/jms/tx/TransactionMinimalConfigurationTest.java?view=log";>unit
 test</a> the destination is a mock endpoint.</p><p>First we configure the 
standard Spring XML to declare a JMS connection factory, a JMS transaction 
manager and our ActiveMQ component that we use in our routing.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 &lt;!-- setup JMS connection factory --&gt;
-&lt;bean id=&quot;poolConnectionFactory&quot; 
class=&quot;org.apache.activemq.pool.PooledConnectionFactory&quot;&gt;
+&lt;bean id=&quot;poolConnectionFactory&quot; 
class=&quot;org.apache.activemq.pool.PooledConnectionFactory&quot; 
init-method=&quot;start&quot; destroy-method=&quot;stop&quot;&gt;
     &lt;property name=&quot;maxConnections&quot; value=&quot;8&quot;/&gt;
     &lt;property name=&quot;connectionFactory&quot; 
ref=&quot;jmsConnectionFactory&quot;/&gt;
 &lt;/bean&gt;
@@ -4517,7 +4470,7 @@ from(&quot;direct:start&quot;)
     &lt;property name=&quot;transactionManager&quot; 
ref=&quot;jmsTransactionManager&quot;/&gt;
 &lt;/bean&gt;
 ]]></script>
-</div></div><p>And then we configure our routes. Notice that all we have to do 
is mark the route as transacted using the <strong>transacted</strong> 
tag.</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
+</div></div>And then we configure our routes. Notice that all we have to do is 
mark the route as transacted using the <strong>transacted</strong> tag.<div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
 <script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
 &lt;camelContext xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
     &lt;!-- disable JMX during testing --&gt;
@@ -4548,14 +4501,14 @@ from(&quot;direct:start&quot;)
     &lt;property name=&quot;propagationBehaviorName&quot; 
value=&quot;PROPAGATION_REQUIRES_NEW&quot;/&gt;
 &lt;/bean&gt;
 ]]></script>
-</div></div><p>Then in the routes you use transacted DSL to indicate which of 
these two propagations it uses.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div>Then in the routes you use transacted DSL to indicate which of 
these two propagations it uses.<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(&quot;direct:mixed&quot;)
     // using required
     .transacted(&quot;PROPAGATION_REQUIRED&quot;)
     // all these steps will be okay
-    .setBody(constant(&quot;Tiger in 
Action&quot;)).beanRef(&quot;bookService&quot;)
-    .setBody(constant(&quot;Elephant in 
Action&quot;)).beanRef(&quot;bookService&quot;)
+    .setBody(constant(&quot;Tiger in 
Action&quot;)).bean(&quot;bookService&quot;)
+    .setBody(constant(&quot;Elephant in 
Action&quot;)).bean(&quot;bookService&quot;)
     // continue on route 2
     .to(&quot;direct:mixed2&quot;);
 
@@ -4566,11 +4519,11 @@ from(&quot;direct:mixed2&quot;)
     // using a different propagation which is requires new
     .transacted(&quot;PROPAGATION_REQUIRES_NEW&quot;)
     // this step will be okay
-    .setBody(constant(&quot;Lion in 
Action&quot;)).beanRef(&quot;bookService&quot;)
+    .setBody(constant(&quot;Lion in 
Action&quot;)).bean(&quot;bookService&quot;)
     // this step will fail with donkey
-    .setBody(constant(&quot;Donkey in 
Action&quot;)).beanRef(&quot;bookService&quot;);
+    .setBody(constant(&quot;Donkey in 
Action&quot;)).bean(&quot;bookService&quot;);
 ]]></script>
-</div></div><p>Notice how we have configured the <code>onException</code> in 
the 2nd route to indicate in case of any exceptions we should handle it and 
just rollback this transaction. This is done using the 
<code>markRollbackOnlyLast</code> which tells Camel to only do it for the 
current transaction and not globally.</p><h4 
id="BookPatternAppendix-SeeAlso.7">See Also</h4><ul><li><a shape="rect" 
href="error-handling-in-camel.html">Error handling in Camel</a></li><li><a 
shape="rect" 
href="transactionerrorhandler.html">TransactionErrorHandler</a></li><li><a 
shape="rect" href="error-handler.html">Error Handler</a></li><li><a 
shape="rect" href="jms.html">JMS</a></li></ul><p></p><h4 
id="BookPatternAppendix-UsingThisPattern.43">Using This Pattern</h4>
+</div></div>Notice how we have configured the <code>onException</code> in the 
2nd route to indicate in case of any exceptions we should handle it and just 
rollback this transaction. This is done using the 
<code>markRollbackOnlyLast</code> which tells Camel to only do it for the 
current transaction and not globally.<h4 id="BookPatternAppendix-SeeAlso.7">See 
Also</h4><ul><li><a shape="rect" href="error-handling-in-camel.html">Error 
handling in Camel</a></li><li><a shape="rect" 
href="transactionerrorhandler.html">TransactionErrorHandler</a></li><li><a 
shape="rect" href="error-handler.html">Error Handler</a></li><li><a 
shape="rect" href="jms.html">JMS</a></li></ul><p></p><h4 
id="BookPatternAppendix-UsingThisPattern.43">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>
 <h3 id="BookPatternAppendix-MessagingGateway">Messaging Gateway</h3><p>Camel 
has several endpoint components that support the <a shape="rect" 
class="external-link" 
href="http://www.enterpriseintegrationpatterns.com/MessagingGateway.html"; 
rel="nofollow">Messaging Gateway</a> from the <a shape="rect" 
href="enterprise-integration-patterns.html">EIP patterns</a>.</p><p><span 
class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image 
confluence-external-resource" 
src="http://www.enterpriseintegrationpatterns.com/img/MessagingGatewaySolution.gif";
 
data-image-src="http://www.enterpriseintegrationpatterns.com/img/MessagingGatewaySolution.gif";></span></p><p>Components
 like <a shape="rect" href="bean.html">Bean</a> and <a shape="rect" 
href="cxf.html">CXF</a> provide a a way to bind a Java interface to the message 
exchange.</p><p>However you may want to read the <a shape="rect" 
href="using-camelproxy.html">Using CamelProxy</a> documentation as a true <a 
shape="rect" href="me
 ssaging-gateway.html">Messaging Gateway</a> EIP solution.<br clear="none"> 
Another approach is to use <code>@Produce</code> which you can read about in <a 
shape="rect" href="pojo-producing.html">POJO Producing</a> which also can be 
used as a <a shape="rect" href="messaging-gateway.html">Messaging Gateway</a> 
EIP solution.</p><p>&#160;</p><h4 
id="BookPatternAppendix-Example.11">Example</h4><p>The following example how 
the&#160;<a shape="rect" href="cxf.html">CXF</a>&#160;and&#160;<a shape="rect" 
href="bean.html">Bean</a>&#160;components can be used to abstract the developer 
from the underlying messaging system API</p><p><strong><br 
clear="none"></strong></p><p><strong>Using the&#160;<a shape="rect" 
href="fluent-builders.html">Fluent Builders</a></strong></p><div class="code 
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
@@ -4681,7 +4634,7 @@ from(&quot;direct:start&quot;)
     &lt;from uri=&quot;direct:start&quot;/&gt;
     &lt;to uri=&quot;log:foo&quot;/&gt;
     &lt;wireTap uri=&quot;direct:tap&quot;/&gt;
-    &lt;to uri=&quot;mock:result&quot;/&gt;
+  &lt;to uri=&quot;mock:result&quot;/&gt;
 &lt;/route&gt;
 ]]></script>
 </div></div><h4 id="BookPatternAppendix-Sendinganew">Sending a new <a 
shape="rect" href="exchange.html">Exchange</a></h4><p><strong>Using the <a 
shape="rect" href="fluent-builders.html">Fluent Builders</a></strong><br 
clear="none"> Camel supports either a processor or an <a shape="rect" 
href="expression.html">Expression</a> to populate the new <a shape="rect" 
href="exchange.html">Exchange</a>. Using a processor gives you full power over 
how the <a shape="rect" href="exchange.html">Exchange</a> is populated as you 
can set properties, headers, et cetera. An <a shape="rect" 
href="expression.html">Expression</a> can only be used to set the IN 
body.</p><p>From <strong>Camel 2.3</strong> onwards the <a shape="rect" 
href="expression.html">Expression</a> or <a shape="rect" 
href="processor.html">Processor</a> is pre-populated with a copy of the 
original <a shape="rect" href="exchange.html">Exchange</a>, which allows you to 
access the original message when you prepare a new <a shape="rect" hr
 ef="exchange.html">Exchange</a> to be sent. You can use the <code>copy</code> 
option (enabled by default) to indicate whether you want this. If you set 
<code>copy=false</code>, then it works as in Camel 2.2 or older where the <a 
shape="rect" href="exchange.html">Exchange</a> will be empty.</p><p>Below is 
the processor variation. This example is from Camel 2.3, where we disable 
<code>copy</code> by passing in <code>false</code> to create a new, empty <a 
shape="rect" href="exchange.html">Exchange</a>.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">


Reply via email to