Modified: websites/production/camel/content/content-enricher.html
==============================================================================
--- websites/production/camel/content/content-enricher.html (original)
+++ websites/production/camel/content/content-enricher.html Fri Aug 25 08:22:01 
2017
@@ -36,17 +36,6 @@
     <![endif]-->
 
 
-  <link href='//camel.apache.org/styles/highlighter/styles/shCoreCamel.css' 
rel='stylesheet' type='text/css' />
-  <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css' 
rel='stylesheet' type='text/css' />
-  <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js' 
type='text/javascript'></script>
-  
-  <script type="text/javascript">
-  SyntaxHighlighter.defaults['toolbar'] = false;
-  SyntaxHighlighter.all();
-  </script>
 
     <title>
     Apache Camel: Content Enricher
@@ -86,55 +75,28 @@
        <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h3 
id="ContentEnricher-ContentEnricher">Content Enricher</h3><p>Camel supports the 
<a shape="rect" class="external-link" 
href="http://www.enterpriseintegrationpatterns.com/DataEnricher.html"; 
rel="nofollow">Content Enricher</a> from the <a shape="rect" 
href="enterprise-integration-patterns.html">EIP patterns</a> using a <a 
shape="rect" href="message-translator.html">Message Translator</a>, an 
arbitrary <a shape="rect" href="processor.html">Processor</a> in the routing 
logic, or using the <a shape="rect" 
href="#ContentEnricher-enrich-dsl">enrich</a> DSL element to enrich the 
message.</p><p><span class="confluence-embedded-file-wrapper"><img 
class="confluence-embedded-image confluence-external-resource" 
src="http://www.enterpriseintegrationpatterns.com/img/DataEnricher.gif"; 
data-image-src="http://www.enterpriseintegrationpatterns.com/img/DataEnricher.gif";></span></p><h4
 id="ContentEnricher-ContentenrichmentusingaMessageTranslatororaProcessor">Cont
 ent enrichment using a Message Translator or a Processor</h4><p><strong>Using 
the</strong> <strong><a shape="rect" href="fluent-builders.html">Fluent 
Builders</a></strong></p><p>You can use <a shape="rect" 
href="templating.html">Templating</a> to consume a message from one 
destination, transform it with something like <a shape="rect" 
href="velocity.html">Velocity</a> or <a shape="rect" 
href="xquery.html">XQuery</a>, and then send it on to another destination. For 
example using InOnly (one way messaging)</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[from(&quot;activemq:My.Queue&quot;).
-  to(&quot;velocity:com/acme/MyResponse.vm&quot;).
-  to(&quot;activemq:Another.Queue&quot;);
-]]></script>
-</div></div><p>If you want to use InOut (request-reply) semantics to process 
requests on the <strong>My.Queue</strong> queue on <a shape="rect" 
href="activemq.html">ActiveMQ</a> with a template generated response, then 
sending responses back to the JMSReplyTo Destination you could use 
this:</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;activemq:My.Queue&quot;).
-  to(&quot;velocity:com/acme/MyResponse.vm&quot;);
-]]></script>
-</div></div><p>Here is a simple example using the <a shape="rect" 
href="dsl.html">DSL</a> directly to transform the message body</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;).setBody(body().append(&quot; 
World!&quot;)).to(&quot;mock:result&quot;);
-]]></script>
-</div></div>In this example we add our own <a shape="rect" 
href="processor.html">Processor</a> using explicit Java code<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;).process(new Processor() {
-    public void process(Exchange exchange) {
-        Message in = exchange.getIn();
-        in.setBody(in.getBody(String.class) + &quot; World!&quot;);
-    }
-}).to(&quot;mock:result&quot;);
-]]></script>
-</div></div>Finally we can use <a shape="rect" 
href="bean-integration.html">Bean Integration</a> to use any Java method on any 
bean to act as the transformer<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;activemq:My.Queue&quot;).
-  beanRef(&quot;myBeanName&quot;, &quot;myMethodName&quot;).
-  to(&quot;activemq:Another.Queue&quot;);
-]]></script>
-</div></div><p>For further examples of this pattern in use you could look at 
one of the JUnit tests</p><ul><li><a shape="rect" class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TransformTest.java?view=markup";>TransformTest</a></li><li><a
 shape="rect" class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TransformViaDSLTest.java?view=markup";>TransformViaDSLTest</a></li></ul><p><strong>Using
 Spring XML</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[&lt;route&gt;
-  &lt;from uri=&quot;activemq:Input&quot;/&gt;
-  &lt;bean ref=&quot;myBeanName&quot; method=&quot;doTransform&quot;/&gt;
-  &lt;to uri=&quot;activemq:Output&quot;/&gt;
+<div class="wiki-content maincontent"><h3 
id="ContentEnricher-ContentEnricher">Content Enricher</h3><p>Camel supports the 
<a shape="rect" class="external-link" 
href="http://www.enterpriseintegrationpatterns.com/DataEnricher.html"; 
rel="nofollow">Content Enricher</a> from the <a shape="rect" 
href="enterprise-integration-patterns.html">EIP patterns</a> using a <a 
shape="rect" href="message-translator.html">Message Translator</a>, an 
arbitrary <a shape="rect" href="processor.html">Processor</a> in the routing 
logic, or using the <a shape="rect" 
href="#ContentEnricher-enrich-dsl">enrich</a> DSL element to enrich the 
message.</p><p><span class="confluence-embedded-file-wrapper"><img 
class="confluence-embedded-image confluence-external-resource" 
src="http://www.enterpriseintegrationpatterns.com/img/DataEnricher.gif"; 
data-image-src="http://www.enterpriseintegrationpatterns.com/img/DataEnricher.gif";></span></p><h4
 id="ContentEnricher-ContentenrichmentusingaMessageTranslatororaProcessor">Cont
 ent enrichment using a Message Translator or a Processor</h4><p><strong>Using 
the</strong> <strong><a shape="rect" href="fluent-builders.html">Fluent 
Builders</a></strong></p><p>You can use <a shape="rect" 
href="templating.html">Templating</a> to consume a message from one 
destination, transform it with something like <a shape="rect" 
href="velocity.html">Velocity</a> or <a shape="rect" 
href="xquery.html">XQuery</a>, and then send it on to another destination. For 
example using InOnly (one way 
messaging)</p><plain-text-body>from("activemq:My.Queue").
+  to("velocity:com/acme/MyResponse.vm").
+  to("activemq:Another.Queue");
+</plain-text-body><p>If you want to use InOut (request-reply) semantics to 
process requests on the <strong>My.Queue</strong> queue on <a shape="rect" 
href="activemq.html">ActiveMQ</a> with a template generated response, then 
sending responses back to the JMSReplyTo Destination you could use 
this:</p><plain-text-body>from("activemq:My.Queue").
+  to("velocity:com/acme/MyResponse.vm");
+</plain-text-body><p>Here is a simple example using the <a shape="rect" 
href="dsl.html">DSL</a> directly to transform the message 
body<plain-text-body>{snippet:id=example|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TransformViaDSLTest.java}</plain-text-body>In
 this example we add our own <a shape="rect" 
href="processor.html">Processor</a> using explicit Java 
code<plain-text-body>{snippet:id=example|lang=java|url=camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TransformTest.java}</plain-text-body>Finally
 we can use <a shape="rect" href="bean-integration.html">Bean Integration</a> 
to use any Java method on any bean to act as the 
transformer</p><plain-text-body>from("activemq:My.Queue").
+  beanRef("myBeanName", "myMethodName").
+  to("activemq:Another.Queue");
+</plain-text-body><p>For further examples of this pattern in use you could 
look at one of the JUnit tests</p><ul><li><a shape="rect" class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TransformTest.java?view=markup";>TransformTest</a></li><li><a
 shape="rect" class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/TransformViaDSLTest.java?view=markup";>TransformViaDSLTest</a></li></ul><p><strong>Using
 Spring XML</strong></p><plain-text-body>&lt;route&gt;
+  &lt;from uri="activemq:Input"/&gt;
+  &lt;bean ref="myBeanName" method="doTransform"/&gt;
+  &lt;to uri="activemq:Output"/&gt;
 &lt;/route&gt;
-]]></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">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><tr><td 
colspan="1" rowspan="1" 
class="confluenceTd"><code>ignoreInvalidEndpoint</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;Whether to ignore an endpoint URI that could 
not be resolved. If disabled, Camel will throw an exception identifying the 
invalid endpoint URI.</span></td></tr></tbody></table></div></div>
-
+</plain-text-body><p><parameter ac:name="">enrich-dsl</parameter></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><parameter ac:name="title">Camel 
2.15 or older - Data from current Ex
 change not used</parameter><rich-text-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">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></rich-text-body><h3 id="ContentEnricher-EnrichOptions">Enrich 
