Modified: websites/production/camel/content/content-enricher.html
==============================================================================
--- websites/production/camel/content/content-enricher.html (original)
+++ websites/production/camel/content/content-enricher.html Mon Jul 13 10:20:36 
2015
@@ -120,7 +120,7 @@ from("direct:start").process(n
   <to uri="activemq:Output"/>
 </route>
 ]]></script>
-</div></div><p><span class="confluence-anchor-link" 
id="ContentEnricher-enrich-dsl"></span></p><h3 
id="ContentEnricher-ContentenrichmentusingtheenrichDSLelement">Content 
enrichment using the <code>enrich</code> DSL element</h3><p>Camel comes with 
two flavors of content enricher in the DSL</p><ul 
class="alternate"><li><code>enrich</code></li><li><code>pollEnrich</code></li></ul><p><code>enrich</code>
 uses a <code>Producer</code> to obtain the additional data. It is usually used 
for <a shape="rect" href="request-reply.html">Request Reply</a> messaging, for 
instance to invoke an external web service.<br clear="none"> 
<code>pollEnrich</code> on the other hand uses a <a shape="rect" 
href="polling-consumer.html">Polling Consumer</a> to obtain the additional 
data. It is usually used for <a shape="rect" href="event-message.html">Event 
Message</a> messaging, for instance to read a file or download a <a 
shape="rect" href="ftp2.html">FTP</a> file.</p><div 
class="confluence-information-macro co
 nfluence-information-macro-warning"><p class="title">Data from current 
Exchange not used</p><span class="aui-icon aui-icon-small aui-iconfont-error 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p><code>pollEnrich</code> or 
<code>enrich</code> does <strong>not</strong> access any data from the current 
<a shape="rect" href="exchange.html">Exchange</a> which means when polling it 
cannot use any of the existing headers you may have set on the <a shape="rect" 
href="exchange.html">Exchange</a>. For example you cannot set a filename in the 
<code>Exchange.FILE_NAME</code> header and use <code>pollEnrich</code> to 
consume only that file. For that you <strong>must</strong> set the filename in 
the endpoint URI.</p><p>Instead of using <code>enrich</code> you can use <a 
shape="rect" href="recipient-list.html">Recipient List</a> and have dynamic 
endpoints and define an <code>AggregationStrategy</code> on the <a shape="rect" 
href="recipient-list.html">Re
 cipient List</a> which then would work as a <code>enrich</code> would 
do.</p><p>pollEnrich only accept one message as response. That means that if 
you target to enrich your original message with the enricher collecting 
messages from a seda, ... components using an aggregation strategy. Only one 
response message will be aggregated with the original 
message</p><p>&#160;</p></div></div><h3 
id="ContentEnricher-EnrichOptions">Enrich Options</h3><div 
class="confluenceTableSmall"><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>uri</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>The endpoint uri for the external ser
 vice to enrich from. You must use either <code>uri</code> or 
<code>ref</code>.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>ref</code></p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Refers to the endpoint for the external service to 
enrich from. You must use either <code>uri</code> or 
<code>ref</code>.</p></td></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 merge the reply from the external service, into a single 
outgoing message. By default Camel will use the reply from the external service 
as outgoin
 g message. 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">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">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 aggrega
 te method is not used if there was no data to enrich. If this option is 
<code>true</code> then <code>null</code> values is used as the 
<code>oldExchange</code> (when no data to enrich), when using POJOs as the 
<code>AggregationStrategy</code>. See the <a shape="rect" 
href="aggregator2.html">Aggregate</a> page for more 
details.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><code>aggregateOnException</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><strong>Camel 2.14:</strong> If this option is 
<code>false</code> then the aggregate method is <strong>not</strong> used if 
there was an exception thrown while trying to retrieve the data to enrich from 
the resource. Setting this option to <code>true</code> allows end users to 
control what to do if there was an exception in the <code>aggregate</code> 
method. For example to suppress the exception or set a custom message body 
etc.</td></tr><
 tr><td colspan="1" rowspan="1" 
