camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r914990 [2/2] - in /websites/production/camel/content: cache/main.pageCache camel-2140-release.html multicast.html recipient-list.html splitter.html
Date Fri, 04 Jul 2014 12:17:56 GMT
Modified: websites/production/camel/content/splitter.html
==============================================================================
--- websites/production/camel/content/splitter.html (original)
+++ websites/production/camel/content/splitter.html Fri Jul  4 12:17:56 2014
@@ -87,7 +87,7 @@
         <tr>
         <td valign="top" width="100%">
 <div class="wiki-content maincontent"><h3 id="Splitter-Splitter">Splitter</h3><p>The
<a shape="rect" class="external-link" href="http://www.enterpriseintegrationpatterns.com/Sequencer.html"
rel="nofollow">Splitter</a> from the <a shape="rect" href="enterprise-integration-patterns.html">EIP
patterns</a> allows you split a message into a number of pieces and process them individually</p><p><img
class="confluence-embedded-image confluence-external-resource" src="http://www.enterpriseintegrationpatterns.com/img/Sequencer.gif"
data-image-src="http://www.enterpriseintegrationpatterns.com/img/Sequencer.gif"></p><p>You
need to specify a Splitter as <code>split()</code>. In earlier versions of Camel,
you need to use <code>splitter()</code>.</p><h3 id="Splitter-Options">Options</h3><div
class="confluenceTableSmall">
-<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>strategyRef</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> Refers to an <a shape="rect"
class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/aggregate/AggregationStrategy.html">AggregationStrategy</a>
to be used to assemble the replies from the sub-messages, into a single outgoing message from
the <a shape="rect" href="splitter.html" title="Splitter">Splitter</a>. See the
defaults described below in <em><a shape="rect" href="#Splitter-WhattheSplitterreturns">What
the Splitter returns</a></em>. From <strong>Camel 2.12
 </strong> onwards you can also use a POJO as the <code>AggregationStrategy</code>,
see the <a shape="rect" href="aggregator2.html" title="Aggregator2">Aggregate</a>
page for more details. </p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p> <code>strategyMethodName</code> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.12:</strong>
This option can be used to explicit declare the method name to use, when using POJOs as the
<code>AggregationStrategy</code>. See the <a shape="rect" href="aggregator2.html"
title="Aggregator2">Aggregate</a> page for more details. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>strategyMethodAllowNull</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>false</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel
2.12:</strong> If this option is <code>false</code> 
 then the aggregate method is not used for the very first splitted message. If this option
is <code>true</code> then <code>null</code> values is used as the
<code>oldExchange</code> (for the very first message splitted), when using POJOs
as the <code>AggregationStrategy</code>. See the <a shape="rect" href="aggregator2.html"
title="Aggregator2">Aggregate</a> page for more details. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>parallelProcessing</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>false</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> If enabled
then processing the sub-messages occurs concurrently. Note the caller thread will still wait
until all sub-messages has been fully processed, before it continues. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>executorServiceRef</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td
colspan="1"
  rowspan="1" class="confluenceTd"><p> Refers to a custom <a shape="rect" href="threading-model.html"
title="Threading Model">Thread Pool</a> to be used for parallel processing. Notice
if you set this option, then parallel processing is automatically implied, and you do not
have to enable that option as well. </p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p> <code>stopOnException</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.2:</strong>
Whether or not to stop continue processing immediately when an exception occurred. If disable,
then Camel continue splitting and process the sub-messages regardless if one of them failed.
You can deal with exceptions in the <a shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/aggregate/AggregationStrategy.html">AggregationStrategy</a>
clas
 s where you have full control how to handle that. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>streaming</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>false</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> If enabled
then Camel will split in a streaming fashion, which means it will split the input message
in chunks. This reduces the memory overhead. For example if you split big messages its recommended
to enable streaming. If streaming is enabled then the sub-message replies will be aggregated
out-of-order, eg in the order they come back. If disabled, Camel will process sub-message
replies in the same order as they where splitted. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>timeout</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.5:</strong>
Sets a total timeout specifi
 ed in millis. If the <a shape="rect" href="recipient-list.html" title="Recipient List">Recipient
List</a> hasn't been able to split and process all replies within the given timeframe,
then the timeout triggers and the <a shape="rect" href="splitter.html" title="Splitter">Splitter</a>
breaks out and continues. Notice if you provide a <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/aggregate/TimeoutAwareAggregationStrategy.html">TimeoutAwareAggregationStrategy</a>
then the <code>timeout</code> method is invoked before breaking out. If the timeout
is reached with running tasks still remaining, certain tasks for which it is difficult for
Camel to shut down in a graceful manner may continue to run.  So use this option with a bit
of care.  We may be able to improve this functionality in future Camel releases. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>onPrepareRef</code>
</p><
 /td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.8:</strong>
Refers to a custom <a shape="rect" href="processor.html" title="Processor">Processor</a>
to prepare the sub-message of the <a shape="rect" href="exchange.html" title="Exchange">Exchange</a>,
before its processed. This allows you to do any custom logic, such as deep-cloning the message
payload if that's needed etc. </p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p> <code>shareUnitOfWork</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 the unit of work should be shared. See further below for more details. </p></td></tr></tbody></table>
+<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>strategyRef</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> Refers to an <a shape="rect"
class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/aggregate/AggregationStrategy.html">AggregationStrategy</a>
to be used to assemble the replies from the sub-messages, into a single outgoing message from
the <a shape="rect" href="splitter.html" title="Splitter">Splitter</a>. See the
defaults described below in <em><a shape="rect" href="#Splitter-WhattheSplitterreturns">What
the Splitter returns</a></em>. From <strong>Camel 2.12
 </strong> onwards you can also use a POJO as the <code>AggregationStrategy</code>,