Options</h3><parameter 
ac:name="class">confluenceTableSmall</parameter><rich-text-body><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="conf
 luenceTd"><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="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 <cod
 e>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="cons
 tant.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 POJO
 s 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="confluenc
 eTd"><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 enrich. 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><tr><td colspan="1" 
ro
 wspan="1" class="confluenceTd"><code>ignoreInvalidEndpoint</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;Whether to ignore an endpoint URI that could 
not be resolved. If disabled, Camel will throw an exception identifying the 
invalid endpoint 
URI.</span></td></tr></tbody></table></div></rich-text-body><p><strong>Using 
the</strong> <strong><a shape="rect" href="fluent-builders.html">Fluent 
Builders</a></strong></p><plain-text-body>AggregationStrategy 
aggregationStrategy = ...
 
-<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("direct:start")
+.enrich("direct:resource", aggregationStrategy)
+.to("direct:result");
 
-from(&quot;direct:start&quot;)
-.enrich(&quot;direct:resource&quot;, aggregationStrategy)
-.to(&quot;direct:result&quot;);
-
-from(&quot;direct:resource&quot;)
+from("direct:resource")
 ...
-]]></script>
-</div></div><p>The content enricher (<code>enrich</code>) retrieves additional 
data from a <em>resource endpoint</em> in order to enrich an incoming message 
(contained in the <em>original exchange</em>). An aggregation strategy is used 
to combine the original exchange and the <em>resource exchange</em>. The first 
parameter of the <code>AggregationStrategy.aggregate(Exchange, Exchange)</code> 
method corresponds to the the original exchange, the second parameter the 
resource exchange. The results from the resource endpoint are stored in the 
resource exchange's out-message. Here's an example template for implementing an 
aggregation strategy:</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[public class ExampleAggregationStrategy 
implements AggregationStrategy {
+</plain-text-body><p>The content enricher (<code>enrich</code>) retrieves 
additional data from a <em>resource endpoint</em> in order to enrich an 
incoming message (contained in the <em>original exchange</em>). An aggregation 
strategy is used to combine the original exchange and the <em>resource 
exchange</em>. The first parameter of the 
<code>AggregationStrategy.aggregate(Exchange, Exchange)</code> method 
corresponds to the the original exchange, the second parameter the resource 
exchange. The results from the resource endpoint are stored in the resource 
exchange's out-message. Here's an example template for implementing an 
aggregation strategy:</p><parameter 
ac:name="">java</parameter><plain-text-body>public class 
ExampleAggregationStrategy implements AggregationStrategy {
 
     public Exchange aggregate(Exchange original, Exchange resource) {
         Object originalBody = original.getIn().getBody();
@@ -149,131 +111,97 @@ from(&quot;direct:resource&quot;)
     }
     
 }
-]]></script>
-</div></div><p>Using this template the original exchange can be of any 
pattern. The resource exchange created by the enricher is always an in-out 
exchange.</p><p><strong>Using Spring XML</strong></p><p>The same example in the 
Spring DSL (Camel 2.15 or older)</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext id=&quot;camel&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
+</plain-text-body><p>Using this template the original exchange can be of any 
pattern. The resource exchange created by the enricher is always an in-out 
exchange.</p><p><strong>Using Spring XML</strong></p><p>The same example in the 
Spring DSL (Camel 2.15 or older)</p><parameter 
ac:name="">xml</parameter><plain-text-body>&lt;camelContext id="camel" 
xmlns="http://camel.apache.org/schema/spring"&gt;
   &lt;route&gt;