class="confluenceTd"><code>shareUnitOfWork</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><strong>Camel 2.16:</strong> <span 
style="color: rgb(0,0,0);">&#160;Shares the unit of work with the parent and 
the resource exchange. Enrich will by default not share unit of work between 
the parent exchange and the resource exchange. This means the resource exchange 
has its own individual unit of work. See <a shape="rect" 
href="splitter.html">Splitter</a> for more information and 
example.</span></td></tr></tbody></table></div></div><p><strong>Using 
the</strong> <strong><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">
+</div></div><p><span class="confluence-anchor-link" 
id="ContentEnricher-enrich-dsl"></span></p><h3 
id="ContentEnricher-ContentenrichmentusingtheenrichDSLelement">Content 
enrichment using the <code>enrich</code> DSL element</h3><p>Camel comes with 
two flavors of content enricher in the DSL</p><ul 
class="alternate"><li><code>enrich</code></li><li><code>pollEnrich</code></li></ul><p><code>enrich</code>
 uses a <code>Producer</code> to obtain the additional data. It is usually used 
for <a shape="rect" href="request-reply.html">Request Reply</a> messaging, for 
instance to invoke an external web service.<br clear="none"> 
<code>pollEnrich</code> on the other hand uses a <a shape="rect" 
href="polling-consumer.html">Polling Consumer</a> to obtain the additional 
data. It is usually used for <a shape="rect" href="event-message.html">Event 
Message</a> messaging, for instance to read a file or download a <a 
shape="rect" href="ftp2.html">FTP</a> file.</p><div 
class="confluence-information-macro co
 nfluence-information-macro-warning"><p class="title">Camel 2.15 or older - 
Data from current Exchange not used</p><span class="aui-icon aui-icon-small 
aui-iconfont-error confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p><code>pollEnrich</code> or 
<code>enrich</code> does <strong>not</strong> access any data from the current 
<a shape="rect" href="exchange.html">Exchange</a> which means when polling it 
cannot use any of the existing headers you may have set on the <a shape="rect" 
href="exchange.html">Exchange</a>. For example you cannot set a filename in the 
<code>Exchange.FILE_NAME</code> header and use <code>pollEnrich</code> to 
consume only that file. For that you <strong>must</strong> set the filename in 
the endpoint URI.</p><p>Instead of using <code>enrich</code> you can use <a 
shape="rect" href="recipient-list.html">Recipient List</a> and have dynamic 
endpoints and define an <code>AggregationStrategy</code> on the <a shape="rect" 
href="r
 ecipient-list.html">Recipient List</a> which then would work as a 
<code>enrich</code> would do.</p><p>pollEnrich only accept one message as 
response. That means that if you target to enrich your original message with 
the enricher collecting messages from a seda, ... components using an 
aggregation strategy. Only one response message will be aggregated with the 
original message.</p><p>From <strong>Camel 2.16</strong> onwards both enrich 
and pollEnrich supports dynamic endpoints that uses an <a shape="rect" 
href="expression.html">Expression</a> to compute the uri, which allows to use 
data from the current <a shape="rect" href="exchange.html">Exchange</a>. In 
other words all what is told above no longer apply and it just 
works.</p></div></div><h3 id="ContentEnricher-EnrichOptions">Enrich 
Options</h3><div class="confluenceTableSmall"><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan=
 "1" class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>uri</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>The endpoint uri for the external service to enrich 
from. You must use either <code>uri</code> or <code>ref</code>. 
<strong>Important:</strong> From Camel 2.16 onwards, this option is removed, 
and you use an <a shape="rect" href="expression.html">Expression</a> to 
configure the uri, such as <a shape="rect" href="simple.html">Simple</a> or <a 
shape="rect" href="constant.html">Constant</a> or any other dynamic language 
that can compute the uri dynamically using values from the current <a 
shape="rect" href="exchange.html">Exchange</a>.</p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>ref</code></p></td><td 
colspan="1" rowspan="1" class="co
 nfluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Refers to the endpoint for the external service to 
enrich from. You must use either <code>uri</code> or <code>ref</code>. 
<span>&#160;</span><strong>Important:</strong><span> From Camel 2.16 onwards, 
this option is removed, and you use an </span><a shape="rect" 
href="expression.html">Expression</a><span> to configure the uri, such as 
</span><a shape="rect" href="simple.html">Simple</a><span> or </span><a 
shape="rect" href="constant.html">Constant</a><span> or any other dynamic 
language that can compute the uri dynamically using values from the current 
</span><span>&#160;</span><a shape="rect" 
href="exchange.html">Exchange</a><span>.</span></p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd">expression</td><td colspan="1" 
rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" 
class="confluenceTd"><strong>Camel 2.16:</strong> Mandatory. 
The<span>&#160;</span><a shape="rect"
  href="expression.html">Expression</a><span> to configure the uri, such as 