see the <a shape="rect" href="aggregator2.html" title="Aggregator2">Aggregate</a>
page for more details. </p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p> <code>strategyMethodName</code> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.12:</strong>
This option can be used to explicit declare the method name to use, when using POJOs as the
<code>AggregationStrategy</code>. See the <a shape="rect" href="aggregator2.html"
title="Aggregator2">Aggregate</a> page for more details. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>strategyMethodAllowNull</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>false</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel
2.12:</strong> If this option is <code>false</code> 
 then the aggregate method is not used for the very first splitted message. If this option
is <code>true</code> then <code>null</code> values is used as the
<code>oldExchange</code> (for the very first message splitted), when using POJOs
as the <code>AggregationStrategy</code>. See the <a shape="rect" href="aggregator2.html"
title="Aggregator2">Aggregate</a> page for more details. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>parallelProcessing</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> <code>false</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> If enabled
then processing the sub-messages occurs concurrently. Note the caller thread will still wait
until all sub-messages has been fully processed, before it continues. </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>parallelAggregate</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.14:</strong>
If enabled then the <code>aggregate</code> method on <code>AggregationStrategy</code>
can be called concurrently. Notice that this would require the implementation of <code>AggregationStrategy</code>
to be implemented as thread-safe. By default this is <code>false</code> meaning
that Camel synchronizes the call to the <code>aggregate</code> method. Though
in some use-cases this can be used to archive higher performance when the <code>AggregationStrategy</code>
is implemented as thread-safe. </p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p> <code>executorServiceRef</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> Refers to a custom <a shape="rect"
href="threading-model.html" title="Threading Model">Thread Pool</a> to be used for
para
 llel processing. Notice if you set this option, then parallel processing is automatically
implied, and you do not have to enable that option as well. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>stopOnException</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.2:</strong> Whether or not to stop continue processing immediately when an exception
occurred. If disable, then Camel continue splitting and process the sub-messages regardless
if one of them failed. You can deal with exceptions in the <a shape="rect" class="external-link"
href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/aggregate/AggregationStrategy.html">AggregationStrategy</a>
class where you have full control how to handle that. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>streaming</code>
</p></td><td col
 span="1" rowspan="1" class="confluenceTd"><p> <code>false</code> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> If enabled then Camel will split
in a streaming fashion, which means it will split the input message in chunks. This reduces
the memory overhead. For example if you split big messages its recommended to enable streaming.
If streaming is enabled then the sub-message replies will be aggregated out-of-order, eg in
the order they come back. If disabled, Camel will process sub-message replies in the same
order as they where splitted. </p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p> <code>timeout</code> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.5:</strong>
Sets a total timeout specified in millis. If the <a shape="rect" href="recipient-list.html"
title="Recipient List">Recipient List</a> hasn't been able to split and process all
replies with
 in the given timeframe, then the timeout triggers and the <a shape="rect" href="splitter.html"
title="Splitter">Splitter</a> breaks out and continues. Notice if you provide a <a
shape="rect" class="external-link" href="http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/processor/aggregate/TimeoutAwareAggregationStrategy.html">TimeoutAwareAggregationStrategy</a>
then the <code>timeout</code> method is invoked before breaking out. If the timeout
is reached with running tasks still remaining, certain tasks for which it is difficult for
Camel to shut down in a graceful manner may continue to run.  So use this option with a bit
of care.  We may be able to improve this functionality in future Camel releases. </p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p> <code>onPrepareRef</code>
</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> <strong>Camel 2.8:</strong>
Refers t
 o a custom <a shape="rect" href="processor.html" title="Processor">Processor</a>
to prepare the sub-message of the <a shape="rect" href="exchange.html" title="Exchange">Exchange</a>,
before its processed. This allows you to do any custom logic, such as deep-cloning the message
payload if that's needed etc. </p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p> <code>shareUnitOfWork</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 the unit of work should be shared. See further below for more details. </p></td></tr></tbody></table>
 </div><h3 id="Splitter-Exchangeproperties">Exchange properties</h3><p>The
following properties are set on each Exchange that are split:</p><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>property</p></th><th
colspan="1" rowspan="1" class="confluenceTh"><p>type</p></th><th colspan="1"
rowspan="1" class="confluenceTh"><p>description</p></th></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelSplitIndex</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>int</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>A split counter that increases for each Exchange
being split. The counter starts from 0.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>CamelSplitSize</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>int</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>The total number of Exchanges that was splitted.
This header i
 s not applied for stream based splitting. From <strong>Camel 2.9</strong> onwards
this header is also set in stream based splitting, but only on the completed Exchange.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p><code>CamelSplitComplete</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>boolean</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.4:</strong>
Whether or not this Exchange is the last.</p></td></tr></tbody></table></div><h3
id="Splitter-Examples">Examples</h3><p>The following example shows how to take
a request from the <strong>queue:a</strong> endpoint the split it into pieces
using an <a shape="rect" href="expression.html">Expression</a>, then forward each
piece to <strong>queue:b</strong></p><p><strong>Using the <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">
 <script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[
 RouteBuilder builder = new RouteBuilder() {



Mime
View raw message