-    &lt;from uri=&quot;direct:start&quot;/&gt;
-    &lt;enrich uri=&quot;direct:resource&quot; 
strategyRef=&quot;aggregationStrategy&quot;/&gt;
-    &lt;to uri=&quot;direct:result&quot;/&gt;
+    &lt;from uri="direct:start"/&gt;
+    &lt;enrich uri="direct:resource" strategyRef="aggregationStrategy"/&gt;
+    &lt;to uri="direct:result"/&gt;
   &lt;/route&gt;
   &lt;route&gt;
-    &lt;from uri=&quot;direct:resource&quot;/&gt;
+    &lt;from uri="direct:resource"/&gt;
     ...
   &lt;/route&gt;
 &lt;/camelContext&gt;
 
-&lt;bean id=&quot;aggregationStrategy&quot; class=&quot;...&quot; /&gt;
-]]></script>
-</div></div><p>The same example in the Spring DSL (Camel 2.16 or 
newer)</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[&lt;camelContext id=&quot;camel&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
+&lt;bean id="aggregationStrategy" class="..." /&gt;
+</plain-text-body><p>The same example in the Spring DSL (Camel 2.16 or 
newer)</p><parameter 
ac:name="">xml</parameter><plain-text-body>&lt;camelContext id="camel" 
xmlns="http://camel.apache.org/schema/spring"&gt;
   &lt;route&gt;
-    &lt;from uri=&quot;direct:start&quot;/&gt;
-    &lt;enrich strategyRef=&quot;aggregationStrategy&quot;&gt;
+    &lt;from uri="direct:start"/&gt;
+    &lt;enrich strategyRef="aggregationStrategy"&gt;
       &lt;constant&gt;direct:resource&lt;/constant&gt;
     &lt;/enrich&gt;
-    &lt;to uri=&quot;direct:result&quot;/&gt;
+    &lt;to uri="direct:result"/&gt;
   &lt;/route&gt;
   &lt;route&gt;
-    &lt;from uri=&quot;direct:resource&quot;/&gt;
+    &lt;from uri="direct:resource"/&gt;
     ...
   &lt;/route&gt;
 &lt;/camelContext&gt;
 
-&lt;bean id=&quot;aggregationStrategy&quot; class=&quot;...&quot; /&gt;
-]]></script>
-</div></div><p>&#160;</p><h4 
id="ContentEnricher-Aggregationstrategyisoptional">Aggregation strategy is 
optional</h4><p>The aggregation strategy is optional. If you do not provide it 
Camel will by default just use the body obtained from the resource.</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;)
-  .enrich(&quot;direct:resource&quot;)
-  .to(&quot;direct:result&quot;);
-]]></script>
-</div></div><p>In the route above the message sent to the 
<code>direct:result</code> endpoint will contain the output from the 
<code>direct:resource</code> as we do not use any custom aggregation.</p><p>And 
for Spring DSL (Camel 2.15 or older) just omit the <code>strategyRef</code> 
attribute:</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;route&gt;
-    &lt;from uri=&quot;direct:start&quot;/&gt;
-    &lt;enrich uri=&quot;direct:resource&quot;/&gt;
-    &lt;to uri=&quot;direct:result&quot;/&gt;
-  &lt;/route&gt;
-]]></script>
-</div></div><p>And for Spring DSL (Camel 2.16 or newer) just omit 
the&#160;<code>strategyRef</code>&#160;attribute:</p><div class="code panel 
pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;route&gt;
-    &lt;from uri=&quot;direct:start&quot;/&gt;
+&lt;bean id="aggregationStrategy" class="..." /&gt;
+</plain-text-body><p>&#160;</p><h4 
id="ContentEnricher-Aggregationstrategyisoptional">Aggregation strategy is 
optional</h4><p>The aggregation strategy is optional. If you do not provide it 
Camel will by default just use the body obtained from the 
resource.</p><plain-text-body>from("direct:start")
+  .enrich("direct:resource")
+  .to("direct:result");
+</plain-text-body><p>In the route above the message sent to the 
<code>direct:result</code> endpoint will contain the output from the 
<code>direct:resource</code> as we do not use any custom aggregation.</p><p>And 
for Spring DSL (Camel 2.15 or older) just omit the <code>strategyRef</code> 
attribute:</p><parameter ac:name="">xml</parameter><plain-text-body>  
&lt;route&gt;
+    &lt;from uri="direct:start"/&gt;
+    &lt;enrich uri="direct:resource"/&gt;
+    &lt;to uri="direct:result"/&gt;
+  &lt;/route&gt;
+</plain-text-body><p>And for Spring DSL (Camel 2.16 or newer) just omit 
the&#160;<code>strategyRef</code>&#160;attribute:</p><parameter 
ac:name="">xml</parameter><plain-text-body>  &lt;route&gt;
+    &lt;from uri="direct:start"/&gt;
     &lt;enrich&gt;
       &lt;constant&gt;direct:resource&lt;/constant&gt;
     &lt;/enrich&gt;