</span><a shape="rect" href="simple.html">Simple</a><span> or </span><a 
shape="rect" href="constant.html">Constant</a><span> or any other dynamic 
language that can compute the uri dynamically using values from the current 
</span><span>&#160;</span><a shape="rect" 
href="exchange.html">Exchange</a><span>.</span></td></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 merge the reply from the external service, into a single 
outgoing message. By default Camel will use the reply from the external service 
as outgoing message. 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">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">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 if 
there 
 was no data to enrich. If this option is <code>true</code> then 
<code>null</code> values is used as the <code>oldExchange</code> (when no data 
to enrich), when using POJOs as the <code>AggregationStrategy</code>. See the 
<a shape="rect" href="aggregator2.html">Aggregate</a> page for more 
details.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><code>aggregateOnException</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><strong>Camel 2.14:</strong> If this option is 
<code>false</code> then the aggregate method is <strong>not</strong> used if 
there was an exception thrown while trying to retrieve the data to enrich from 
the resource. Setting this option to <code>true</code> allows end users to 
control what to do if there was an exception in the <code>aggregate</code> 
method. For example to suppress the exception or set a custom message body 
etc.</td></tr><tr><td colspan="1" rowspan="1" 
 class="confluenceTd"><code>shareUnitOfWork</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><strong>Camel 2.16:</strong> <span 
style="color: rgb(0,0,0);">&#160;Shares the unit of work with the parent and 
the resource exchange. Enrich will by default not share unit of work between 
the parent exchange and the resource exchange. This means the resource exchange 
has its own individual unit of work. See <a shape="rect" 
href="splitter.html">Splitter</a> for more information and 
example.</span></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><code>cacheSize</code></td><td colspan="1" rowspan="1" 
class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" 
class="confluenceTd"><strong>Camel 2.16:</strong> <span style="color: 
rgb(0,0,0);">Allows to configure the cache size for 
the&#160;</span><code>ProducerCache</code><span style="color: 
rgb(0,0,0);">&#160;which caches producers for reuse in the e
 nrich. Will by default use the default cache size which is 1000. Setting the 
value to -1 allows to turn off the cache all 
together.</span></td></tr></tbody></table></div></div><p><strong>Using 
the</strong> <strong><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="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[AggregationStrategy aggregationStrategy = ...
 
 from(&quot;direct:start&quot;)
@@ -174,7 +174,7 @@ from(&quot;direct:resource&quot;)
     &lt;to uri=&quot;direct:result&quot;/&gt;
   &lt;/route&gt;
 ]]></script>
-</div></div><h3 id="ContentEnricher-ContentenrichmentusingpollEnrich">Content 
enrichment using <code>pollEnrich</code></h3><p>The <code>pollEnrich</code> 
works just as the <code>enrich</code> however as it uses a <a shape="rect" 
href="polling-consumer.html">Polling Consumer</a> we have 3 methods when 
polling</p><ul 
class="alternate"><li>receive</li><li>receiveNoWait</li><li>receive(timeout)</li></ul><h3
 id="ContentEnricher-PollEnrichOptions">PollEnrich Options</h3><div 
class="confluenceTableSmall"><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>uri</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>The endpoint
  uri for the external service to enrich from. You must use either 
<code>uri</code> or <code>ref</code>.</p></td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>ref</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>Refers to the endpoint for the external service to 
enrich from. You must use either <code>uri</code> or 
<code>ref</code>.</p></td></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 merge the reply from the external service, into a single 
outgoing message. By default Camel will use the reply from the ex
 ternal service as outgoing message. 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">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">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>fals
 e</code> then the aggregate method is not used if there was no data to enrich. 
If this option is <code>true</code> then <code>null</code> values is used as 
the <code>oldExchange</code> (when no data to enrich), when using POJOs as the 
<code>AggregationStrategy</code>. See the <a shape="rect" 
href="aggregator2.html">Aggregate</a> page for more 
details.</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><code>-1</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Timeout in millis when polling from the 
external service. See below for important details about the 
timeout.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><code>aggregateOnException</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><strong>Camel 2.14:</strong> If this option is 
<code>false</code> then the aggregat
 e method is <strong>not</strong> used if there was an exception thrown while 
