Author: buildbot
Date: Wed Mar 4 06:19:07 2015
New Revision: 942221
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/aggregator2.html
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-2150-release.html
Modified: websites/production/camel/content/aggregator2.html
==============================================================================
--- websites/production/camel/content/aggregator2.html (original)
+++ websites/production/camel/content/aggregator2.html Wed Mar 4 06:19:07 2015
@@ -86,7 +86,7 @@
<tbody>
<tr>
<td valign="top" width="100%">
-<div class="wiki-content maincontent"><h3
id="Aggregator2-Aggregator">Aggregator</h3><p><strong>This applies for Camel
version 2.3 or newer. If you use an older version then use this <a shape="rect"
href="aggregator.html">Aggregator</a> link instead.</strong></p><p>The <a
shape="rect" class="external-link"
href="http://www.enterpriseintegrationpatterns.com/Aggregator.html"
rel="nofollow">Aggregator</a> from the <a shape="rect"
href="enterprise-integration-patterns.html">EIP patterns</a> allows you to
combine a number of messages together into a single message.</p><p><img
class="confluence-embedded-image confluence-external-resource"
src="http://www.enterpriseintegrationpatterns.com/img/Aggregator.gif"
data-image-src="http://www.enterpriseintegrationpatterns.com/img/Aggregator.gif"></p><p>A
correlation <a shape="rect" href="expression.html">Expression</a> is used to
determine the messages which should be aggregated together. If you want to
aggregate all messages into a single message
, just use a constant expression. An AggregationStrategy is used to combine
all the message exchanges for a single correlation key into a single message
exchange.</p><h3 id="Aggregator2-Aggregatoroptions">Aggregator
options</h3><p>The aggregator 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>correlationExpression</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Mandatory <a shape="rect"
href="expression.html">Expression</a> which evaluates the correlation key to
use for aggregation. The <a shape="rect" href="exchange.html">Exchange</a>
which has the same co
rrelation key is aggregated together. If the correlation key could not be
evaluated an Exception is thrown. You can disable this by using the
<code>ignoreBadCorrelationKeys</code> option.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>aggregationStrategy</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Mandatory <code>AggregationStrategy</code> which is
used to <em>merge</em> the incoming <a shape="rect"
href="exchange.html">Exchange</a> with the existing already merged exchanges.
At first call the <code>oldExchange</code> parameter is <code>null</code>. On
subsequent invocations the <code>oldExchange</code> contains the merged
exchanges and <code>newExchange</code> is of course the new incoming Exchange.
From <strong>Camel 2.9.2</strong> onwards the strategy can also be a
<code>TimeoutAwareAggregationStrategy</code> implementation, supporting the
timeout callback, see further below f
or more details.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>strategyRef</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>A reference to lookup the
<code>AggregationStrategy</code> in the <a shape="rect"
href="registry.html">Registry</a>. From <strong>Camel 2.12</strong> onwards you
can also use a POJO as the <code>AggregationStrategy</code>, see further below
for details.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>strategyMethodName</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </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 further below for more
details.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>strategyMethodAllowNull</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 aggregation. If this option is <code>true</code> then
<code>null</code> values is used as the <code>oldExchange</code> (at the very
first aggregation), when using POJOs as the <code>AggregationStrategy</code>.
See further below for more details.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>completionSize</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Number of messages aggregated before the aggregation is
complete. This option can be set as either a fixed value or using an <a
shape="rect" href="expression.html">Expression</a> which allows you to evaluate
a size dynamically - will use <code>Integer</code> as result. If both are set
Camel will
fallback to use the fixed value if the <a shape="rect"
href="expression.html">Expression</a> result was <code>null</code> or
<code>0</code>.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>completionTimeout</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Time in millis that an aggregated exchange should be
inactive before its complete. This option can be set as either a fixed value or
using an <a shape="rect" href="expression.html">Expression</a> which allows you
to evaluate a timeout dynamically - will use <code>Long</code> as result. If
both are set Camel will fallback to use the fixed value if the <a shape="rect"
href="expression.html">Expression</a> result was <code>null</code> or
<code>0</code>. You cannot use this option together with completionInterval,
only one of the two can be used.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>completionInterval</p></
td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>A repeating period in millis by
which the aggregator will complete all current aggregated exchanges. Camel has
a background task which is triggered every period. You cannot use this option
together with completionTimeout, only one of them can be
used.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>completionPredicate</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>A <a shape="rect" href="predicate.html">Predicate</a>
to indicate when an aggregated exchange is complete. Starting in <strong>Camel
2.15</strong>, if this is not specified and the AggregationStrategy object
implements Predicate, the aggregationStrategy object will be used as the
completionPredicate.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>completionFromBatchConsumer</p></td>
<td colspan="1" rowspan="1"
class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>This option is if the exchanges are coming from a <a
shape="rect" href="batch-consumer.html">Batch Consumer</a>. Then when enabled
the <a shape="rect" href="aggregator2.html">Aggregator2</a> will use the batch
size determined by the <a shape="rect" href="batch-consumer.html">Batch
Consumer</a> in the message header <code>CamelBatchSize</code>. See more
details at <a shape="rect" href="batch-consumer.html">Batch Consumer</a>. This
can be used to aggregate all files consumed from a <a shape="rect"
href="file2.html">File</a> endpoint in that given poll.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>forceCompletionOnStop</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> Indicates to
complete all current aggregated exchang
es when the context is stopped</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>eagerCheckCompletion</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Whether or not to eager check for
completion when a new incoming <a shape="rect"
href="exchange.html">Exchange</a> has been received. This option influences the
behavior of the <code>completionPredicate</code> option as the <a shape="rect"
href="exchange.html">Exchange</a> being passed in changes accordingly. When
<code>false</code> the <a shape="rect" href="exchange.html">Exchange</a> passed
in the <a shape="rect" href="predicate.html">Predicate</a> is the
<em>aggregated</em> Exchange which means any information you may store on the
aggregated Exchange from the <code>AggregationStrategy</code> is available for
the <a shape="rect" href="predicate.html">Predicate</a>. When <code>true</code>
the <a shape="rect" href="exchange.htm
l">Exchange</a> passed in the <a shape="rect"
href="predicate.html">Predicate</a> is the <em>incoming</em> <a shape="rect"
href="exchange.html">Exchange</a>, which means you can access data from the
incoming Exchange.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>groupExchanges</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 group all aggregated
Exchanges into a single combined
<code>org.apache.camel.impl.GroupedExchange</code> holder class that holds all
the aggregated Exchanges. And as a result only one Exchange is being sent out
from the aggregator. Can be used to combine many incoming Exchanges into a
single output Exchange without coding a custom <code>AggregationStrategy</code>
yourself. <strong>Important:</strong> This option does <strong>not</strong>
support persistent repository with the aggregator. See further below for an
example and
more details.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>ignoreInvalidCorrelationKeys</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Whether or not to ignore correlation keys
which could not be evaluated to a value. By default Camel will throw an
Exception, but you can enable this option and ignore the situation
instead.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>closeCorrelationKeyOnCompletion</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Whether or not too <em>late</em> Exchanges should be
accepted or not. You can enable this to indicate that if a correlation key has
already been completed, then any new exchanges with the same correlation key be
denied. Camel will then throw a <code>closedCorrelationKeyException</code>
exception. When using this option you pa
ss in a <code>integer</code> which is a number for a LRUCache which keeps that
last X number of closed correlation keys. You can pass in 0 or a negative value
to indicate a unbounded cache. By passing in a number you are ensured that
cache won't grow too big if you use a log of different correlation
keys.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>discardOnCompletionTimeout</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.5:</strong> Whether or not
exchanges which complete due to a timeout should be discarded. If enabled then
when a timeout occurs the aggregated message will <strong>not</strong> be sent
out but dropped (discarded).</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>aggregationRepository</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Allows
you to plugin you own implementation of
<code>org.apache.camel.spi.AggregationRepository</code> which keeps track of
the current inflight aggregated exchanges. Camel uses by default a memory based
implementation.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>aggregationRepositoryRef</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Reference to lookup a
<code>aggregationRepository</code> in the <a shape="rect"
href="registry.html">Registry</a>.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>parallelProcessing</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>When aggregated are completed they are being send out
of the aggregator. This option indicates whether or not Camel should use a
thread pool with multiple threads for concurrency. If no custom thread pool has
been specifi
ed then Camel creates a default pool with 10 concurrent
threads.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>executorService</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>If using <code>parallelProcessing</code> you can
specify a custom thread pool to be used. In fact also if you are not using
<code>parallelProcessing</code> this custom thread pool is used to send out
aggregated exchanges as well.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>executorServiceRef</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Reference to lookup a <code>executorService</code> in
the <a shape="rect" href="registry.html">Registry</a></p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>timeoutCheckerExecutorService</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </
p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel
2.9:</strong> If using either of the <code>completionTimeout</code>,
<code>completionTimeoutExpression</code>, or <code>completionInterval</code>
options a background thread is created to check for the completion for every
aggregator. Set this option to provide a custom thread pool to be used rather
than creating a new thread for every aggregator.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>timeoutCheckerExecutorServiceRef</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> Reference to
lookup a <code>timeoutCheckerExecutorService</code> in the <a shape="rect"
href="registry.html">Registry</a></p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>optimisticLocking</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowsp
an="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> Turns on using
optimistic locking, which requires the <code>aggregationRepository</code> being
used, is supporting this by implementing the
<code>org.apache.camel.spi.OptimisticLockingAggregationRepository</code>
interface.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>optimisticLockRetryPolicy</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><strong>Camel 2.11.1:</strong> Allows to configure
retry settings when using optimistic
locking.</p></td></tr></tbody></table></div></div><h3
id="Aggregator2-ExchangeProperties">Exchange Properties</h3><p>The following
properties are set on each aggregated Exchange:</p><div
class="confluenceTableSmall"><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>header</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>ty
pe</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>description</p></th></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>CamelAggregatedSize</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 aggregated
into this combined Exchange.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>CamelAggregatedCompletedBy</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Indicator how the aggregation was completed
as a value of either: <code>predicate</code>, <code>size</code>,
<code>consumer</code>, <code>timeout</code>, <code>forceCompletion</code> or
<code>interval</code>.</p></td></tr></tbody></table></div></div><h3
id="Aggregator2-AboutAggregationStrategy">About AggregationStrategy</h3><p>The
<code>AggregationStrategy</code> is used for aggregating
the old (lookup by its correlation id) and the new exchanges together into a
single exchange. Possible implementations include performing some kind of
combining or delta processing, such as adding line items together into an
invoice or just using the newest exchange and removing old exchanges such as
for state tracking or market data prices; where old values are of little
use.</p><p>Notice the aggregation strategy is a mandatory option and must be
provided to the aggregator.</p><p>Here are a few example AggregationStrategy
implementations that should help you create your own custom strategy.</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+<div class="wiki-content maincontent"><h3
id="Aggregator2-Aggregator">Aggregator</h3><p><strong>This applies for Camel
version 2.3 or newer. If you use an older version then use this <a shape="rect"
href="aggregator.html">Aggregator</a> link instead.</strong></p><p>The <a
shape="rect" class="external-link"
href="http://www.enterpriseintegrationpatterns.com/Aggregator.html"
rel="nofollow">Aggregator</a> from the <a shape="rect"
href="enterprise-integration-patterns.html">EIP patterns</a> allows you to
combine a number of messages together into a single message.</p><p><img
class="confluence-embedded-image confluence-external-resource"
src="http://www.enterpriseintegrationpatterns.com/img/Aggregator.gif"
data-image-src="http://www.enterpriseintegrationpatterns.com/img/Aggregator.gif"></p><p>A
correlation <a shape="rect" href="expression.html">Expression</a> is used to
determine the messages which should be aggregated together. If you want to
aggregate all messages into a single message
, just use a constant expression. An AggregationStrategy is used to combine
all the message exchanges for a single correlation key into a single message
exchange.</p><h3 id="Aggregator2-Aggregatoroptions">Aggregator
options</h3><p>The aggregator 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>correlationExpression</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Mandatory <a shape="rect"
href="expression.html">Expression</a> which evaluates the correlation key to
use for aggregation. The <a shape="rect" href="exchange.html">Exchange</a>
which has the same co
rrelation key is aggregated together. If the correlation key could not be
evaluated an Exception is thrown. You can disable this by using the
<code>ignoreBadCorrelationKeys</code> option.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>aggregationStrategy</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Mandatory <code>AggregationStrategy</code> which is
used to <em>merge</em> the incoming <a shape="rect"
href="exchange.html">Exchange</a> with the existing already merged exchanges.
At first call the <code>oldExchange</code> parameter is <code>null</code>. On
subsequent invocations the <code>oldExchange</code> contains the merged
exchanges and <code>newExchange</code> is of course the new incoming Exchange.
From <strong>Camel 2.9.2</strong> onwards the strategy can also be a
<code>TimeoutAwareAggregationStrategy</code> implementation, supporting the
timeout callback, see further below f
or more details.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>strategyRef</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>A reference to lookup the
<code>AggregationStrategy</code> in the <a shape="rect"
href="registry.html">Registry</a>. From <strong>Camel 2.12</strong> onwards you
can also use a POJO as the <code>AggregationStrategy</code>, see further below
for details.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>strategyMethodName</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </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 further below for more
details.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>strategyMethodAllowNull</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 aggregation. If this option is <code>true</code> then
<code>null</code> values is used as the <code>oldExchange</code> (at the very
first aggregation), when using POJOs as the <code>AggregationStrategy</code>.
See further below for more details.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>completionSize</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Number of messages aggregated before the aggregation is
complete. This option can be set as either a fixed value or using an <a
shape="rect" href="expression.html">Expression</a> which allows you to evaluate
a size dynamically - will use <code>Integer</code> as result. If both are set
Camel will
fallback to use the fixed value if the <a shape="rect"
href="expression.html">Expression</a> result was <code>null</code> or
<code>0</code>.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>completionTimeout</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Time in millis that an aggregated exchange should be
inactive before its complete. This option can be set as either a fixed value or
using an <a shape="rect" href="expression.html">Expression</a> which allows you
to evaluate a timeout dynamically - will use <code>Long</code> as result. If
both are set Camel will fallback to use the fixed value if the <a shape="rect"
href="expression.html">Expression</a> result was <code>null</code> or
<code>0</code>. You cannot use this option together with completionInterval,
only one of the two can be used.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>completionInterval</p></
td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>A repeating period in millis by
which the aggregator will complete all current aggregated exchanges. Camel has
a background task which is triggered every period. You cannot use this option
together with completionTimeout, only one of them can be
used.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>completionPredicate</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>A <a shape="rect" href="predicate.html">Predicate</a>
to indicate when an aggregated exchange is complete. Starting in <strong>Camel
2.15</strong>, if this is not specified and the AggregationStrategy object
implements Predicate, the aggregationStrategy object will be used as the
completionPredicate.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>completionFromBatchConsumer</p></td>
<td colspan="1" rowspan="1"
class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>This option is if the exchanges are coming from a <a
shape="rect" href="batch-consumer.html">Batch Consumer</a>. Then when enabled
the <a shape="rect" href="aggregator2.html">Aggregator2</a> will use the batch
size determined by the <a shape="rect" href="batch-consumer.html">Batch
Consumer</a> in the message header <code>CamelBatchSize</code>. See more
details at <a shape="rect" href="batch-consumer.html">Batch Consumer</a>. This
can be used to aggregate all files consumed from a <a shape="rect"
href="file2.html">File</a> endpoint in that given poll.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>forceCompletionOnStop</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> Indicates to
complete all current aggregated exchang
es when the context is stopped</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>eagerCheckCompletion</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Whether or not to eager check for
completion when a new incoming <a shape="rect"
href="exchange.html">Exchange</a> has been received. This option influences the
behavior of the <code>completionPredicate</code> option as the <a shape="rect"
href="exchange.html">Exchange</a> being passed in changes accordingly. When
<code>false</code> the <a shape="rect" href="exchange.html">Exchange</a> passed
in the <a shape="rect" href="predicate.html">Predicate</a> is the
<em>aggregated</em> Exchange which means any information you may store on the
aggregated Exchange from the <code>AggregationStrategy</code> is available for
the <a shape="rect" href="predicate.html">Predicate</a>. When <code>true</code>
the <a shape="rect" href="exchange.htm
l">Exchange</a> passed in the <a shape="rect"
href="predicate.html">Predicate</a> is the <em>incoming</em> <a shape="rect"
href="exchange.html">Exchange</a>, which means you can access data from the
incoming Exchange.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>groupExchanges</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 group all aggregated
Exchanges into a single combined
<code>org.apache.camel.impl.GroupedExchange</code> holder class that holds all
the aggregated Exchanges. And as a result only one Exchange is being sent out
from the aggregator. Can be used to combine many incoming Exchanges into a
single output Exchange without coding a custom <code>AggregationStrategy</code>
yourself. <strong>Important:</strong> This option does <strong>not</strong>
support persistent repository with the aggregator. See further below for an
example and
more details.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>ignoreInvalidCorrelationKeys</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Whether or not to ignore correlation keys
which could not be evaluated to a value. By default Camel will throw an
Exception, but you can enable this option and ignore the situation
instead.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>closeCorrelationKeyOnCompletion</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Whether or not too <em>late</em> Exchanges should be
accepted or not. You can enable this to indicate that if a correlation key has
already been completed, then any new exchanges with the same correlation key be
denied. Camel will then throw a <code>closedCorrelationKeyException</code>
exception. When using this option you pa
ss in a <code>integer</code> which is a number for a LRUCache which keeps that
last X number of closed correlation keys. You can pass in 0 or a negative value
to indicate a unbounded cache. By passing in a number you are ensured that
cache won't grow too big if you use a log of different correlation
keys.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>discardOnCompletionTimeout</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.5:</strong> Whether or not
exchanges which complete due to a timeout should be discarded. If enabled then
when a timeout occurs the aggregated message will <strong>not</strong> be sent
out but dropped (discarded).</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>aggregationRepository</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Allows
you to plugin you own implementation of
<code>org.apache.camel.spi.AggregationRepository</code> which keeps track of
the current inflight aggregated exchanges. Camel uses by default a memory based
implementation.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>aggregationRepositoryRef</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Reference to lookup a
<code>aggregationRepository</code> in the <a shape="rect"
href="registry.html">Registry</a>.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>parallelProcessing</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>When aggregated are completed they are being send out
of the aggregator. This option indicates whether or not Camel should use a
thread pool with multiple threads for concurrency. If no custom thread pool has
been specifi
ed then Camel creates a default pool with 10 concurrent
threads.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>executorService</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>If using <code>parallelProcessing</code> you can
specify a custom thread pool to be used. In fact also if you are not using
<code>parallelProcessing</code> this custom thread pool is used to send out
aggregated exchanges as well.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>executorServiceRef</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Reference to lookup a <code>executorService</code> in
the <a shape="rect" href="registry.html">Registry</a></p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>timeoutCheckerExecutorService</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </
p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel
2.9:</strong> If using either of the <code>completionTimeout</code>,
<code>completionTimeoutExpression</code>, or <code>completionInterval</code>
options a background thread is created to check for the completion for every
aggregator. Set this option to provide a custom thread pool to be used rather
than creating a new thread for every aggregator.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>timeoutCheckerExecutorServiceRef</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> Reference to
lookup a <code>timeoutCheckerExecutorService</code> in the <a shape="rect"
href="registry.html">Registry</a></p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>optimisticLocking</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowsp
an="1" class="confluenceTd"><p><strong>Camel 2.11:</strong> Turns on using
optimistic locking, which requires the <code>aggregationRepository</code> being
used, is supporting this by implementing the
<code>org.apache.camel.spi.OptimisticLockingAggregationRepository</code>
interface.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>optimisticLockRetryPolicy</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><strong>Camel 2.11.1:</strong> Allows to configure
retry settings when using optimistic
locking.</p></td></tr></tbody></table></div></div><h3
id="Aggregator2-ExchangeProperties">Exchange Properties</h3><p>The following
properties are set on each aggregated Exchange:</p><div
class="confluenceTableSmall"><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>header</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>ty
pe</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>description</p></th></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>CamelAggregatedSize</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 aggregated
into this combined Exchange.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>CamelAggregatedCompletedBy</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Indicator how the aggregation was completed
as a value of either: <code>predicate</code>, <code>size</code>,
<code>strategy</code>, <code>consumer</code>, <code>timeout</code>,
<code>forceCompletion</code> or
<code>interval</code>.</p></td></tr></tbody></table></div></div><h3
id="Aggregator2-AboutAggregationStrategy">About AggregationStrategy</h3><p>The
<code>AggregationStrategy</code> i
s used for aggregating the old (lookup by its correlation id) and the new
exchanges together into a single exchange. Possible implementations include
performing some kind of combining or delta processing, such as adding line
items together into an invoice or just using the newest exchange and removing
old exchanges such as for state tracking or market data prices; where old
values are of little use.</p><p>Notice the aggregation strategy is a mandatory
option and must be provided to the aggregator.</p><p>Here are a few example
AggregationStrategy implementations that should help you create your own custom
strategy.</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[//simply combines Exchange String body values
using '+' as a delimiter
class StringAggregationStrategy implements AggregationStrategy {
@@ -307,7 +307,23 @@ from("direct:start")
]]></script>
</div></div><p><strong>Note:</strong> You can also add a fixed size value and
Camel will fallback to use this value if the dynamic value was
<code>null</code> or <code>0</code>.</p><p></p><h4
id="Aggregator2-UsingThisPattern">Using This Pattern</h4>
-<p>If you would like to use this EIP Pattern then please read the <a
shape="rect" href="getting-started.html">Getting Started</a>, you may also find
the <a shape="rect" href="architecture.html">Architecture</a> useful
particularly the description of <a shape="rect"
href="endpoint.html">Endpoint</a> and <a shape="rect"
href="uris.html">URIs</a>. Then you could try out some of the <a shape="rect"
href="examples.html">Examples</a> first before trying this pattern out.</p><h4
id="Aggregator2-ManuallyForcetheCompletionofAllAggregatedExchangesImmediately">Manually
Force the Completion of All Aggregated Exchanges
Immediately</h4><p><strong>Available as of Camel 2.9</strong><br clear="none">
You can manually trigger completion of all current aggregated exchanges by
sending a message containing the header
Exchange.AGGREGATION_COMPLETE_ALL_GROUPS set to true. The message is considered
a signal message only, the message headers/contents will not be processed
otherwise.</p><p><strong>Available
as of Camel 2.11</strong><br clear="none"> You can alternatively set the
header Exchange.AGGREGATION_COMPLETE_ALL_GROUPS_INCLUSIVE to true to trigger
completion of all groups after processing the current message.</p><h4
id="Aggregator2-UsingaList<V>inAggregationStrategy">Using a List<V>
in AggregationStrategy</h4><p><strong>Available as of Camel
2.11</strong></p><p>If you want to aggregate some value from the messages
<V> into a List<V> then we have added a
<code>org.apache.camel.processor.aggregate.AbstractListAggregationStrategy</code>
abstract class in <strong>Camel 2.11</strong> that makes this easier. The
completed Exchange that is sent out of the aggregator will contain the
List<V> in the message body.</p><p>For example to aggregate a
List<Integer> you can extend this class as shown below, and implement the
<code>getValue</code> method:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<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><h4
id="Aggregator2-CompletingcurrentgroupdecidedfromtheAggregationStrategy">Completing
current group decided from the AggregationStrategy</h4><p><strong>Available as
of Camel 2.15</strong></p><p>The <code>AggregationStrategy</code> can now
included a property on the returned <code>Exchange</code> that contains a
boolean to indicate if the current group should be completed. This allows to
overrule any existing completion predicates / sizes / timeouts etc, and
complete the group.</p><p>For example the followin
g logic (from an unit test) will complete the group if the message body size
is larger than 5. This is done by setting the property <span
style="line-height: 1.4285715;">Exchange.AGGREGATION_COMPLETE_CURRENT_GROUP to
true.</span></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[ public final class MyCompletionStrategy
implements AggregationStrategy {
+ @Override
+ public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
+ if (oldExchange == null) {
+ return newExchange;
+ }
+ String body = oldExchange.getIn().getBody(String.class) +
"+"
+ + newExchange.getIn().getBody(String.class);
+ oldExchange.getIn().setBody(body);
+ if (body.length() >= 5) {
+
oldExchange.setProperty(Exchange.AGGREGATION_COMPLETE_CURRENT_GROUP, true);
+ }
+ return oldExchange;
+ }
+ }]]></script>
+</div></div><p> </p><h4
id="Aggregator2-ManuallyForcetheCompletionofAllAggregatedExchangesImmediately">Manually
Force the Completion of All Aggregated Exchanges
Immediately</h4><p><strong>Available as of Camel 2.9</strong><br clear="none">
You can manually trigger completion of all current aggregated exchanges by
sending a message containing the header
Exchange.AGGREGATION_COMPLETE_ALL_GROUPS set to true. The message is considered
a signal message only, the message headers/contents will not be processed
otherwise.</p><p><strong>Available as of Camel 2.11</strong><br clear="none">
You can alternatively set the header
Exchange.AGGREGATION_COMPLETE_ALL_GROUPS_INCLUSIVE to true to trigger
completion of all groups after processing the current message.</p><h4
id="Aggregator2-UsingaList<V>inAggregationStrategy">Using a List<V>
in AggregationStrategy</h4><p><strong>Available as of Camel
2.11</strong></p><p>If you want to aggregate some value from the messages
<V> into
a List<V> then we have added a
<code>org.apache.camel.processor.aggregate.AbstractListAggregationStrategy</code>
abstract class in <strong>Camel 2.11</strong> that makes this easier. The
completed Exchange that is sent out of the aggregator will contain the
List<V> in the message body.</p><p>For example to aggregate a
List<Integer> you can extend this class as shown below, and implement the
<code>getValue</code> method:</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[
/**
* Our strategy just group a list of integers.
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 Wed Mar 4 06:19:07
2015
@@ -4128,11 +4128,11 @@ While not actual tutorials you might fin
</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.rbtoc1425410347204 {padding: 0px;}
-div.rbtoc1425410347204 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1425410347204 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1425449882731 {padding: 0px;}
+div.rbtoc1425449882731 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1425449882731 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1425410347204">
+/*]]>*/</style></p><div class="toc-macro rbtoc1425449882731">
<ul class="toc-indentation"><li><a shape="rect"
href="#Tutorial-JmsRemoting-TutorialonSpringRemotingwithJMS">Tutorial on Spring
Remoting with JMS</a></li><li><a shape="rect"
href="#Tutorial-JmsRemoting-Preface">Preface</a></li><li><a shape="rect"
href="#Tutorial-JmsRemoting-Prerequisites">Prerequisites</a></li><li><a
shape="rect"
href="#Tutorial-JmsRemoting-Distribution">Distribution</a></li><li><a
shape="rect" href="#Tutorial-JmsRemoting-About">About</a></li><li><a
shape="rect" href="#Tutorial-JmsRemoting-CreatetheCamelProject">Create the
Camel Project</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#Tutorial-JmsRemoting-UpdatethePOMwithDependencies">Update the POM with
Dependencies</a></li></ul>
</li><li><a shape="rect" href="#Tutorial-JmsRemoting-WritingtheServer">Writing
the Server</a>
@@ -6318,11 +6318,11 @@ So we completed the last piece in the pi
<style type="text/css">/*<![CDATA[*/
-div.rbtoc1425410349253 {padding: 0px;}
-div.rbtoc1425410349253 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1425410349253 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1425449882996 {padding: 0px;}
+div.rbtoc1425449882996 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1425449882996 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style><div class="toc-macro rbtoc1425410349253">
+/*]]>*/</style><div class="toc-macro rbtoc1425449882996">
<ul class="toc-indentation"><li><a shape="rect"
href="#Tutorial-AXIS-Camel-TutorialusingAxis1.4withApacheCamel">Tutorial using
Axis 1.4 with Apache Camel</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#Tutorial-AXIS-Camel-Prerequisites">Prerequisites</a></li><li><a
shape="rect"
href="#Tutorial-AXIS-Camel-Distribution">Distribution</a></li><li><a
shape="rect"
href="#Tutorial-AXIS-Camel-Introduction">Introduction</a></li><li><a
shape="rect" href="#Tutorial-AXIS-Camel-SettinguptheprojecttorunAxis">Setting
up the project to run Axis</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#Tutorial-AXIS-Camel-Maven2">Maven 2</a></li><li><a shape="rect"
href="#Tutorial-AXIS-Camel-wsdl">wsdl</a></li><li><a shape="rect"
href="#Tutorial-AXIS-Camel-ConfiguringAxis">Configuring Axis</a></li><li><a
shape="rect" href="#Tutorial-AXIS-Camel-RunningtheExample">Running the
Example</a></li></ul>
@@ -14392,7 +14392,7 @@ from("direct:line")
<p></p><h4 id="BookInOnePage-UsingThisPattern.18">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="BookInOnePage-Aggregator">Aggregator</h3><p><strong>This applies for
Camel version 2.3 or newer. If you use an older version then use this <a
shape="rect" href="aggregator.html">Aggregator</a> link
instead.</strong></p><p>The <a shape="rect" class="external-link"
href="http://www.enterpriseintegrationpatterns.com/Aggregator.html"
rel="nofollow">Aggregator</a> from the <a shape="rect"
href="enterprise-integration-patterns.html">EIP patterns</a> allows you to
combine a number of messages together into a single message.</p><p><img
class="confluence-embedded-image confluence-external-resource"
src="http://www.enterpriseintegrationpatterns.com/img/Aggregator.gif"
data-image-src="http://www.enterpriseintegrationpatterns.com/img/Aggregator.gif"></p><p>A
correlation <a shape="rect" href="expression.html">Expression</a> is used to
determine the messages which should be aggregated together. If you want to
aggregate all messages into a single message, just use a constant expression. An
AggregationStrategy is used to combine all the message exchanges for a single
correlation key into a single message exchange.</p><h3
id="BookInOnePage-Aggregatoroptions">Aggregator options</h3><p>The aggregator
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>correlationExpression</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Mandatory <a shape="rect"
href="expression.html">Expression</a> which evaluates the correlation key to
use for aggregation. The <a shape="rect" href="exchange.html">Exchange</a>
which has the same correlation key is aggregated togeth
er. If the correlation key could not be evaluated an Exception is thrown. You
can disable this by using the <code>ignoreBadCorrelationKeys</code>
option.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>aggregationStrategy</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Mandatory <code>AggregationStrategy</code> which is
used to <em>merge</em> the incoming <a shape="rect"
href="exchange.html">Exchange</a> with the existing already merged exchanges.
At first call the <code>oldExchange</code> parameter is <code>null</code>. On
subsequent invocations the <code>oldExchange</code> contains the merged
exchanges and <code>newExchange</code> is of course the new incoming Exchange.
From <strong>Camel 2.9.2</strong> onwards the strategy can also be a
<code>TimeoutAwareAggregationStrategy</code> implementation, supporting the
timeout callback, see further below for more details.</p></td></tr><tr>
<td colspan="1" rowspan="1" class="confluenceTd"><p>strategyRef</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>A reference to lookup the
<code>AggregationStrategy</code> in the <a shape="rect"
href="registry.html">Registry</a>. From <strong>Camel 2.12</strong> onwards you
can also use a POJO as the <code>AggregationStrategy</code>, see further below
for details.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>strategyMethodName</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </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 further below for more
details.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>strategyMethodAllowNull</p></td><td colspan="1"
rowspan="1" class="confluence
Td"><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
aggregation. If this option is <code>true</code> then <code>null</code> values
is used as the <code>oldExchange</code> (at the very first aggregation), when
using POJOs as the <code>AggregationStrategy</code>. See further below for more
details.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>completionSize</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Number of messages aggregated before the aggregation is
complete. This option can be set as either a fixed value or using an <a
shape="rect" href="expression.html">Expression</a> which allows you to evaluate
a size dynamically - will use <code>Integer</code> as result. If both are set
Camel will fallback to use the fixed value if
the <a shape="rect" href="expression.html">Expression</a> result was
<code>null</code> or <code>0</code>.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>completionTimeout</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Time in millis that an aggregated exchange should be
inactive before its complete. This option can be set as either a fixed value or
using an <a shape="rect" href="expression.html">Expression</a> which allows you
to evaluate a timeout dynamically - will use <code>Long</code> as result. If
both are set Camel will fallback to use the fixed value if the <a shape="rect"
href="expression.html">Expression</a> result was <code>null</code> or
<code>0</code>. You cannot use this option together with completionInterval,
only one of the two can be used.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>completionInterval</p></td><td colspan="1" rowspan="1"
cla
ss="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>A repeating period in millis by which the aggregator
will complete all current aggregated exchanges. Camel has a background task
which is triggered every period. You cannot use this option together with
completionTimeout, only one of them can be used.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>completionPredicate</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>A <a shape="rect"
href="predicate.html">Predicate</a> to indicate when an aggregated exchange is
complete. Starting in <strong>Camel 2.15</strong>, if this is not specified and
the AggregationStrategy object implements Predicate, the aggregationStrategy
object will be used as the completionPredicate.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>completionFromBatchConsumer</p></td><td colspan="1"
rowspan="1" class=
"confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>This option is if the exchanges are coming from a <a
shape="rect" href="batch-consumer.html">Batch Consumer</a>. Then when enabled
the <a shape="rect" href="aggregator2.html">Aggregator2</a> will use the batch
size determined by the <a shape="rect" href="batch-consumer.html">Batch
Consumer</a> in the message header <code>CamelBatchSize</code>. See more
details at <a shape="rect" href="batch-consumer.html">Batch Consumer</a>. This
can be used to aggregate all files consumed from a <a shape="rect"
href="file2.html">File</a> endpoint in that given poll.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>forceCompletionOnStop</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> Indicates to
complete all current aggregated exchanges when the context is stopped</p>
</td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>eagerCheckCompletion</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Whether or not to eager check for
completion when a new incoming <a shape="rect"
href="exchange.html">Exchange</a> has been received. This option influences the
behavior of the <code>completionPredicate</code> option as the <a shape="rect"
href="exchange.html">Exchange</a> being passed in changes accordingly. When
<code>false</code> the <a shape="rect" href="exchange.html">Exchange</a> passed
in the <a shape="rect" href="predicate.html">Predicate</a> is the
<em>aggregated</em> Exchange which means any information you may store on the
aggregated Exchange from the <code>AggregationStrategy</code> is available for
the <a shape="rect" href="predicate.html">Predicate</a>. When <code>true</code>
the <a shape="rect" href="exchange.html">Exchange</a> passed in the <a s
hape="rect" href="predicate.html">Predicate</a> is the <em>incoming</em> <a
shape="rect" href="exchange.html">Exchange</a>, which means you can access data
from the incoming Exchange.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>groupExchanges</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 group all aggregated
Exchanges into a single combined
<code>org.apache.camel.impl.GroupedExchange</code> holder class that holds all
the aggregated Exchanges. And as a result only one Exchange is being sent out
from the aggregator. Can be used to combine many incoming Exchanges into a
single output Exchange without coding a custom <code>AggregationStrategy</code>
yourself. <strong>Important:</strong> This option does <strong>not</strong>
support persistent repository with the aggregator. See further below for an
example and more details.</p></td></tr><tr><t
d colspan="1" rowspan="1"
class="confluenceTd"><p>ignoreInvalidCorrelationKeys</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Whether or not to ignore correlation keys
which could not be evaluated to a value. By default Camel will throw an
Exception, but you can enable this option and ignore the situation
instead.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>closeCorrelationKeyOnCompletion</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Whether or not too <em>late</em> Exchanges should be
accepted or not. You can enable this to indicate that if a correlation key has
already been completed, then any new exchanges with the same correlation key be
denied. Camel will then throw a <code>closedCorrelationKeyException</code>
exception. When using this option you pass in a <code>integer</code> which
is a number for a LRUCache which keeps that last X number of closed
correlation keys. You can pass in 0 or a negative value to indicate a unbounded
cache. By passing in a number you are ensured that cache won't grow too big if
you use a log of different correlation keys.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>discardOnCompletionTimeout</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.5:</strong>
Whether or not exchanges which complete due to a timeout should be discarded.
If enabled then when a timeout occurs the aggregated message will
<strong>not</strong> be sent out but dropped (discarded).</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>aggregationRepository</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Allows you to plugin you own implementati
on of <code>org.apache.camel.spi.AggregationRepository</code> which keeps
track of the current inflight aggregated exchanges. Camel uses by default a
memory based implementation.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>aggregationRepositoryRef</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Reference to lookup a
<code>aggregationRepository</code> in the <a shape="rect"
href="registry.html">Registry</a>.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>parallelProcessing</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>When aggregated are completed they are being send out
of the aggregator. This option indicates whether or not Camel should use a
thread pool with multiple threads for concurrency. If no custom thread pool has
been specified then Camel creates a default po
ol with 10 concurrent threads.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>executorService</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>If using <code>parallelProcessing</code> you can
specify a custom thread pool to be used. In fact also if you are not using
<code>parallelProcessing</code> this custom thread pool is used to send out
aggregated exchanges as well.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>executorServiceRef</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Reference to lookup a <code>executorService</code> in
the <a shape="rect" href="registry.html">Registry</a></p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>timeoutCheckerExecutorService</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><strong>Camel 2.9:</strong> If using either of the
<code>completionTimeout</code>, <code>completionTimeoutExpression</code>, or
<code>completionInterval</code> options a background thread is created to check
for the completion for every aggregator. Set this option to provide a custom
thread pool to be used rather than creating a new thread for every
aggregator.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>timeoutCheckerExecutorServiceRef</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> Reference to
lookup a <code>timeoutCheckerExecutorService</code> in the <a shape="rect"
href="registry.html">Registry</a></p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>optimisticLocking</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><st
rong>Camel 2.11:</strong> Turns on using optimistic locking, which requires
the <code>aggregationRepository</code> being used, is supporting this by
implementing the
<code>org.apache.camel.spi.OptimisticLockingAggregationRepository</code>
interface.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>optimisticLockRetryPolicy</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><strong>Camel 2.11.1:</strong> Allows to configure
retry settings when using optimistic
locking.</p></td></tr></tbody></table></div></div><h3
id="BookInOnePage-ExchangeProperties">Exchange Properties</h3><p>The following
properties are set on each aggregated Exchange:</p><div
class="confluenceTableSmall"><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>header</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>type</p></th><th colspan="1" rowsp
an="1" class="confluenceTh"><p>description</p></th></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>CamelAggregatedSize</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 aggregated
into this combined Exchange.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>CamelAggregatedCompletedBy</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Indicator how the aggregation was completed
as a value of either: <code>predicate</code>, <code>size</code>,
<code>consumer</code>, <code>timeout</code>, <code>forceCompletion</code> or
<code>interval</code>.</p></td></tr></tbody></table></div></div><h3
id="BookInOnePage-AboutAggregationStrategy">About
AggregationStrategy</h3><p>The <code>AggregationStrategy</code> is used for
aggregating the old (lookup by its correla
tion id) and the new exchanges together into a single exchange. Possible
implementations include performing some kind of combining or delta processing,
such as adding line items together into an invoice or just using the newest
exchange and removing old exchanges such as for state tracking or market data
prices; where old values are of little use.</p><p>Notice the aggregation
strategy is a mandatory option and must be provided to the
aggregator.</p><p>Here are a few example AggregationStrategy implementations
that should help you create your own custom strategy.</p><div class="code panel
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<h3 id="BookInOnePage-Aggregator">Aggregator</h3><p><strong>This applies for
Camel version 2.3 or newer. If you use an older version then use this <a
shape="rect" href="aggregator.html">Aggregator</a> link
instead.</strong></p><p>The <a shape="rect" class="external-link"
href="http://www.enterpriseintegrationpatterns.com/Aggregator.html"
rel="nofollow">Aggregator</a> from the <a shape="rect"
href="enterprise-integration-patterns.html">EIP patterns</a> allows you to
combine a number of messages together into a single message.</p><p><img
class="confluence-embedded-image confluence-external-resource"
src="http://www.enterpriseintegrationpatterns.com/img/Aggregator.gif"
data-image-src="http://www.enterpriseintegrationpatterns.com/img/Aggregator.gif"></p><p>A
correlation <a shape="rect" href="expression.html">Expression</a> is used to
determine the messages which should be aggregated together. If you want to
aggregate all messages into a single message, just use a constant expression. An
AggregationStrategy is used to combine all the message exchanges for a single
correlation key into a single message exchange.</p><h3
id="BookInOnePage-Aggregatoroptions">Aggregator options</h3><p>The aggregator
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>correlationExpression</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Mandatory <a shape="rect"
href="expression.html">Expression</a> which evaluates the correlation key to
use for aggregation. The <a shape="rect" href="exchange.html">Exchange</a>
which has the same correlation key is aggregated togeth
er. If the correlation key could not be evaluated an Exception is thrown. You
can disable this by using the <code>ignoreBadCorrelationKeys</code>
option.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>aggregationStrategy</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Mandatory <code>AggregationStrategy</code> which is
used to <em>merge</em> the incoming <a shape="rect"
href="exchange.html">Exchange</a> with the existing already merged exchanges.
At first call the <code>oldExchange</code> parameter is <code>null</code>. On
subsequent invocations the <code>oldExchange</code> contains the merged
exchanges and <code>newExchange</code> is of course the new incoming Exchange.
From <strong>Camel 2.9.2</strong> onwards the strategy can also be a
<code>TimeoutAwareAggregationStrategy</code> implementation, supporting the
timeout callback, see further below for more details.</p></td></tr><tr>
<td colspan="1" rowspan="1" class="confluenceTd"><p>strategyRef</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>A reference to lookup the
<code>AggregationStrategy</code> in the <a shape="rect"
href="registry.html">Registry</a>. From <strong>Camel 2.12</strong> onwards you
can also use a POJO as the <code>AggregationStrategy</code>, see further below
for details.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>strategyMethodName</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </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 further below for more
details.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>strategyMethodAllowNull</p></td><td colspan="1"
rowspan="1" class="confluence
Td"><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
aggregation. If this option is <code>true</code> then <code>null</code> values
is used as the <code>oldExchange</code> (at the very first aggregation), when
using POJOs as the <code>AggregationStrategy</code>. See further below for more
details.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>completionSize</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Number of messages aggregated before the aggregation is
complete. This option can be set as either a fixed value or using an <a
shape="rect" href="expression.html">Expression</a> which allows you to evaluate
a size dynamically - will use <code>Integer</code> as result. If both are set
Camel will fallback to use the fixed value if
the <a shape="rect" href="expression.html">Expression</a> result was
<code>null</code> or <code>0</code>.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>completionTimeout</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Time in millis that an aggregated exchange should be
inactive before its complete. This option can be set as either a fixed value or
using an <a shape="rect" href="expression.html">Expression</a> which allows you
to evaluate a timeout dynamically - will use <code>Long</code> as result. If
both are set Camel will fallback to use the fixed value if the <a shape="rect"
href="expression.html">Expression</a> result was <code>null</code> or
<code>0</code>. You cannot use this option together with completionInterval,
only one of the two can be used.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>completionInterval</p></td><td colspan="1" rowspan="1"
cla
ss="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>A repeating period in millis by which the aggregator
will complete all current aggregated exchanges. Camel has a background task
which is triggered every period. You cannot use this option together with
completionTimeout, only one of them can be used.</p></td></tr><tr><td
colspan="1" rowspan="1" class="confluenceTd"><p>completionPredicate</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>A <a shape="rect"
href="predicate.html">Predicate</a> to indicate when an aggregated exchange is
complete. Starting in <strong>Camel 2.15</strong>, if this is not specified and
the AggregationStrategy object implements Predicate, the aggregationStrategy
object will be used as the completionPredicate.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>completionFromBatchConsumer</p></td><td colspan="1"
rowspan="1" class=
"confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>This option is if the exchanges are coming from a <a
shape="rect" href="batch-consumer.html">Batch Consumer</a>. Then when enabled
the <a shape="rect" href="aggregator2.html">Aggregator2</a> will use the batch
size determined by the <a shape="rect" href="batch-consumer.html">Batch
Consumer</a> in the message header <code>CamelBatchSize</code>. See more
details at <a shape="rect" href="batch-consumer.html">Batch Consumer</a>. This
can be used to aggregate all files consumed from a <a shape="rect"
href="file2.html">File</a> endpoint in that given poll.</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>forceCompletionOnStop</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> Indicates to
complete all current aggregated exchanges when the context is stopped</p>
</td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>eagerCheckCompletion</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Whether or not to eager check for
completion when a new incoming <a shape="rect"
href="exchange.html">Exchange</a> has been received. This option influences the
behavior of the <code>completionPredicate</code> option as the <a shape="rect"
href="exchange.html">Exchange</a> being passed in changes accordingly. When
<code>false</code> the <a shape="rect" href="exchange.html">Exchange</a> passed
in the <a shape="rect" href="predicate.html">Predicate</a> is the
<em>aggregated</em> Exchange which means any information you may store on the
aggregated Exchange from the <code>AggregationStrategy</code> is available for
the <a shape="rect" href="predicate.html">Predicate</a>. When <code>true</code>
the <a shape="rect" href="exchange.html">Exchange</a> passed in the <a s
hape="rect" href="predicate.html">Predicate</a> is the <em>incoming</em> <a
shape="rect" href="exchange.html">Exchange</a>, which means you can access data
from the incoming Exchange.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>groupExchanges</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 group all aggregated
Exchanges into a single combined
<code>org.apache.camel.impl.GroupedExchange</code> holder class that holds all
the aggregated Exchanges. And as a result only one Exchange is being sent out
from the aggregator. Can be used to combine many incoming Exchanges into a
single output Exchange without coding a custom <code>AggregationStrategy</code>
yourself. <strong>Important:</strong> This option does <strong>not</strong>
support persistent repository with the aggregator. See further below for an
example and more details.</p></td></tr><tr><t
d colspan="1" rowspan="1"
class="confluenceTd"><p>ignoreInvalidCorrelationKeys</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Whether or not to ignore correlation keys
which could not be evaluated to a value. By default Camel will throw an
Exception, but you can enable this option and ignore the situation
instead.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>closeCorrelationKeyOnCompletion</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Whether or not too <em>late</em> Exchanges should be
accepted or not. You can enable this to indicate that if a correlation key has
already been completed, then any new exchanges with the same correlation key be
denied. Camel will then throw a <code>closedCorrelationKeyException</code>
exception. When using this option you pass in a <code>integer</code> which
is a number for a LRUCache which keeps that last X number of closed
correlation keys. You can pass in 0 or a negative value to indicate a unbounded
cache. By passing in a number you are ensured that cache won't grow too big if
you use a log of different correlation keys.</p></td></tr><tr><td colspan="1"
rowspan="1" class="confluenceTd"><p>discardOnCompletionTimeout</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.5:</strong>
Whether or not exchanges which complete due to a timeout should be discarded.
If enabled then when a timeout occurs the aggregated message will
<strong>not</strong> be sent out but dropped (discarded).</p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>aggregationRepository</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Allows you to plugin you own implementati
on of <code>org.apache.camel.spi.AggregationRepository</code> which keeps
track of the current inflight aggregated exchanges. Camel uses by default a
memory based implementation.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>aggregationRepositoryRef</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Reference to lookup a
<code>aggregationRepository</code> in the <a shape="rect"
href="registry.html">Registry</a>.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>parallelProcessing</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>When aggregated are completed they are being send out
of the aggregator. This option indicates whether or not Camel should use a
thread pool with multiple threads for concurrency. If no custom thread pool has
been specified then Camel creates a default po
ol with 10 concurrent threads.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>executorService</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>If using <code>parallelProcessing</code> you can
specify a custom thread pool to be used. In fact also if you are not using
<code>parallelProcessing</code> this custom thread pool is used to send out
aggregated exchanges as well.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>executorServiceRef</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p>Reference to lookup a <code>executorService</code> in
the <a shape="rect" href="registry.html">Registry</a></p></td></tr><tr><td
colspan="1" rowspan="1"
class="confluenceTd"><p>timeoutCheckerExecutorService</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><strong>Camel 2.9:</strong> If using either of the
<code>completionTimeout</code>, <code>completionTimeoutExpression</code>, or
<code>completionInterval</code> options a background thread is created to check
for the completion for every aggregator. Set this option to provide a custom
thread pool to be used rather than creating a new thread for every
aggregator.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>timeoutCheckerExecutorServiceRef</p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p><strong>Camel 2.9:</strong> Reference to
lookup a <code>timeoutCheckerExecutorService</code> in the <a shape="rect"
href="registry.html">Registry</a></p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>optimisticLocking</p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><st
rong>Camel 2.11:</strong> Turns on using optimistic locking, which requires
the <code>aggregationRepository</code> being used, is supporting this by
implementing the
<code>org.apache.camel.spi.OptimisticLockingAggregationRepository</code>
interface.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p>optimisticLockRetryPolicy</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1"
class="confluenceTd"><p><strong>Camel 2.11.1:</strong> Allows to configure
retry settings when using optimistic
locking.</p></td></tr></tbody></table></div></div><h3
id="BookInOnePage-ExchangeProperties">Exchange Properties</h3><p>The following
properties are set on each aggregated Exchange:</p><div
class="confluenceTableSmall"><div class="table-wrap"><table
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1"
class="confluenceTh"><p>header</p></th><th colspan="1" rowspan="1"
class="confluenceTh"><p>type</p></th><th colspan="1" rowsp
an="1" class="confluenceTh"><p>description</p></th></tr><tr><td colspan="1"
rowspan="1"
class="confluenceTd"><p><code>CamelAggregatedSize</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 aggregated
into this combined Exchange.</p></td></tr><tr><td colspan="1" rowspan="1"
class="confluenceTd"><p><code>CamelAggregatedCompletedBy</code></p></td><td
colspan="1" rowspan="1" class="confluenceTd"><p>String</p></td><td colspan="1"
rowspan="1" class="confluenceTd"><p>Indicator how the aggregation was completed
as a value of either: <code>predicate</code>, <code>size</code>,
<code>strategy</code>, <code>consumer</code>, <code>timeout</code>,
<code>forceCompletion</code> or
<code>interval</code>.</p></td></tr></tbody></table></div></div><h3
id="BookInOnePage-AboutAggregationStrategy">About
AggregationStrategy</h3><p>The <code>AggregationStrategy</code> is used for
aggregating the old
(lookup by its correlation id) and the new exchanges together into a single
exchange. Possible implementations include performing some kind of combining or
delta processing, such as adding line items together into an invoice or just
using the newest exchange and removing old exchanges such as for state tracking
or market data prices; where old values are of little use.</p><p>Notice the
aggregation strategy is a mandatory option and must be provided to the
aggregator.</p><p>Here are a few example AggregationStrategy implementations
that should help you create your own custom strategy.</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[//simply combines Exchange String body values
using '+' as a delimiter
class StringAggregationStrategy implements AggregationStrategy {
@@ -14613,7 +14613,23 @@ from("direct:start")
]]></script>
</div></div><p><strong>Note:</strong> You can also add a fixed size value and
Camel will fallback to use this value if the dynamic value was
<code>null</code> or <code>0</code>.</p><p></p><h4
id="BookInOnePage-UsingThisPattern.19">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><h4
id="BookInOnePage-ManuallyForcetheCompletionofAllAggregatedExchangesImmediately">Manually
Force the Completion of All Aggregated Exchanges
Immediately</h4><p><strong>Available as of Camel 2.9</strong><br clear="none">
You can manually trigger completion of all current aggregated exchanges by
sending a message containing the header
Exchange.AGGREGATION_COMPLETE_ALL_GROUPS set to true. The message is considered
a signal message only, the message headers/contents will not be processed
otherwise.</p><p><strong>Availabl
e as of Camel 2.11</strong><br clear="none"> You can alternatively set the
header Exchange.AGGREGATION_COMPLETE_ALL_GROUPS_INCLUSIVE to true to trigger
completion of all groups after processing the current message.</p><h4
id="BookInOnePage-UsingaList<V>inAggregationStrategy">Using a
List<V> in AggregationStrategy</h4><p><strong>Available as of Camel
2.11</strong></p><p>If you want to aggregate some value from the messages
<V> into a List<V> then we have added a
<code>org.apache.camel.processor.aggregate.AbstractListAggregationStrategy</code>
abstract class in <strong>Camel 2.11</strong> that makes this easier. The
completed Exchange that is sent out of the aggregator will contain the
List<V> in the message body.</p><p>For example to aggregate a
List<Integer> you can extend this class as shown below, and implement the
<code>getValue</code> method:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<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><h4
id="BookInOnePage-CompletingcurrentgroupdecidedfromtheAggregationStrategy">Completing
current group decided from the AggregationStrategy</h4><p><strong>Available as
of Camel 2.15</strong></p><p>The <code>AggregationStrategy</code> can now
included a property on the returned <code>Exchange</code> that contains a
boolean to indicate if the current group should be completed. This allows to
overrule any existing completion predicates / sizes / timeouts etc, and
complete the group.</p><p>For example the follow
ing logic (from an unit test) will complete the group if the message body size
is larger than 5. This is done by setting the property <span
style="line-height: 1.4285715;">Exchange.AGGREGATION_COMPLETE_CURRENT_GROUP to
true.</span></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[ public final class MyCompletionStrategy
implements AggregationStrategy {
+ @Override
+ public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
+ if (oldExchange == null) {
+ return newExchange;
+ }
+ String body = oldExchange.getIn().getBody(String.class) +
"+"
+ + newExchange.getIn().getBody(String.class);
+ oldExchange.getIn().setBody(body);
+ if (body.length() >= 5) {
+
oldExchange.setProperty(Exchange.AGGREGATION_COMPLETE_CURRENT_GROUP, true);
+ }
+ return oldExchange;
+ }
+ }]]></script>
+</div></div><p> </p><h4
id="BookInOnePage-ManuallyForcetheCompletionofAllAggregatedExchangesImmediately">Manually
Force the Completion of All Aggregated Exchanges
Immediately</h4><p><strong>Available as of Camel 2.9</strong><br clear="none">
You can manually trigger completion of all current aggregated exchanges by
sending a message containing the header
Exchange.AGGREGATION_COMPLETE_ALL_GROUPS set to true. The message is considered
a signal message only, the message headers/contents will not be processed
otherwise.</p><p><strong>Available as of Camel 2.11</strong><br clear="none">
You can alternatively set the header
Exchange.AGGREGATION_COMPLETE_ALL_GROUPS_INCLUSIVE to true to trigger
completion of all groups after processing the current message.</p><h4
id="BookInOnePage-UsingaList<V>inAggregationStrategy">Using a
List<V> in AggregationStrategy</h4><p><strong>Available as of Camel
2.11</strong></p><p>If you want to aggregate some value from the messages
<V>
into a List<V> then we have added a
<code>org.apache.camel.processor.aggregate.AbstractListAggregationStrategy</code>
abstract class in <strong>Camel 2.11</strong> that makes this easier. The
completed Exchange that is sent out of the aggregator will contain the
List<V> in the message body.</p><p>For example to aggregate a
List<Integer> you can extend this class as shown below, and implement the
<code>getValue</code> method:</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[
/**
* Our strategy just group a list of integers.
@@ -18853,11 +18869,11 @@ template.send("direct:alias-verify&
</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.rbtoc1425410372209 {padding: 0px;}
-div.rbtoc1425410372209 ul {list-style: disc;margin-left: 0px;}
-div.rbtoc1425410372209 li {margin-left: 0px;padding-left: 0px;}
+div.rbtoc1425449886291 {padding: 0px;}
+div.rbtoc1425449886291 ul {list-style: disc;margin-left: 0px;}
+div.rbtoc1425449886291 li {margin-left: 0px;padding-left: 0px;}
-/*]]>*/</style></p><div class="toc-macro rbtoc1425410372209">
+/*]]>*/</style></p><div class="toc-macro rbtoc1425449886291">
<ul class="toc-indentation"><li><a shape="rect" href="#CXF-CXFComponent">CXF
Component</a>
<ul class="toc-indentation"><li><a shape="rect" href="#CXF-URIformat">URI
format</a></li><li><a shape="rect" href="#CXF-Options">Options</a>
<ul class="toc-indentation"><li><a shape="rect"
href="#CXF-Thedescriptionsofthedataformats">The descriptions of the
dataformats</a>