-    &lt;to uri=&quot;direct:result&quot;/&gt;
+    &lt;to uri="direct:result"/&gt;
   &lt;/route&gt;
-]]></script>
-</div></div><h3 id="ContentEnricher-Usingdynamicuris">Using dynamic 
uris</h3><p><strong>Available as of Camel 2.16</strong></p><p>From Camel 2.16 
onwards enrich and pollEnrich supports using dynamic uris computed based on 
information from the current&#160;<a shape="rect" 
href="exchange.html">Exchange</a>. For example to enrich from a&#160;<a 
shape="rect" href="http.html">HTTP</a> endpoint where the header with key 
orderId is used as part of the content-path of the HTTP url:</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;)
-  .enrich().simple(&quot;http:myserver/${header.orderId}/order&quot;)
-  .to(&quot;direct:result&quot;);
-]]></script>
-</div></div><p>And in XML DSL</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;route&gt;
-    &lt;from uri=&quot;direct:start&quot;/&gt;
+</plain-text-body><h3 id="ContentEnricher-Usingdynamicuris">Using dynamic 
uris</h3><p><strong>Available as of Camel 2.16</strong></p><p>From Camel 2.16 
onwards enrich and pollEnrich supports using dynamic uris computed based on 
information from the current&#160;<a shape="rect" 
href="exchange.html">Exchange</a>. For example to enrich from a&#160;<a 
shape="rect" href="http.html">HTTP</a> endpoint where the header with key 
orderId is used as part of the content-path of the HTTP 
url:</p><plain-text-body>from("direct:start")
+  .enrich().simple("http:myserver/${header.orderId}/order")
+  .to("direct:result");
+</plain-text-body><p>And in XML DSL</p><parameter 
ac:name="">xml</parameter><plain-text-body>  &lt;route&gt;
+    &lt;from uri="direct:start"/&gt;
     &lt;enrich&gt;
       &lt;simple&gt;http:myserver/${header.orderId}/order&lt;/simple&gt;
     &lt;/enrich&gt;
-    &lt;to uri=&quot;direct:result&quot;/&gt;
+    &lt;to uri="direct:result"/&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>. <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><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><code>ignoreInvalidEndpoint</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;Whether to ignore an endpoint URI that could 
not be resolved. If disabled, Camel will throw an exc
 eption identifying the invalid endpoint 
URI.</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 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 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="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">
-<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;);
-]]></script>
-</div></div><p>And in XML DSL (Camel 2.15 or older) you do:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;route&gt;
-    &lt;from uri=&quot;direct:start&quot;/&gt;
-    &lt;pollEnrich uri=&quot;file:inbox?fileName=data.txt&quot;/&gt;
-    &lt;to uri=&quot;direct:result&quot;/&gt;
-  &lt;/route&gt;
-]]></script>
-</div></div><p>And in XML DSL (Camel 2.16 or newer) you do:</p><div 
class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;route&gt;
-    &lt;from uri=&quot;direct:start&quot;/&gt;
+</plain-text-body><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><parameter 
ac:name="class">confluenceTableSmall</parameter><rich-text-body><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" r
 owspan="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>. <str
 ong>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"><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> o
 r 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>AggregationStrat
 egy</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 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>aggr
 egate</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>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><tr><td colspan="1" 
rowspan="1" class="confluenceTd"><code>ignoreInvalidEndpoint</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;Whether to ignore an endpoint URI that could 
not be
  resolved. If disabled, Camel will throw an exception identifying the invalid 
endpoint URI.</span></td></tr></tbody></table></div></rich-text-body><parameter 
ac:name="title">Good practice to use timeout 
value</parameter><rich-text-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></rich-text-body><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><parameter 
ac:name="title">Camel 2.15 or older - Data from current Exchange not 
used</parameter><rich-text-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></rich-text-body><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><plain-text-body>from("direct:start")
+  .pollEnrich("file:inbox?fileName=data.txt")
+  .to("direct:result");
+</plain-text-body><p>And in XML DSL (Camel 2.15 or older) you 
do:</p><parameter ac:name="">xml</parameter><plain-text-body>  &lt;route&gt;
+    &lt;from uri="direct:start"/&gt;
+    &lt;pollEnrich uri="file:inbox?fileName=data.txt"/&gt;
+    &lt;to uri="direct:result"/&gt;
+  &lt;/route&gt;
+</plain-text-body><p>And in XML DSL (Camel 2.16 or newer) you 
do:</p><parameter ac:name="">xml</parameter><plain-text-body>  &lt;route&gt;
+    &lt;from uri="direct:start"/&gt;
     &lt;pollEnrich&gt;
       &lt;constant&gt;file:inbox?fileName=data.txt&lt;/constant&gt;
     &lt;/pollEnrich&gt;