trying to retrieve the data to enrich from the resource. Setting this option to 
<code>true</code> allows end users to control what to do if there was an 
exception in the <code>aggregate</code> method. For example to suppress the 
exception or set a custom message body 
etc.</td></tr></tbody></table></div></div><div 
class="confluence-information-macro 
confluence-information-macro-information"><p class="title">Good practice to use 
timeout value</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>By default Camel will use the 
<code>receive</code>. Which may block until there is a message available. It is 
therefore recommended to always provide a timeout value, to make this clear 
that we may wait for a message, until the timeout is hit.</p></div></div><p>If 
there is no data then the <code>newExchange</code> in the ag
 gregation strategy is <code>null</code>.</p><p>You can pass in a timeout value 
that determines which method to use</p><ul class="alternate"><li>if timeout is 
-1 or other negative number then <code>receive</code> is selected 
(<strong>Important:</strong> the <code>receive</code> method may block if there 
is no message)</li><li>if timeout is 0 then <code>receiveNoWait</code> is 
selected</li><li>otherwise <code>receive(timeout)</code> is 
selected</li></ul><p>The timeout values is in millis.</p><div 
class="confluence-information-macro confluence-information-macro-warning"><p 
class="title">Data from current Exchange not used</p><span class="aui-icon 
aui-icon-small aui-iconfont-error 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p><code>pollEnrich</code> does 
<strong>not</strong> access any data from the current <a shape="rect" 
href="exchange.html">Exchange</a> which means when polling it cannot use any of 
the existing headers you may have set on
  the <a shape="rect" href="exchange.html">Exchange</a>. For example you cannot 
set a filename in the <code>Exchange.FILE_NAME</code> header and use 
<code>pollEnrich</code> to consume only that file. For that you 
<strong>must</strong> set the filename in the endpoint URI.</p></div></div><h4 
id="ContentEnricher-Example">Example</h4><p>In this example we enrich the 
message by loading the content from the file named inbox/data.txt.</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
+</div></div><h3 id="ContentEnricher-ContentenrichmentusingpollEnrich">Content 
enrichment using <code>pollEnrich</code></h3><p>The <code>pollEnrich</code> 
works just as the <code>enrich</code> however as it uses a <a shape="rect" 
href="polling-consumer.html">Polling Consumer</a> we have 3 methods when 
polling</p><ul 
class="alternate"><li>receive</li><li>receiveNoWait</li><li>receive(timeout)</li></ul><h3
 id="ContentEnricher-PollEnrichOptions">PollEnrich Options</h3><div 
class="confluenceTableSmall"><div class="table-wrap"><table 
class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" 
class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><p><code>uri</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" 
class="confluenceTd"><p>The endpoint
  uri for the external service to enrich from. You must use either 
<code>uri</code> or <code>ref</code>. <strong>Important:</strong><span> From 
Camel 2.16 onwards, this option is removed, and you use an </span><a 
shape="rect" href="expression.html">Expression</a><span> to configure the uri, 
such as </span><a shape="rect" href="simple.html">Simple</a><span> or </span><a 
shape="rect" href="constant.html">Constant</a><span> or any other dynamic 
language that can compute the uri dynamically using values from the current 
</span><span>&#160;</span><a shape="rect" 
href="exchange.html">Exchange</a><span>.</span></p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><p><code>ref</code></p></td><td 
colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Refers to the endpoint for the external 
service to enrich from. You must use either <code>uri</code> or 
<code>ref</code>. <strong>Important:</strong><span> From Camel 2.16 o
 nwards, this option is removed, and you use an </span><a shape="rect" 
href="expression.html">Expression</a><span> to configure the uri, such as 
</span><a shape="rect" href="simple.html">Simple</a><span> or </span><a 
shape="rect" href="constant.html">Constant</a><span> or any other dynamic 
language that can compute the uri dynamically using values from the current 
</span><span>&#160;</span><a shape="rect" 
href="exchange.html">Exchange</a><span>.</span></p></td></tr><tr><td 
colspan="1" rowspan="1" class="confluenceTd"><code>expression</code></td><td 
colspan="1" rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" 
rowspan="1" class="confluenceTd"><strong>Camel 2.16:</strong><span> Mandatory. 
The</span><span>&#160;</span><a shape="rect" 
href="expression.html">Expression</a><span> to configure the uri, such as 
</span><a shape="rect" href="simple.html">Simple</a><span> or </span><a 
shape="rect" href="constant.html">Constant</a><span> or any other dynamic 
language that can compute t
 he uri dynamically using values from the current </span><span>&#160;</span><a 
