Author: buildbot Date: Tue Jun 17 05:17:49 2014 New Revision: 912812 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/cache/main.pageCache websites/production/camel/content/splitter.html Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available. Modified: websites/production/camel/content/splitter.html ============================================================================== --- websites/production/camel/content/splitter.html (original) +++ websites/production/camel/content/splitter.html Tue Jun 17 05:17:49 2014 @@ -115,7 +115,21 @@ RouteBuilder builder = new RouteBuilder( </route> </camelContext> ]]></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/SplitterTest.java?view=markup">junit test case</a></p><h3 id="Splitter-UsingTokenizerfrom*">Using Tokenizer from <a shape="rect" href="spring-xml-extensions.html">Spring XML Extensions</a>*</h3><p>You can use the tokenizer expression in the Spring DSL to split bodies or headers using a token. This is a common use-case, so we provided a special <strong>tokenizer</strong> tag for this.<br clear="none"> In the sample below we split the body using a @ as separator. You can of course use comma or space or even a regex pattern, also set regex=true.</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 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/SplitterTest.java?view=markup">junit test case</a></p><h3 id="Splitter-SplittingaCollection,IteratororArray">Splitting a Collection, Iterator or Array</h3><p>A common use case is to split a Collection, Iterator or Array from the <span class="confluence-link">message</span>. In the sample below we simply use an <a shape="rect" href="expression.html">Expression</a> to identify the value to split.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[from("direct:splitUsingBody").split(body()).to("mock:result"); + +from("direct:splitUsingHeader").split(header("foo")).to("mock:result");Â ]]></script> +</div></div><p>In Spring XML you can use the <a shape="rect" href="simple.html">Simple</a> language to identify the value to split.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<split> + <simple>${body}</simple> + <to uri="mock:result"/> +</split> + +<split> + <simple>${header.foo}</simple> + <to uri="mock:result"/> +</split> Â ]]></script> +</div></div><h3 id="Splitter-UsingTokenizerfrom*">Using Tokenizer from <a shape="rect" href="spring-xml-extensions.html">Spring XML Extensions</a>*</h3><p>You can use the tokenizer expression in the Spring DSL to split bodies or headers using a token. This is a common use-case, so we provided a special <strong>tokenizer</strong> tag for this.<br clear="none"> In the sample below we split the body using a @ as separator. You can of course use comma or space or even a regex pattern, also set regex=true.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[ <camelContext xmlns="http://camel.apache.org/schema/spring"> <route> @@ -127,12 +141,6 @@ RouteBuilder builder = new RouteBuilder( </route> </camelContext> ]]></script> -</div></div><p>Splitting the body in Spring XML is a bit harder as you need to use the <a shape="rect" href="simple.html">Simple</a> language to dictate this</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> -<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<split> - <simple>${body}</simple> - <to uri="mock:result"/> -</split> -]]></script> </div></div><h3 id="Splitter-WhattheSplitterreturns">What the Splitter returns</h3><p><strong>Camel 2.2 or older:</strong><br clear="none"> The <a shape="rect" href="splitter.html">Splitter</a> will by default return the <strong>last</strong> splitted message.</p><p><strong>Camel 2.3 and newer</strong><br clear="none"> The <a shape="rect" href="splitter.html">Splitter</a> will by default return the original input message.</p><p><strong>For all versions</strong><br clear="none"> You can override this by suppling your own strategy as an <code>AggregationStrategy</code>. There is a sample on this page (Split aggregate request/reply sample). Notice its the same strategy as the <a shape="rect" href="aggregator.html">Aggregator</a> supports. This <a shape="rect" href="splitter.html">Splitter</a> can be viewed as having a build in light weight <a shape="rect" href="aggregator.html">Aggregator</a>.</p><h3 id="Splitter-Parallelexecutionofdistinct'parts'">Parallel execution of distinct 'parts '</h3><p>If you want to execute all parts in parallel you can use special notation of <code>split()</code> with two arguments, where the second one is a <strong>boolean</strong> flag if processing should be parallel. e.g.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[XPathBuilder xPathBuilder = new XPathBuilder("//foo/bar"); from("activemq:my.queue").split(xPathBuilder, true).to("activemq:my.parts");