-    &lt;to uri=&quot;direct:result&quot;/&gt;
+    &lt;to uri="direct:result"/&gt;
   &lt;/route&gt;
-]]></script>
-</div></div><p>&#160;</p><p>If there is no file then the message is empty. We 
can use a timeout to either wait (potentially forever) until a file exists, or 
use a timeout to wait a certain period.</p><p>For example to wait up to 5 
seconds you can do (Camel 2.15 or older):</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;route&gt;
-    &lt;from uri=&quot;direct:start&quot;/&gt;
-    &lt;pollEnrich uri=&quot;file:inbox?fileName=data.txt&quot; 
timeout=&quot;5000&quot;/&gt;
-    &lt;to uri=&quot;direct:result&quot;/&gt;
-  &lt;/route&gt;
-]]></script>
-</div></div><p>For example to wait up to 5 seconds you can do (Camel 2.16 or 
newer):</p><div class="code panel pdl" style="border-width: 1px;"><div 
class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;route&gt;
-    &lt;from uri=&quot;direct:start&quot;/&gt;
-    &lt;pollEnrich timeout=&quot;5000&quot;&gt;
+</plain-text-body><p>&#160;</p><p>If there is no file then the message is 
empty. We can use a timeout to either wait (potentially forever) until a file 
exists, or use a timeout to wait a certain period.</p><p>For example to wait up 
to 5 seconds you can do (Camel 2.15 or older):</p><parameter 
ac:name="">xml</parameter><plain-text-body>  &lt;route&gt;
+    &lt;from uri="direct:start"/&gt;
+    &lt;pollEnrich uri="file:inbox?fileName=data.txt" timeout="5000"/&gt;
+    &lt;to uri="direct:result"/&gt;
+  &lt;/route&gt;
+</plain-text-body><p>For example to wait up to 5 seconds you can do (Camel 
2.16 or newer):</p><parameter ac:name="">xml</parameter><plain-text-body>  
&lt;route&gt;
+    &lt;from uri="direct:start"/&gt;
+    &lt;pollEnrich timeout="5000"&gt;
       &lt;constant&gt;file:inbox?fileName=data.txt&lt;/constant&gt;
     &lt;/pollEnrich&gt;
-    &lt;to uri=&quot;direct:result&quot;/&gt;
+    &lt;to uri="direct:result"/&gt;
   &lt;/route&gt;
-]]></script>
-</div></div><h3 id="ContentEnricher-Usingdynamicuris.1">Using dynamic 
uris</h3><p><strong>Available as of Camel 2.16</strong></p><p>From Camel 2.16 
onwards enrich and pollEnrich supports using dynamic uris computed based on 
information from the current&#160;<a shape="rect" 
href="exchange.html">Exchange</a>. For example to pollEnrich from an endpoint 
that uses a header to indicate a&#160;<a shape="rect" 
href="seda.html">SEDA</a>&#160;queue name:</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().simple(&quot;seda:${header.name}&quot;)
-  .to(&quot;direct:result&quot;);
-]]></script>
-</div></div><p>And in XML DSL</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[  &lt;route&gt;
-    &lt;from uri=&quot;direct:start&quot;/&gt;
+</plain-text-body><h3 id="ContentEnricher-Usingdynamicuris.1">Using dynamic 
uris</h3><p><strong>Available as of Camel 2.16</strong></p><p>From Camel 2.16 
onwards enrich and pollEnrich supports using dynamic uris computed based on 
information from the current&#160;<a shape="rect" 
href="exchange.html">Exchange</a>. For example to pollEnrich from an endpoint 
that uses a header to indicate a&#160;<a shape="rect" 
href="seda.html">SEDA</a>&#160;queue 
name:</p><plain-text-body>from("direct:start")
+  .pollEnrich().simple("seda:${header.name}")
+  .to("direct:result");
+</plain-text-body><p>And in XML DSL</p><parameter 
ac:name="">xml</parameter><plain-text-body>  &lt;route&gt;
+    &lt;from uri="direct:start"/&gt;
     &lt;pollEnrich&gt;
       &lt;simple&gt;seda:${header.name}&lt;/simple&gt;
     &lt;/pollEnrich&gt;
-    &lt;to uri=&quot;direct:result&quot;/&gt;
+    &lt;to uri="direct:result"/&gt;
   &lt;/route&gt;
-]]></script>
-</div></div><p></p><h4 id="ContentEnricher-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></div>
+</plain-text-body><p><parameter ac:name=""><a shape="rect" 
href="using-this-pattern.html">Using This Pattern</a></parameter></p></div>
         </td>
         <td valign="top">
           <div class="navigation">

Modified: websites/production/camel/content/cxf-example.html
==============================================================================
--- websites/production/camel/content/cxf-example.html (original)
+++ websites/production/camel/content/cxf-example.html Fri Aug 25 08:22:01 2017
@@ -36,17 +36,6 @@
     <![endif]-->
 
 
-  <link href='//camel.apache.org/styles/highlighter/styles/shCoreCamel.css' 
rel='stylesheet' type='text/css' />
-  <link href='//camel.apache.org/styles/highlighter/styles/shThemeCamel.css' 
rel='stylesheet' type='text/css' />
-  <script src='//camel.apache.org/styles/highlighter/scripts/shCore.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushJava.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushXml.js' 
type='text/javascript'></script>
-  <script src='//camel.apache.org/styles/highlighter/scripts/shBrushPlain.js' 
type='text/javascript'></script>
-  
-  <script type="text/javascript">
-  SyntaxHighlighter.defaults['toolbar'] = false;
-  SyntaxHighlighter.all();
-  </script>
 
     <title>
     Apache Camel: CXF Example