shape="rect" href="exchange.html">Exchange</a><span>.</span></td></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 merge the reply from the external service, into a single 
outgoing message. By default Camel will use the reply from the external service 
as outgoing message. 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">Aggregate</a> page for more 
details.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><p><code>st
 rategyMethodName</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">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 if 
there was no data to enrich. If this option is <code>true</code> then 
<code>null</code> values is used as the <code>oldExchange</code> (when no data 
to enrich), when using POJOs as the <code>AggregationStrategy</code>. See the 
<a shape="rect" href="aggre
 gator2.html">Aggregate</a> page for more details.</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><code>-1</code></p></td><td colspan="1" 
rowspan="1" class="confluenceTd"><p>Timeout in millis when polling from the 
external service. See below for important details about the 
timeout.</p></td></tr><tr><td colspan="1" rowspan="1" 
class="confluenceTd"><code>aggregateOnException</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><code>false</code></td><td colspan="1" 
rowspan="1" class="confluenceTd"><strong>Camel 2.14:</strong> If this option is 
<code>false</code> then the aggregate method is <strong>not</strong> used if 
there was an exception thrown while trying to retrieve the data to enrich from 
the resource. Setting this option to <code>true</code> allows end users to 
control what to do if there was an exception in the <code>aggregate</code> 
method. For example to suppress th
 e exception or set a custom message body etc.</td></tr><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><code>cacheSize</code></td><td colspan="1" 
rowspan="1" class="confluenceTd">&#160;</td><td colspan="1" rowspan="1" 
class="confluenceTd"><strong>Camel 2.16:</strong> <span style="color: 
rgb(0,0,0);">Allows to configure the cache size for 
the&#160;</span><code>ConsumerCache</code><span style="color: 
rgb(0,0,0);">&#160;which caches consumers for reuse in the pollEnrich. Will by 
default use the default cache size which is 1000. Setting the value to -1 
allows to turn off the cache all 
together.</span></td></tr></tbody></table></div></div><div 
class="confluence-information-macro 
confluence-information-macro-information"><p class="title">Good practice to use 
timeout value</p><span class="aui-icon aui-icon-small aui-iconfont-info 
confluence-information-macro-icon"></span><div 
class="confluence-information-macro-body"><p>By default Camel will use the 
<code>receive</code>. Which may blo
 ck until there is a message available. It is therefore recommended to always 
provide a timeout value, to make this clear that we may wait for a message, 
until the timeout is hit.</p></div></div><p>If there is no data then the 
<code>newExchange</code> in the aggregation strategy is 
<code>null</code>.</p><p>You can pass in a timeout value that determines which 
method to use</p><ul class="alternate"><li>if timeout is -1 or other negative 
number then <code>receive</code> is selected (<strong>Important:</strong> the 
<code>receive</code> method may block if there is no message)</li><li>if 
timeout is 0 then <code>receiveNoWait</code> is selected</li><li>otherwise 
<code>receive(timeout)</code> is selected</li></ul><p>The timeout values is in 
millis.</p><div class="confluence-information-macro 
confluence-information-macro-warning"><p class="title">Camel 2.15 or older - 
Data from current Exchange not used</p><span class="aui-icon aui-icon-small 
aui-iconfont-error confluence-information-macro-
 icon"></span><div 
class="confluence-information-macro-body"><p><code>pollEnrich</code> does 
<strong>not</strong> access any data from the current <a shape="rect" 
href="exchange.html">Exchange</a> which means when polling it cannot use any of 
the existing headers you may have set on the <a shape="rect" 
href="exchange.html">Exchange</a>. For example you cannot set a filename in the 
<code>Exchange.FILE_NAME</code> header and use <code>pollEnrich</code> to 
consume only that file. For that you <strong>must</strong> set the filename in 
the endpoint URI.</p><p><span>From </span><strong>Camel 2.16</strong><span> 
onwards both enrich and pollEnrich supports dynamic endpoints that uses an 
</span><a shape="rect" href="expression.html">Expression</a><span> to compute 
the uri, which allows to use data from the current </span><a shape="rect" 
href="exchange.html">Exchange</a><span>. In other words all what is told above 
no longer apply and it just works.</span></p></div></div><h4 id="ContentEnriche
 r-Example">Example</h4><p>In this example we enrich the message by loading the 
content from the file named inbox/data.txt.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
 <script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;direct:start&quot;)
   .pollEnrich(&quot;file:inbox?fileName=data.txt&quot;)
   .to(&quot;direct:result&quot;);


Reply via email to