Author: buildbot Date: Fri Mar 11 08:20:16 2016 New Revision: 982457 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/book-in-one-page.html websites/production/camel/content/book-pattern-appendix.html websites/production/camel/content/cache/main.pageCache websites/production/camel/content/camel-2170-release.html websites/production/camel/content/loop.html Modified: websites/production/camel/content/book-in-one-page.html ============================================================================== --- websites/production/camel/content/book-in-one-page.html (original) +++ websites/production/camel/content/book-in-one-page.html Fri Mar 11 08:20:16 2016 @@ -3739,11 +3739,11 @@ The tutorial has been designed in two pa While not actual tutorials you might find working through the source of the various <a shape="rect" href="examples.html">Examples</a> useful.</li></ul> <h2 id="BookInOnePage-TutorialonSpringRemotingwithJMS">Tutorial on Spring Remoting with JMS</h2><p> </p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Thanks</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>This tutorial was kindly donated to Apache Camel by Martin Gilday.</p></div></div><h2 id="BookInOnePage-Preface">Preface</h2><p>This tutorial aims to guide the reader through the stages of creating a project which uses Camel to facilitate the routing of messages from a JMS queue to a <a shape="rect" class="external-link" href="http://www.springramework.org" rel="nofollow">Spring</a> service. The route works in a synchronous fashion returning a response to the client.</p><p><style type="text/css">/*<![CDATA[*/ -div.rbtoc1457680799716 {padding: 0px;} -div.rbtoc1457680799716 ul {list-style: disc;margin-left: 0px;} -div.rbtoc1457680799716 li {margin-left: 0px;padding-left: 0px;} +div.rbtoc1457684323963 {padding: 0px;} +div.rbtoc1457684323963 ul {list-style: disc;margin-left: 0px;} +div.rbtoc1457684323963 li {margin-left: 0px;padding-left: 0px;} -/*]]>*/</style></p><div class="toc-macro rbtoc1457680799716"> +/*]]>*/</style></p><div class="toc-macro rbtoc1457684323963"> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-TutorialonSpringRemotingwithJMS">Tutorial on Spring Remoting with JMS</a></li><li><a shape="rect" href="#BookInOnePage-Preface">Preface</a></li><li><a shape="rect" href="#BookInOnePage-Prerequisites">Prerequisites</a></li><li><a shape="rect" href="#BookInOnePage-Distribution">Distribution</a></li><li><a shape="rect" href="#BookInOnePage-About">About</a></li><li><a shape="rect" href="#BookInOnePage-CreatetheCamelProject">Create the Camel Project</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-UpdatethePOMwithDependencies">Update the POM with Dependencies</a></li></ul> </li><li><a shape="rect" href="#BookInOnePage-WritingtheServer">Writing the Server</a> @@ -5858,11 +5858,11 @@ So we completed the last piece in the pi <p>This example has been removed from <strong>Camel 2.9</strong> onwards. Apache Axis 1.4 is a very old and unsupported framework. We encourage users to use <a shape="rect" href="cxf.html">CXF</a> instead of Axis.</p></div></div> <style type="text/css">/*<![CDATA[*/ -div.rbtoc1457680801371 {padding: 0px;} -div.rbtoc1457680801371 ul {list-style: disc;margin-left: 0px;} -div.rbtoc1457680801371 li {margin-left: 0px;padding-left: 0px;} +div.rbtoc1457684324470 {padding: 0px;} +div.rbtoc1457684324470 ul {list-style: disc;margin-left: 0px;} +div.rbtoc1457684324470 li {margin-left: 0px;padding-left: 0px;} -/*]]>*/</style><div class="toc-macro rbtoc1457680801371"> +/*]]>*/</style><div class="toc-macro rbtoc1457684324470"> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-TutorialusingAxis1.4withApacheCamel">Tutorial using Axis 1.4 with Apache Camel</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-Prerequisites">Prerequisites</a></li><li><a shape="rect" href="#BookInOnePage-Distribution">Distribution</a></li><li><a shape="rect" href="#BookInOnePage-Introduction">Introduction</a></li><li><a shape="rect" href="#BookInOnePage-SettinguptheprojecttorunAxis">Setting up the project to run Axis</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-Maven2">Maven 2</a></li><li><a shape="rect" href="#BookInOnePage-wsdl">wsdl</a></li><li><a shape="rect" href="#BookInOnePage-ConfiguringAxis">Configuring Axis</a></li><li><a shape="rect" href="#BookInOnePage-RunningtheExample">Running the Example</a></li></ul> @@ -14851,53 +14851,19 @@ from("direct:start") </div></div>Notice the <code>onPrepare</code> option is also available on other <a shape="rect" href="eip.html">EIP</a>s such as <a shape="rect" href="splitter.html">Splitter</a>, <a shape="rect" href="recipient-list.html">Recipient List</a>, and <a shape="rect" href="wire-tap.html">Wire Tap</a>.<p></p><h4 id="BookInOnePage-UsingThisPattern.28">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> -<h2 id="BookInOnePage-Loop">Loop</h2> -<p>The Loop allows for processing a message a number of times, possibly in a different way for each iteration. Useful mostly during testing.</p> - -<div class="confluence-information-macro confluence-information-macro-information"><p class="title">Default mode</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"> -<p>Notice by default the loop uses the same exchange throughout the looping. So the result from the previous iteration will be used for the next (eg <a shape="rect" href="pipes-and-filters.html">Pipes And Filters</a>). From <strong>Camel 2.8</strong> onwards you can enable copy mode instead. See the options table for more details.</p></div></div> - -<h3 id="BookInOnePage-Options.17">Options</h3> -<div class="confluenceTableSmall"></div> -<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Name </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Default Value </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Description </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>copy</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.8:</strong> Whether or not copy mode is used. If <code>false</code> then the same Exchange will be used for each iteration. So the result from the previous iteration will be <em>visible</em> for the next iteration. Instead you can enable copy mode, and then each iteration <em>restarts</em> with a fresh copy of the input <a shape="rect" href="exchange.html">Exchange</a>. </p></td></tr></tbody></table></div> - - -<h3 id="BookInOnePage-Exchangeproperties.1">Exchange properties</h3> -<p>For each iteration two properties are set on the <code>Exchange</code>. Processors can rely on these properties to process the <a shape="rect" href="message.html">Message</a> in different ways.</p> -<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Property </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Description </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>CamelLoopSize</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Total number of loops </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>CamelLoopIndex</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Index of the current iteration (0 based) </p></td></tr></tbody></table></div> - - -<h4 id="BookInOnePage-Examples.10">Examples</h4> - -<p>The following example shows how to take a request from the <strong>direct:x</strong> endpoint, then send the message repetitively to <strong>mock:result</strong>. The number of times the message is sent is either passed as an argument to <code>loop()</code>, or determined at runtime by evaluating an expression. The expression <strong>must</strong> evaluate to an <code>int</code>, otherwise a <code>RuntimeCamelException</code> is thrown.</p> - -<p><strong>Using the <a shape="rect" href="fluent-builders.html">Fluent Builders</a></strong></p> - -<p>Pass loop count as an argument</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<h2 id="BookInOnePage-Loop">Loop</h2><p>The Loop allows for processing a message a number of times, possibly in a different way for each iteration. Useful mostly during testing.</p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Default mode</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Notice by default the loop uses the same exchange throughout the looping. So the result from the previous iteration will be used for the next (eg <a shape="rect" href="pipes-and-filters.html">Pipes and Filters</a>). From <strong>Camel 2.8</strong> onwards you can enable copy mode instead. See the options table for more details.</p></div></div><h3 id="BookInOnePage-Options.17">Options</h3><div class="confluenceTableSmall"> </div><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh">< p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>copy</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.8:</strong> Whether or not copy mode is used. If <code>false</code> then the same Exchange will be used for each iteration. So the result from the previous iteration will be <em>visible</em> for the next iteration. Instead you can enable copy mode, and then each iteration <em>restarts</em> with a fresh copy of the input <a shape="rect" href="exchange.html">Exchange</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">doWhile</td><td colspan="1" rowspan="1" class="confluenceTd"> </td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.17:</strong> Enables the w hile loop that loops until the predicate evaluates to false or null.</td></tr></tbody></table></div><h3 id="BookInOnePage-Exchangeproperties.1">Exchange properties</h3><p>For each iteration two properties are set on the <code>Exchange</code>. Processors can rely on these properties to process the <a shape="rect" href="message.html">Message</a> in different ways.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Property</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelLoopSize</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Total number of loops. This is not available if running the loop in while loop mode.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelLoopIndex</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Index of the current iteration ( 0 based)</p></td></tr></tbody></table></div><h4 id="BookInOnePage-Examples.10">Examples</h4><p>The following example shows how to take a request from the <strong>direct:x</strong> endpoint, then send the message repetitively to <strong>mock:result</strong>. The number of times the message is sent is either passed as an argument to <code>loop()</code>, or determined at runtime by evaluating an expression. The expression <strong>must</strong> evaluate to an <code>int</code>, otherwise a <code>RuntimeCamelException</code> is thrown.</p><p><strong>Using the <a shape="rect" href="fluent-builders.html">Fluent Builders</a></strong></p><p>Pass loop count as an argument</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:a").loop(8).to("mock:result"); ]]></script> -</div></div> - -<p>Use expression to determine loop count</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div>Use expression to determine loop count<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:b").loop(header("loop")).to("mock:result"); ]]></script> -</div></div> - -<p>Use expression to determine loop count</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div>Use expression to determine loop count<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:c").loop().xpath("/hello/@times").to("mock:result"); ]]></script> -</div></div> - -<p><strong>Using the <a shape="rect" href="spring-xml-extensions.html">Spring XML Extensions</a></strong></p> - -<p>Pass loop count as an argument</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><strong>Using the <a shape="rect" href="spring-xml-extensions.html">Spring XML Extensions</a></strong><p>Pass loop count as an argument</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[ <route> <from uri="direct:a"/> @@ -14907,10 +14873,7 @@ from("direct:c").loop().xpath( </loop> </route> ]]></script> -</div></div> - -<p>Use expression to determine loop count</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div>Use expression to determine loop count<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[ <route> <from uri="direct:b"/> @@ -14920,16 +14883,7 @@ from("direct:c").loop().xpath( </loop> </route> ]]></script> -</div></div> - -<p>For further examples of this pattern in use you could look at one of the <a shape="rect" class="external-link" href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/LoopTest.java?view=markup">junit test case</a></p> - -<h4 id="BookInOnePage-Usingcopymode">Using copy mode</h4> -<p><strong>Available as of Camel 2.8</strong></p> - -<p>Now suppose we send a message to "direct:start" endpoint containing the letter A.<br clear="none"> -The output of processing this route will be that, each "mock:loop" endpoint will receive "AB" as message.</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div>For further examples of this pattern in use you could look at one of the <a shape="rect" class="external-link" href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/LoopTest.java?view=markup">junit test case</a><h4 id="BookInOnePage-Usingcopymode">Using copy mode</h4><p><strong>Available as of Camel 2.8</strong></p><p>Now suppose we send a message to "direct:start" endpoint containing the letter A.<br clear="none"> The output of processing this route will be that, each "mock:loop" endpoint will receive "AB" as message.</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") // instruct loop to use copy mode, which mean it will use a copy of the input exchange @@ -14940,10 +14894,7 @@ from("direct:start") .end() .to("mock:result"); ]]></script> -</div></div> - -<p>However if we do <strong>not</strong> enable copy mode then "mock:loop" will receive "AB", "ABB", "ABBB", etc. messages.</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div>However if we do <strong>not</strong> enable copy mode then "mock:loop" will receive "AB", "ABB", "ABBB", etc. messages.<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") // by default loop will keep using the same exchange so on the 2nd and 3rd iteration its @@ -14954,10 +14905,7 @@ from("direct:start") .end() .to("mock:result"); ]]></script> -</div></div> - -<p>The equivalent example in XML DSL in copy mode is as follows:</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div>The equivalent example in XML DSL in copy mode is as follows:<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[ <route> <from uri="direct:start"/> @@ -14972,12 +14920,30 @@ from("direct:start") <to uri="mock:result"/> </route> ]]></script> -</div></div> - +</div></div><h4 id="BookInOnePage-Usingwhilemode">Using while mode</h4><p><strong>Available as of Camel 2.17</strong></p><p>The loop can act like a while loop that loops until the expression evaluates to false or null.</p><p>For example the route below loops while the length of the message body is 5 or less characters. Notice that the DSL uses <strong>loopDoWhile</strong>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[from("direct:start") + .loopDoWhile(simple("${body.length} <= 5")) + .to("mock:loop") + .transform(body().append("A")) + .end() + .to("mock:result");]]></script> +</div></div><p>And the same example in XML:</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[ <route> + <from uri="direct:start"/> + <loop doWhile="true"> + <simple>${body.length} &lt;= 5</simple> + <to uri="mock:loop"/> + <transform> + <simple>A${body}</simple> + </transform> + </loop> + <to uri="mock:result"/> + </route> -<h4 id="BookInOnePage-UsingThisPattern.29">Using This Pattern</h4> +]]></script> +</div></div><p>Notice in XML that the while loop is turned on using the <strong>doWhile</strong> attribute.</p><p> </p><p></p><h4 id="BookInOnePage-UsingThisPattern.29">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> +<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> <h2 id="BookInOnePage-MessageTransformation.1">Message Transformation</h2> <h3 id="BookInOnePage-ContentEnricher">Content Enricher</h3><p>Camel supports the <a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/DataEnricher.html" rel="nofollow">Content Enricher</a> from the <a shape="rect" href="enterprise-integration-patterns.html">EIP patterns</a> using a <a shape="rect" href="message-translator.html">Message Translator</a>, an arbitrary <a shape="rect" href="processor.html">Processor</a> in the routing logic, or using the <a shape="rect" href="#BookInOnePage-enrich-dsl">enrich</a> DSL element to enrich the message.</p><p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image confluence-external-resource" src="http://www.enterpriseintegrationpatterns.com/img/DataEnricher.gif" data-image-src="http://www.enterpriseintegrationpatterns.com/img/DataEnricher.gif"></span></p><h4 id="BookInOnePage-ContentenrichmentusingaMessageTranslatororaProcessor">Content enrichment using a Message Translator or a Processor</h4><p><strong>Using the</strong> <strong><a shape="rect" href="fluent-builders.html">Fluent Builders</a></strong></p><p>You can use <a shape="rect" href="templating.html">Templating</a> to consume a message from one destination, transform it with something like <a shape="rect" href="velocity.html">Velocity</a> or <a shape="rect" href="xquery.html">XQuery</a>, and then send it on to another destination. For example using InOnly (one way messaging)</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> @@ -17317,11 +17283,11 @@ template.send("direct:alias-verify& ]]></script> </div></div><p></p><h3 id="BookInOnePage-SeeAlso.28">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="crypto.html">Crypto</a> Crypto is also available as a <a shape="rect" href="data-format.html">Data Format</a></li></ul> <h2 id="BookInOnePage-CXFComponent">CXF Component</h2><div class="confluence-information-macro confluence-information-macro-note"><span class="aui-icon aui-icon-small aui-iconfont-warning confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>When using CXF as a consumer, the <a shape="rect" href="cxf-bean-component.html">CXF Bean Component</a> allows you to factor out how message payloads are received from their processing as a RESTful or SOAP web service. This has the potential of using a multitude of transports to consume web services. The bean component's configuration is also simpler and provides the fastest method to implement web services using Camel and CXF.</p></div></div><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>When using CXF in streaming modes (see DataFormat option), then also read about <a shape="rect" href="stream-caching.html">Stream caching</a>.</p></div></div><p>The <strong>cxf:</strong> component provides integration with <a shape="rect" href="http://cxf.apache.org">Apache CXF</a> for connecting to JAX-WS services hosted in CXF.</p><p><style type="text/css">/*<![CDATA[*/ -div.rbtoc1457680857696 {padding: 0px;} -div.rbtoc1457680857696 ul {list-style: disc;margin-left: 0px;} -div.rbtoc1457680857696 li {margin-left: 0px;padding-left: 0px;} +div.rbtoc1457684327921 {padding: 0px;} +div.rbtoc1457684327921 ul {list-style: disc;margin-left: 0px;} +div.rbtoc1457684327921 li {margin-left: 0px;padding-left: 0px;} -/*]]>*/</style></p><div class="toc-macro rbtoc1457680857696"> +/*]]>*/</style></p><div class="toc-macro rbtoc1457684327921"> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-CXFComponent">CXF Component</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-URIformat">URI format</a></li><li><a shape="rect" href="#BookInOnePage-Options">Options</a> <ul class="toc-indentation"><li><a shape="rect" href="#BookInOnePage-Thedescriptionsofthedataformats">The descriptions of the dataformats</a> 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 Fri Mar 11 08:20:16 2016 @@ -3151,53 +3151,19 @@ from("direct:start") </div></div>Notice the <code>onPrepare</code> option is also available on other <a shape="rect" href="eip.html">EIP</a>s such as <a shape="rect" href="splitter.html">Splitter</a>, <a shape="rect" href="recipient-list.html">Recipient List</a>, and <a shape="rect" href="wire-tap.html">Wire Tap</a>.<p></p><h4 id="BookPatternAppendix-UsingThisPattern.28">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> -<h2 id="BookPatternAppendix-Loop">Loop</h2> -<p>The Loop allows for processing a message a number of times, possibly in a different way for each iteration. Useful mostly during testing.</p> - -<div class="confluence-information-macro confluence-information-macro-information"><p class="title">Default mode</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"> -<p>Notice by default the loop uses the same exchange throughout the looping. So the result from the previous iteration will be used for the next (eg <a shape="rect" href="pipes-and-filters.html">Pipes And Filters</a>). From <strong>Camel 2.8</strong> onwards you can enable copy mode instead. See the options table for more details.</p></div></div> - -<h3 id="BookPatternAppendix-Options.8">Options</h3> -<div class="confluenceTableSmall"></div> -<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Name </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Default Value </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Description </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>copy</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.8:</strong> Whether or not copy mode is used. If <code>false</code> then the same Exchange will be used for each iteration. So the result from the previous iteration will be <em>visible</em> for the next iteration. Instead you can enable copy mode, and then each iteration <em>restarts</em> with a fresh copy of the input <a shape="rect" href="exchange.html">Exchange</a>. </p></td></tr></tbody></table></div> - - -<h3 id="BookPatternAppendix-Exchangeproperties.1">Exchange properties</h3> -<p>For each iteration two properties are set on the <code>Exchange</code>. Processors can rely on these properties to process the <a shape="rect" href="message.html">Message</a> in different ways.</p> -<div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p> Property </p></th><th colspan="1" rowspan="1" class="confluenceTh"><p> Description </p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>CamelLoopSize</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Total number of loops </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>CamelLoopIndex</code> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> Index of the current iteration (0 based) </p></td></tr></tbody></table></div> - - -<h4 id="BookPatternAppendix-Examples.3">Examples</h4> - -<p>The following example shows how to take a request from the <strong>direct:x</strong> endpoint, then send the message repetitively to <strong>mock:result</strong>. The number of times the message is sent is either passed as an argument to <code>loop()</code>, or determined at runtime by evaluating an expression. The expression <strong>must</strong> evaluate to an <code>int</code>, otherwise a <code>RuntimeCamelException</code> is thrown.</p> - -<p><strong>Using the <a shape="rect" href="fluent-builders.html">Fluent Builders</a></strong></p> - -<p>Pass loop count as an argument</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<h2 id="BookPatternAppendix-Loop">Loop</h2><p>The Loop allows for processing a message a number of times, possibly in a different way for each iteration. Useful mostly during testing.</p><div class="confluence-information-macro confluence-information-macro-information"><p class="title">Default mode</p><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"></span><div class="confluence-information-macro-body"><p>Notice by default the loop uses the same exchange throughout the looping. So the result from the previous iteration will be used for the next (eg <a shape="rect" href="pipes-and-filters.html">Pipes and Filters</a>). From <strong>Camel 2.8</strong> onwards you can enable copy mode instead. See the options table for more details.</p></div></div><h3 id="BookPatternAppendix-Options.8">Options</h3><div class="confluenceTableSmall"> </div><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="conf luenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>copy</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.8:</strong> Whether or not copy mode is used. If <code>false</code> then the same Exchange will be used for each iteration. So the result from the previous iteration will be <em>visible</em> for the next iteration. Instead you can enable copy mode, and then each iteration <em>restarts</em> with a fresh copy of the input <a shape="rect" href="exchange.html">Exchange</a>.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd">doWhile</td><td colspan="1" rowspan="1" class="confluenceTd"> </td><td colspan="1" rowspan="1" class="confluenceTd"><strong>Camel 2.17:</strong> En ables the while loop that loops until the predicate evaluates to false or null.</td></tr></tbody></table></div><h3 id="BookPatternAppendix-Exchangeproperties.1">Exchange properties</h3><p>For each iteration two properties are set on the <code>Exchange</code>. Processors can rely on these properties to process the <a shape="rect" href="message.html">Message</a> in different ways.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Property</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelLoopSize</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Total number of loops. This is not available if running the loop in while loop mode.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelLoopIndex</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Index of the cu rrent iteration (0 based)</p></td></tr></tbody></table></div><h4 id="BookPatternAppendix-Examples.3">Examples</h4><p>The following example shows how to take a request from the <strong>direct:x</strong> endpoint, then send the message repetitively to <strong>mock:result</strong>. The number of times the message is sent is either passed as an argument to <code>loop()</code>, or determined at runtime by evaluating an expression. The expression <strong>must</strong> evaluate to an <code>int</code>, otherwise a <code>RuntimeCamelException</code> is thrown.</p><p><strong>Using the <a shape="rect" href="fluent-builders.html">Fluent Builders</a></strong></p><p>Pass loop count as an argument</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:a").loop(8).to("mock:result"); ]]></script> -</div></div> - -<p>Use expression to determine loop count</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div>Use expression to determine loop count<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:b").loop(header("loop")).to("mock:result"); ]]></script> -</div></div> - -<p>Use expression to determine loop count</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div>Use expression to determine loop count<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:c").loop().xpath("/hello/@times").to("mock:result"); ]]></script> -</div></div> - -<p><strong>Using the <a shape="rect" href="spring-xml-extensions.html">Spring XML Extensions</a></strong></p> - -<p>Pass loop count as an argument</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><strong>Using the <a shape="rect" href="spring-xml-extensions.html">Spring XML Extensions</a></strong><p>Pass loop count as an argument</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[ <route> <from uri="direct:a"/> @@ -3207,10 +3173,7 @@ from("direct:c").loop().xpath( </loop> </route> ]]></script> -</div></div> - -<p>Use expression to determine loop count</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div>Use expression to determine loop count<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[ <route> <from uri="direct:b"/> @@ -3220,16 +3183,7 @@ from("direct:c").loop().xpath( </loop> </route> ]]></script> -</div></div> - -<p>For further examples of this pattern in use you could look at one of the <a shape="rect" class="external-link" href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/LoopTest.java?view=markup">junit test case</a></p> - -<h4 id="BookPatternAppendix-Usingcopymode">Using copy mode</h4> -<p><strong>Available as of Camel 2.8</strong></p> - -<p>Now suppose we send a message to "direct:start" endpoint containing the letter A.<br clear="none"> -The output of processing this route will be that, each "mock:loop" endpoint will receive "AB" as message.</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div>For further examples of this pattern in use you could look at one of the <a shape="rect" class="external-link" href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/LoopTest.java?view=markup">junit test case</a><h4 id="BookPatternAppendix-Usingcopymode">Using copy mode</h4><p><strong>Available as of Camel 2.8</strong></p><p>Now suppose we send a message to "direct:start" endpoint containing the letter A.<br clear="none"> The output of processing this route will be that, each "mock:loop" endpoint will receive "AB" as message.</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") // instruct loop to use copy mode, which mean it will use a copy of the input exchange @@ -3240,10 +3194,7 @@ from("direct:start") .end() .to("mock:result"); ]]></script> -</div></div> - -<p>However if we do <strong>not</strong> enable copy mode then "mock:loop" will receive "AB", "ABB", "ABBB", etc. messages.</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div>However if we do <strong>not</strong> enable copy mode then "mock:loop" will receive "AB", "ABB", "ABBB", etc. messages.<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") // by default loop will keep using the same exchange so on the 2nd and 3rd iteration its @@ -3254,10 +3205,7 @@ from("direct:start") .end() .to("mock:result"); ]]></script> -</div></div> - -<p>The equivalent example in XML DSL in copy mode is as follows:</p> -<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div>The equivalent example in XML DSL in copy mode is as follows:<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[ <route> <from uri="direct:start"/> @@ -3272,12 +3220,30 @@ from("direct:start") <to uri="mock:result"/> </route> ]]></script> -</div></div> - +</div></div><h4 id="BookPatternAppendix-Usingwhilemode">Using while mode</h4><p><strong>Available as of Camel 2.17</strong></p><p>The loop can act like a while loop that loops until the expression evaluates to false or null.</p><p>For example the route below loops while the length of the message body is 5 or less characters. Notice that the DSL uses <strong>loopDoWhile</strong>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[from("direct:start") + .loopDoWhile(simple("${body.length} <= 5")) + .to("mock:loop") + .transform(body().append("A")) + .end() + .to("mock:result");]]></script> +</div></div><p>And the same example in XML:</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[ <route> + <from uri="direct:start"/> + <loop doWhile="true"> + <simple>${body.length} &lt;= 5</simple> + <to uri="mock:loop"/> + <transform> + <simple>A${body}</simple> + </transform> + </loop> + <to uri="mock:result"/> + </route> -<h4 id="BookPatternAppendix-UsingThisPattern.29">Using This Pattern</h4> +]]></script> +</div></div><p>Notice in XML that the while loop is turned on using the <strong>doWhile</strong> attribute.</p><p> </p><p></p><h4 id="BookPatternAppendix-UsingThisPattern.29">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> +<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> <h2 id="BookPatternAppendix-MessageTransformation">Message Transformation</h2> <h3 id="BookPatternAppendix-ContentEnricher">Content Enricher</h3><p>Camel supports the <a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/DataEnricher.html" rel="nofollow">Content Enricher</a> from the <a shape="rect" href="enterprise-integration-patterns.html">EIP patterns</a> using a <a shape="rect" href="message-translator.html">Message Translator</a>, an arbitrary <a shape="rect" href="processor.html">Processor</a> in the routing logic, or using the <a shape="rect" href="#BookPatternAppendix-enrich-dsl">enrich</a> DSL element to enrich the message.</p><p><span class="confluence-embedded-file-wrapper"><img class="confluence-embedded-image confluence-external-resource" src="http://www.enterpriseintegrationpatterns.com/img/DataEnricher.gif" data-image-src="http://www.enterpriseintegrationpatterns.com/img/DataEnricher.gif"></span></p><h4 id="BookPatternAppendix-ContentenrichmentusingaMessageTranslatororaProcessor">Content enrichment using a Mes sage Translator or a Processor</h4><p><strong>Using the</strong> <strong><a shape="rect" href="fluent-builders.html">Fluent Builders</a></strong></p><p>You can use <a shape="rect" href="templating.html">Templating</a> to consume a message from one destination, transform it with something like <a shape="rect" href="velocity.html">Velocity</a> or <a shape="rect" href="xquery.html">XQuery</a>, and then send it on to another destination. For example using InOnly (one way messaging)</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available.