@@ -86,185 +75,7 @@
        <tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h1 id="CXFExample-CXFExample">CXF 
Example</h1><h2 
id="CXFExample-CXFexampleforroutingmessageswithdifferenttransports">CXF example 
for routing messages with different transports</h2><p>The <a shape="rect" 
class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/httptojms/CamelCxfExample.java?view=markup";>Camel
 CXF example</a> is a demo of the camel-cxf component to show how to route 
messages between CXF endpoints, with one endpoint consuming a SOAP over HTTP 
request while the other providing a SOAP over JMS request for the actual CXF 
Service endpoint. The Camel router just routes the SOAP over HTTP CXF client 
request to the SOAP over JMS CXF service.</p><p>To run the example see 
instructions in the <code>README.txt</code> file in the 
<code>camel-example-cxf</code> directory under <code>examples</code>.</p><p>We 
start with creating a <a shape="rect" href="camelconte
 xt.html">CamelContext</a> - which is a container for <a shape="rect" 
href="components.html">Components</a>, <a shape="rect" 
href="routes.html">Routes</a> etc:</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[
-CamelContext context = new DefaultCamelContext();
-]]></script>
-</div></div><p>Here is code for starting the JMS broker and the CXF 
server:</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[
-JmsBroker broker = new JmsBroker();
-Server server = new Server();
-try {
-    broker.start();
-    server.start();
-]]></script>
-</div></div><p>Now we setup the router for the two endpoint URIs which we 
mentioned before, ROUTER_ENDPOINT_URI is the endpoint for consuming the request 
of SOAP over HTTP, SERVICE_ENDPOINT_URI is the endpoint for providing the 
request for the SOAP over JMS service.</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[
-context.addRoutes(new RouteBuilder() {
-    public void configure() {
-        CxfComponent cxfComponent = new CxfComponent(getContext());
-        CxfEndpoint serviceEndpoint = new CxfEndpoint(SERVICE_ADDRESS, 
cxfComponent);
-        serviceEndpoint.setServiceClass(Greeter.class);
-        // Here we just pass the exception back, don&#39;t need to use 
errorHandler
-        errorHandler(noErrorHandler());
-        from(ROUTER_ENDPOINT_URI).to(serviceEndpoint);
-    }
-});
-]]></script>
-</div></div><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[
-context.start();
-Client client = new Client(address + &quot;?wsdl&quot;);
-]]></script>
-</div></div><p>Then we start up the camel context and create the CXF client to 
kick off the request.</p><h2 
id="CXFExample-CXFexampleforusingCameltransport">CXF example for using Camel 
transport</h2><p>Since Camel has lots of components and is a great mediation 
rule engine, we can leverage these Camel features in CXF by using the Camel 
transport. Here is an example to show how to use the Camel transport in 
CXF.</p><p>In this example, we setup a load balancing Camel context in the 
Camel destination.</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-&lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot;
-       xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
-       xmlns:camel=&quot;http://cxf.apache.org/transports/camel&quot;
-       xsi:schemaLocation=&quot;
-       http://www.springframework.org/schema/beans
-       http://www.springframework.org/schema/beans/spring-beans.xsd
-       http://cxf.apache.org/transports/camel 
http://cxf.apache.org/transports/camel.xsd
-       http://camel.apache.org/schema/cxf 
http://camel.apache.org/schema/cxf/cxfEndpoint.xsd
-       http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
-    &quot;&gt;
-    
-   &lt;!-- Enable bridge between Camel Property Placeholder and Spring 
Property placeholder so we can use system properties
-       to dynamically set the port number for unit testing the example.  --&gt;
-   &lt;bean id=&quot;bridgePropertyPlaceholder&quot; 
class=&quot;org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer&quot;/&gt;
-
-   &lt;bean id=&quot;roundRobinRef&quot; 
class=&quot;org.apache.camel.processor.loadbalancer.RoundRobinLoadBalancer&quot;
 /&gt;
-
-   &lt;camelContext id=&quot;dest_context&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-       &lt;route&gt;
-            &lt;from 
uri=&quot;jetty:http://localhost:{{port}}/GreeterContext/GreeterPort&quot;/&gt;
-            &lt;loadBalance&gt;
-              &lt;custom ref=&quot;roundRobinRef&quot;/&gt;
-              &lt;to uri=&quot;direct:EndpointA&quot;/&gt;
-              &lt;to uri=&quot;direct:EndpointB&quot;/&gt;
-            &lt;/loadBalance&gt;
-        &lt;/route&gt;
-   &lt;/camelContext&gt;
-
-   &lt;!-- Inject the camel context to the Camel transport&#39;s destination 
--&gt;
-   &lt;camel:destination 
name=&quot;{http://apache.org/hello_world_soap_http}CamelPort.camel-destination&quot;&gt;
-        &lt;camel:camelContextRef&gt;dest_context&lt;/camel:camelContextRef&gt;
-   &lt;/camel:destination&gt;
-
-&lt;/beans&gt;
-]]></script>
-</div></div><p>When CXF loads this configuration, it will publish the CXF 
endpoint to the Camel endpoint that is found in the Camel context.</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[
-SpringBusFactory bf = new SpringBusFactory();
-BusFactory.setDefaultBus(null);
-Bus bus = 
bf.createBus(&quot;/org/apache/camel/example/camel/transport/CamelDestination.xml&quot;);
-BusFactory.setDefaultBus(bus);
-]]></script>
-</div></div><p>The code below shows how to publish the endpoint to different 
Camel context endpoints. You can specify the Camel endpoint URI as the endpoint 
address parameter.</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[
-GreeterImpl implementor = new GreeterImpl();
-implementor.setSuffix(&quot;EndpointA&quot;);
-String address = &quot;camel://direct:EndpointA&quot;;
-endpointA = Endpoint.publish(address, implementor);
-
-implementor = new GreeterImpl();
-implementor.setSuffix(&quot;EndpointB&quot;);
-address = &quot;camel://direct:EndpointB&quot;;
-endpointB = Endpoint.publish(address, implementor);
-]]></script>
-</div></div><h2 id="CXFExample-CXFexampleforusingtheWebServiceProviderAPI">CXF 
example for using the WebServiceProvider API</h2><p>JAX-WS provides the 
WebServiceProvider API to meet the requirements of XML-level message handling. 
This example shows how to route a SOAP Message from a WebServiceProvider 
implementation to bean endpoint in the Camel context. Basically, we still pass 
the WebServiceProvider implementor as SEI, and the CxfConsumer will pass the 
SOAP Message in a list of parameters to the Camel router for further 
processing.</p><p>First, let's have a look at the Camel context's 
configuration. Here we start a CxfConsumer to listen to the address and pass 
SOAP messages to the test bean.</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="brush: xml; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-
-&lt;!--
-If you want to run this example in a Tomcat container which needs the servlet 
transport,
-please replace the cxf-extension-http-jetty.xml with cxf-servlet.xml
---&gt;
-
-&lt;bean id=&quot;testBean&quot; 
class=&quot;org.apache.camel.example.cxf.provider.TesterBean&quot;/&gt;
-
-&lt;cxf:cxfEndpoint id=&quot;soapMessageEndpoint&quot;
-                 
serviceClass=&quot;org.apache.camel.example.cxf.provider.GreeterProvider&quot;
-                 
address=&quot;http://localhost:{{port}}/GreeterContext/SOAPMessageService&quot;
-                 wsdlURL=&quot;wsdl/hello_world.wsdl&quot;
-                 endpointName=&quot;s:SoapOverHttpRouter&quot;
-                 serviceName=&quot;s:SOAPService&quot;
-                 
xmlns:s=&quot;http://apache.org/hello_world_soap_http&quot;/&gt;
-
-
-&lt;camelContext id=&quot;test_context&quot; 
xmlns=&quot;http://camel.apache.org/schema/spring&quot;&gt;
-  &lt;route&gt;
-    &lt;from uri=&quot;cxf:bean:soapMessageEndpoint&quot;/&gt;
-    &lt;to uri=&quot;bean:testBean?method=processSOAP&quot;/&gt;
-  &lt;/route&gt;
-&lt;/camelContext&gt;
-
-]]></script>
-</div></div><p>Below is the WebServiceProvider implementor's annotation. In 
this code, we just want to handle SOAPMessages in the Message mode:</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[
-@WebServiceProvider()
-@ServiceMode(Mode.MESSAGE)
-]]></script>
-</div></div><p>Since the CXF-Camel component will replace the CXF invoker to 
call the processor when starting a CXF endpoint, the CXF-Camel consumer will 
never call the provider implementor's invoke method here.</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[
-public class GreeterProvider implements Provider&lt;SOAPMessage&gt; {
-
-    public SOAPMessage invoke(SOAPMessage message) {
-        // Requests should not come here as the Camel route will
-        // intercept the call before this is invoked.
-        throw new UnsupportedOperationException(&quot;Placeholder 
method&quot;);
-    }
-
-}
-]]></script>
-</div></div><p>Now we can implement the bean for handling the invocation of 
the SOAP message:</p><div class="code panel pdl" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
-<script class="brush: java; gutter: false; theme: Default" 
type="syntaxhighlighter"><![CDATA[
-public class TesterBean {
-
-    public SOAPMessage processSOAP(Exchange exchange) {
-        // Since the Camel-CXF endpoint uses a list to store the parameters
-        // and bean component uses the bodyAs expression to get the value
-        // we&#39;ll need to deal with the parameters ourself
-        SOAPMessage soapMessage = 
(SOAPMessage)exchange.getIn().getBody(List.class).get(0);
-        if (soapMessage == null) {
-            System.out.println(&quot;Incoming null message detected...&quot;);
-            return createDefaultSoapMessage(&quot;Greetings from Apache 
Camel!!!!&quot;, &quot;null&quot;);
-        }
-
-        try {
-            SOAPPart sp = soapMessage.getSOAPPart();
-            SOAPEnvelope se = sp.getEnvelope();
-            SOAPBody sb = se.getBody();
-            String requestText = sb.getFirstChild().getTextContent();
-            System.out.println(requestText);
-            return createDefaultSoapMessage(&quot;Greetings from Apache 
Camel!!!!&quot;, requestText);
-        } catch (Exception e) {
-            e.printStackTrace();
-            return createDefaultSoapMessage(&quot;Greetings from Apache 
Camel!!!!&quot;, e.getClass().getName());
-        }
-    }
-
-    public static SOAPMessage createDefaultSoapMessage(String responseMessage, 
String requestMessage) {
-        try {
-            SOAPMessage soapMessage = 
MessageFactory.newInstance().createMessage();
-            SOAPBody body = soapMessage.getSOAPPart().getEnvelope().getBody();
-
-            QName payloadName = new 
QName(&quot;http://apache.org/hello_world_soap_http/types&quot;, 
&quot;greetMeResponse&quot;, &quot;ns1&quot;);
-
-            SOAPBodyElement payload = body.addBodyElement(payloadName);
-
-            SOAPElement message = 
payload.addChildElement(&quot;responseType&quot;);
-
-            message.addTextNode(responseMessage + &quot; Request was  &quot; + 
requestMessage);
-            return soapMessage;
-        } catch (SOAPException e) {
-            e.printStackTrace();
-            throw new RuntimeException(e);
-        }
-    }
-
-}
-]]></script>
-</div></div></div>
+<div class="wiki-content maincontent"><h1 id="CXFExample-CXFExample">CXF 
Example</h1><h2 
id="CXFExample-CXFexampleforroutingmessageswithdifferenttransports">CXF example 
for routing messages with different transports</h2><p>The <a shape="rect" 
class="external-link" 
href="http://svn.apache.org/viewvc/camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/httptojms/CamelCxfExample.java?view=markup";>Camel
 CXF example</a> is a demo of the camel-cxf component to show how to route 
messages between CXF endpoints, with one endpoint consuming a SOAP over HTTP 
request while the other providing a SOAP over JMS request for the actual CXF 
Service endpoint. The Camel router just routes the SOAP over HTTP CXF client 
request to the SOAP over JMS CXF service.</p><p>To run the example see 
instructions in the <code>README.txt</code> file in the 
<code>camel-example-cxf</code> directory under <code>examples</code>.</p><p>We 
start with creating a <a shape="rect" href="camelconte
 xt.html">CamelContext</a> - which is a container for <a shape="rect" 
href="components.html">Components</a>, <a shape="rect" 
href="routes.html">Routes</a> 
etc:</p><plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/httptojms/CamelCxfExample.java}</plain-text-body><p>Here
 is code for starting the JMS broker and the CXF 
server:</p><plain-text-body>{snippet:id=e2|lang=java|url=camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/httptojms/CamelCxfExample.java}</plain-text-body><p>Now
 we setup the router for the two endpoint URIs which we mentioned before, 
ROUTER_ENDPOINT_URI is the endpoint for consuming the request of SOAP over 
HTTP, SERVICE_ENDPOINT_URI is the endpoint for providing the request for the 
SOAP over JMS 
service.</p><plain-text-body>{snippet:id=e3|lang=java|url=camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/httptojms/CamelCxfExample.ja
 
va}</plain-text-body><plain-text-body>{snippet:id=e4|lang=java|url=camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/httptojms/CamelCxfExample.java}</plain-text-body><p>Then
 we start up the camel context and create the CXF client to kick off the 
request.</p><h2 id="CXFExample-CXFexampleforusingCameltransport">CXF example 
for using Camel transport</h2><p>Since Camel has lots of components and is a 
great mediation rule engine, we can leverage these Camel features in CXF by 
using the Camel transport. Here is an example to show how to use the Camel 
transport in CXF.</p><p>In this example, we setup a load balancing Camel 
context in the Camel 
destination.</p><plain-text-body>{snippet:id=example|lang=xml|url=camel/trunk/examples/camel-example-cxf/src/main/resources/org/apache/camel/example/camel/transport/CamelDestination.xml}</plain-text-body><p>When
 CXF loads this configuration, it will publish the CXF endpoint to the Camel 
endpoint that is found in the Ca
 mel 
context.</p><plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/camel/transport/Server.java}</plain-text-body><p>The
 code below shows how to publish the endpoint to different Camel context 
endpoints. You can specify the Camel endpoint URI as the endpoint address 
parameter.</p><plain-text-body>{snippet:id=e2|lang=java|url=camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/camel/transport/Server.java}</plain-text-body><h2
 id="CXFExample-CXFexampleforusingtheWebServiceProviderAPI">CXF example for 
using the WebServiceProvider API</h2><p>JAX-WS provides the WebServiceProvider 
API to meet the requirements of XML-level message handling. This example shows 
how to route a SOAP Message from a WebServiceProvider implementation to bean 
endpoint in the Camel context. Basically, we still pass the WebServiceProvider 
implementor as SEI, and the CxfConsumer will pass the SOAP Message in a list of 
p
 arameters to the Camel router for further processing.</p><p>First, let's have 
a look at the Camel context's configuration. Here we start a CxfConsumer to 
listen to the address and pass SOAP messages to the test 
bean.</p><plain-text-body>{snippet:id=example|lang=xml|url=camel/trunk/examples/camel-example-cxf/src/main/resources/META-INF/spring/CamelCXFProviderRouteConfig.xml}</plain-text-body><p>Below
 is the WebServiceProvider implementor's annotation. In this code, we just want 
to handle SOAPMessages in the Message 
mode:</p><plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/provider/GreeterProvider.java}</plain-text-body><p>Since
 the CXF-Camel component will replace the CXF invoker to call the processor 
when starting a CXF endpoint, the CXF-Camel consumer will never call the 
provider implementor's invoke method 
here.</p><plain-text-body>{snippet:id=e2|lang=java|url=camel/trunk/examples/camel-example-cxf/src/
 
main/java/org/apache/camel/example/cxf/provider/GreeterProvider.java}</plain-text-body><p>Now
 we can implement the bean for handling the invocation of the SOAP 
message:</p><plain-text-body>{snippet:id=e1|lang=java|url=camel/trunk/examples/camel-example-cxf/src/main/java/org/apache/camel/example/cxf/provider/TesterBean.java}</plain-text-body></div>
         </td>
         <td valign="top">
           <div class="navigation">


Reply via email to