Author: buildbot
Date: Tue May 1 08:21:06 2012
New Revision: 815256
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/book-in-one-page.html
websites/production/camel/content/book-pattern-appendix.html
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/composed-message-processor.html
Modified: websites/production/camel/content/book-in-one-page.html
==============================================================================
--- websites/production/camel/content/book-in-one-page.html (original)
+++ websites/production/camel/content/book-in-one-page.html Tue May 1 08:21:06
2012
@@ -16897,9 +16897,14 @@ from(<span class="code-quote">"direct:st
<p><span class="image-wrap" style=""><img
src="http://www.enterpriseintegrationpatterns.com/img/DistributionAggregate.gif"
style="border: 0px solid black"></span></p>
-<p>Available in Camel 1.5.</p>
+<p>In Camel we have two solutions</p>
+<ul class="alternate" type="square"><li>using both a <a shape="rect"
href="splitter.html" title="Splitter">Splitter</a> and <a shape="rect"
href="aggregator2.html" title="Aggregator2">Aggregator</a> EIPs</li><li>using
only a <a shape="rect" href="splitter.html"
title="Splitter">Splitter</a></li></ul>
-<h4><a shape="rect" name="BookInOnePage-Example"></a>Example</h4>
+
+<p>The difference is when only using a <a shape="rect" href="splitter.html"
title="Splitter">Splitter</a> then it aggregates back all the splitted messages
into the samme aggregation group, eg like a fork/join pattern.<br clear="none">
+Where as using the <a shape="rect" href="aggregator2.html"
title="Aggregator2">Aggregator</a> allows you group into multiple groups, and
the pattern has more options.</p>
+
+<h3><a shape="rect"
name="BookInOnePage-ExampleusingbothSplitterandAggregator"></a>Example using
both Splitter and Aggregator</h3>
<p>In this example we want to check that a multipart order can be filled. Each
part of the order requires a check at a different inventory.</p>
@@ -16963,6 +16968,95 @@ from(<span class="code-quote">"direct:st
<p><a shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ComposedMessageProcessorTest.java">camel-core/src/test/java/org/apache/camel/processor/ComposedMessageProcessorTest.java</a></p>
+<h3><a shape="rect" name="BookInOnePage-ExampleusingonlySplitter"></a>Example
using only Splitter</h3>
+
+<p>In this example we want to split an incoming order using the <a
shape="rect" href="splitter.html" title="Splitter">Splitter</a> eip, transform
each order line, and then combine the order lines into a new order message.</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java"><span class="code-comment">// <span
class="code-keyword">this</span> routes starts from the direct:start endpoint
+</span><span class="code-comment">// the body is then splitted based on @
separator
+</span><span class="code-comment">// the splitter in Camel supports InOut as
well and <span class="code-keyword">for</span> that we need
+</span><span class="code-comment">// to be able to aggregate what response we
need to send back, so we provide our
+</span><span class="code-comment">// own strategy with the class
MyOrderStrategy.
+</span>from(<span class="code-quote">"direct:start"</span>)
+ .split(body().tokenize(<span class="code-quote">"@"</span>), <span
class="code-keyword">new</span> MyOrderStrategy())
+ <span class="code-comment">// each splitted message is then send to
<span class="code-keyword">this</span> bean where we can process it
+</span> .to(<span
class="code-quote">"bean:MyOrderService?method=handleOrder"</span>)
+ <span class="code-comment">// <span class="code-keyword">this</span>
is important to end the splitter route as we <span
class="code-keyword">do</span> not want to <span class="code-keyword">do</span>
more routing
+</span> <span class="code-comment">// on each splitted message
+</span> .end()
+ <span class="code-comment">// after we have splitted and handled each
message we want to send a single combined
+</span> <span class="code-comment">// response back to the original caller,
so we let <span class="code-keyword">this</span> bean build it <span
class="code-keyword">for</span> us
+</span> <span class="code-comment">// <span
class="code-keyword">this</span> bean will receive the result of the aggregate
strategy: MyOrderStrategy
+</span> .to(<span
class="code-quote">"bean:MyOrderService?method=buildCombinedResponse"</span>)
+</pre>
+</div></div>
+
+<div class="panelMacro"><table class="tipMacro"><colgroup span="1"><col
span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1"
valign="top"><img align="middle"
src="https://cwiki.apache.org/confluence/images/icons/emoticons/check.gif"
width="16" height="16" alt="" border="0"></td><td colspan="1"
rowspan="1"><b>Using XML</b><br clear="none">If you use XML, then the
<split> tag offers the strategyReg attribute to refer to your custom
<tt>AggregationStrategy</tt></td></tr></table></div>
+
+<p>The bean with the methods to transform the order line and process the order
as well:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java"><span class="code-keyword">public</span> <span
class="code-keyword">static</span> class MyOrderService {
+
+ <span class="code-keyword">private</span> <span
class="code-keyword">static</span> <span class="code-object">int</span> counter;
+
+ /**
+ * We just handle the order by returning a id line <span
class="code-keyword">for</span> the order
+ */
+ <span class="code-keyword">public</span> <span
class="code-object">String</span> handleOrder(<span
class="code-object">String</span> line) {
+ LOG.debug(<span class="code-quote">"HandleOrder: "</span> + line);
+ <span class="code-keyword">return</span> <span
class="code-quote">"(id="</span> + ++counter + <span
class="code-quote">",item="</span> + line + <span class="code-quote">")"</span>;
+ }
+
+ /**
+ * We use the same bean <span class="code-keyword">for</span> building the
combined response to send
+ * back to the original caller
+ */
+ <span class="code-keyword">public</span> <span
class="code-object">String</span> buildCombinedResponse(<span
class="code-object">String</span> line) {
+ LOG.debug(<span class="code-quote">"BuildCombinedResponse: "</span> +
line);
+ <span class="code-keyword">return</span> <span
class="code-quote">"Response["</span> + line + <span
class="code-quote">"]"</span>;
+ }
+}
+</pre>
+</div></div>
+
+<p>And the <tt>AggregationStrategy</tt> we use with the <a shape="rect"
href="splitter.html" title="Splitter">Splitter</a> eip to combine the orders
back again (eg fork/join):</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">/**
+ * This is our own order aggregation strategy where we can control
+ * how each splitted message should be combined. As we <span
class="code-keyword">do</span> not want to
+ * loos any message we copy from the <span class="code-keyword">new</span> to
the old to preserve the
+ * order lines as <span class="code-object">long</span> we process them
+ */
+<span class="code-keyword">public</span> <span
class="code-keyword">static</span> class MyOrderStrategy <span
class="code-keyword">implements</span> AggregationStrategy {
+
+ <span class="code-keyword">public</span> Exchange aggregate(Exchange
oldExchange, Exchange newExchange) {
+ <span class="code-comment">// put order together in old exchange by
adding the order from <span class="code-keyword">new</span> exchange
+</span>
+ <span class="code-keyword">if</span> (oldExchange == <span
class="code-keyword">null</span>) {
+ <span class="code-comment">// the first time we aggregate we only
have the <span class="code-keyword">new</span> exchange,
+</span> <span class="code-comment">// so we just <span
class="code-keyword">return</span> it
+</span> <span class="code-keyword">return</span> newExchange;
+ }
+
+ <span class="code-object">String</span> orders =
oldExchange.getIn().getBody(<span class="code-object">String</span>.class);
+ <span class="code-object">String</span> newLine =
newExchange.getIn().getBody(<span class="code-object">String</span>.class);
+
+ LOG.debug(<span class="code-quote">"Aggregate old orders: "</span> +
orders);
+ LOG.debug(<span class="code-quote">"Aggregate <span
class="code-keyword">new</span> order: "</span> + newLine);
+
+ <span class="code-comment">// put orders together separating by semi
colon
+</span> orders = orders + <span class="code-quote">";"</span> + newLine;
+ <span class="code-comment">// put combined order back on old to
preserve it
+</span> oldExchange.getIn().setBody(orders);
+
+ <span class="code-comment">// <span class="code-keyword">return</span>
old as <span class="code-keyword">this</span> is the one that has all the
orders gathered until now
+</span> <span class="code-keyword">return</span> oldExchange;
+ }
+}
+</pre>
+</div></div>
+
+
<h4><a shape="rect" name="BookInOnePage-UsingThisPattern"></a>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" title="Getting Started">Getting
Started</a>, you may also find the <a shape="rect" href="architecture.html"
title="Architecture">Architecture</a> useful particularly the description of <a
shape="rect" href="endpoint.html" title="Endpoint">Endpoint</a> and <a
shape="rect" href="uris.html" title="URIs">URIs</a>. Then you could try out
some of the <a shape="rect" href="examples.html" title="Examples">Examples</a>
first before trying this pattern out.</p>
Modified: websites/production/camel/content/book-pattern-appendix.html
==============================================================================
--- websites/production/camel/content/book-pattern-appendix.html (original)
+++ websites/production/camel/content/book-pattern-appendix.html Tue May 1
08:21:06 2012
@@ -2749,9 +2749,14 @@ from(<span class="code-quote">"direct:st
<p><span class="image-wrap" style=""><img
src="http://www.enterpriseintegrationpatterns.com/img/DistributionAggregate.gif"
style="border: 0px solid black"></span></p>
-<p>Available in Camel 1.5.</p>
+<p>In Camel we have two solutions</p>
+<ul class="alternate" type="square"><li>using both a <a shape="rect"
href="splitter.html" title="Splitter">Splitter</a> and <a shape="rect"
href="aggregator2.html" title="Aggregator2">Aggregator</a> EIPs</li><li>using
only a <a shape="rect" href="splitter.html"
title="Splitter">Splitter</a></li></ul>
-<h4><a shape="rect" name="BookPatternAppendix-Example"></a>Example</h4>
+
+<p>The difference is when only using a <a shape="rect" href="splitter.html"
title="Splitter">Splitter</a> then it aggregates back all the splitted messages
into the samme aggregation group, eg like a fork/join pattern.<br clear="none">
+Where as using the <a shape="rect" href="aggregator2.html"
title="Aggregator2">Aggregator</a> allows you group into multiple groups, and
the pattern has more options.</p>
+
+<h3><a shape="rect"
name="BookPatternAppendix-ExampleusingbothSplitterandAggregator"></a>Example
using both Splitter and Aggregator</h3>
<p>In this example we want to check that a multipart order can be filled. Each
part of the order requires a check at a different inventory.</p>
@@ -2815,6 +2820,95 @@ from(<span class="code-quote">"direct:st
<p><a shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ComposedMessageProcessorTest.java">camel-core/src/test/java/org/apache/camel/processor/ComposedMessageProcessorTest.java</a></p>
+<h3><a shape="rect"
name="BookPatternAppendix-ExampleusingonlySplitter"></a>Example using only
Splitter</h3>
+
+<p>In this example we want to split an incoming order using the <a
shape="rect" href="splitter.html" title="Splitter">Splitter</a> eip, transform
each order line, and then combine the order lines into a new order message.</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java"><span class="code-comment">// <span
class="code-keyword">this</span> routes starts from the direct:start endpoint
+</span><span class="code-comment">// the body is then splitted based on @
separator
+</span><span class="code-comment">// the splitter in Camel supports InOut as
well and <span class="code-keyword">for</span> that we need
+</span><span class="code-comment">// to be able to aggregate what response we
need to send back, so we provide our
+</span><span class="code-comment">// own strategy with the class
MyOrderStrategy.
+</span>from(<span class="code-quote">"direct:start"</span>)
+ .split(body().tokenize(<span class="code-quote">"@"</span>), <span
class="code-keyword">new</span> MyOrderStrategy())
+ <span class="code-comment">// each splitted message is then send to
<span class="code-keyword">this</span> bean where we can process it
+</span> .to(<span
class="code-quote">"bean:MyOrderService?method=handleOrder"</span>)
+ <span class="code-comment">// <span class="code-keyword">this</span>
is important to end the splitter route as we <span
class="code-keyword">do</span> not want to <span class="code-keyword">do</span>
more routing
+</span> <span class="code-comment">// on each splitted message
+</span> .end()
+ <span class="code-comment">// after we have splitted and handled each
message we want to send a single combined
+</span> <span class="code-comment">// response back to the original caller,
so we let <span class="code-keyword">this</span> bean build it <span
class="code-keyword">for</span> us
+</span> <span class="code-comment">// <span
class="code-keyword">this</span> bean will receive the result of the aggregate
strategy: MyOrderStrategy
+</span> .to(<span
class="code-quote">"bean:MyOrderService?method=buildCombinedResponse"</span>)
+</pre>
+</div></div>
+
+<div class="panelMacro"><table class="tipMacro"><colgroup span="1"><col
span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1"
valign="top"><img align="middle"
src="https://cwiki.apache.org/confluence/images/icons/emoticons/check.gif"
width="16" height="16" alt="" border="0"></td><td colspan="1"
rowspan="1"><b>Using XML</b><br clear="none">If you use XML, then the
<split> tag offers the strategyReg attribute to refer to your custom
<tt>AggregationStrategy</tt></td></tr></table></div>
+
+<p>The bean with the methods to transform the order line and process the order
as well:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java"><span class="code-keyword">public</span> <span
class="code-keyword">static</span> class MyOrderService {
+
+ <span class="code-keyword">private</span> <span
class="code-keyword">static</span> <span class="code-object">int</span> counter;
+
+ /**
+ * We just handle the order by returning a id line <span
class="code-keyword">for</span> the order
+ */
+ <span class="code-keyword">public</span> <span
class="code-object">String</span> handleOrder(<span
class="code-object">String</span> line) {
+ LOG.debug(<span class="code-quote">"HandleOrder: "</span> + line);
+ <span class="code-keyword">return</span> <span
class="code-quote">"(id="</span> + ++counter + <span
class="code-quote">",item="</span> + line + <span class="code-quote">")"</span>;
+ }
+
+ /**
+ * We use the same bean <span class="code-keyword">for</span> building the
combined response to send
+ * back to the original caller
+ */
+ <span class="code-keyword">public</span> <span
class="code-object">String</span> buildCombinedResponse(<span
class="code-object">String</span> line) {
+ LOG.debug(<span class="code-quote">"BuildCombinedResponse: "</span> +
line);
+ <span class="code-keyword">return</span> <span
class="code-quote">"Response["</span> + line + <span
class="code-quote">"]"</span>;
+ }
+}
+</pre>
+</div></div>
+
+<p>And the <tt>AggregationStrategy</tt> we use with the <a shape="rect"
href="splitter.html" title="Splitter">Splitter</a> eip to combine the orders
back again (eg fork/join):</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">/**
+ * This is our own order aggregation strategy where we can control
+ * how each splitted message should be combined. As we <span
class="code-keyword">do</span> not want to
+ * loos any message we copy from the <span class="code-keyword">new</span> to
the old to preserve the
+ * order lines as <span class="code-object">long</span> we process them
+ */
+<span class="code-keyword">public</span> <span
class="code-keyword">static</span> class MyOrderStrategy <span
class="code-keyword">implements</span> AggregationStrategy {
+
+ <span class="code-keyword">public</span> Exchange aggregate(Exchange
oldExchange, Exchange newExchange) {
+ <span class="code-comment">// put order together in old exchange by
adding the order from <span class="code-keyword">new</span> exchange
+</span>
+ <span class="code-keyword">if</span> (oldExchange == <span
class="code-keyword">null</span>) {
+ <span class="code-comment">// the first time we aggregate we only
have the <span class="code-keyword">new</span> exchange,
+</span> <span class="code-comment">// so we just <span
class="code-keyword">return</span> it
+</span> <span class="code-keyword">return</span> newExchange;
+ }
+
+ <span class="code-object">String</span> orders =
oldExchange.getIn().getBody(<span class="code-object">String</span>.class);
+ <span class="code-object">String</span> newLine =
newExchange.getIn().getBody(<span class="code-object">String</span>.class);
+
+ LOG.debug(<span class="code-quote">"Aggregate old orders: "</span> +
orders);
+ LOG.debug(<span class="code-quote">"Aggregate <span
class="code-keyword">new</span> order: "</span> + newLine);
+
+ <span class="code-comment">// put orders together separating by semi
colon
+</span> orders = orders + <span class="code-quote">";"</span> + newLine;
+ <span class="code-comment">// put combined order back on old to
preserve it
+</span> oldExchange.getIn().setBody(orders);
+
+ <span class="code-comment">// <span class="code-keyword">return</span>
old as <span class="code-keyword">this</span> is the one that has all the
orders gathered until now
+</span> <span class="code-keyword">return</span> oldExchange;
+ }
+}
+</pre>
+</div></div>
+
+
<h4><a shape="rect" name="BookPatternAppendix-UsingThisPattern"></a>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" title="Getting Started">Getting
Started</a>, you may also find the <a shape="rect" href="architecture.html"
title="Architecture">Architecture</a> useful particularly the description of <a
shape="rect" href="endpoint.html" title="Endpoint">Endpoint</a> and <a
shape="rect" href="uris.html" title="URIs">URIs</a>. Then you could try out
some of the <a shape="rect" href="examples.html" title="Examples">Examples</a>
first before trying this pattern out.</p>
Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/camel/content/composed-message-processor.html
==============================================================================
--- websites/production/camel/content/composed-message-processor.html (original)
+++ websites/production/camel/content/composed-message-processor.html Tue May
1 08:21:06 2012
@@ -81,9 +81,14 @@
<p><span class="image-wrap" style=""><img
src="http://www.enterpriseintegrationpatterns.com/img/DistributionAggregate.gif"
style="border: 0px solid black"></span></p>
-<p>Available in Camel 1.5.</p>
+<p>In Camel we have two solutions</p>
+<ul class="alternate" type="square"><li>using both a <a shape="rect"
href="splitter.html" title="Splitter">Splitter</a> and <a shape="rect"
href="aggregator2.html" title="Aggregator2">Aggregator</a> EIPs</li><li>using
only a <a shape="rect" href="splitter.html"
title="Splitter">Splitter</a></li></ul>
-<h4><a shape="rect" name="ComposedMessageProcessor-Example"></a>Example</h4>
+
+<p>The difference is when only using a <a shape="rect" href="splitter.html"
title="Splitter">Splitter</a> then it aggregates back all the splitted messages
into the samme aggregation group, eg like a fork/join pattern.<br clear="none">
+Where as using the <a shape="rect" href="aggregator2.html"
title="Aggregator2">Aggregator</a> allows you group into multiple groups, and
the pattern has more options.</p>
+
+<h3><a shape="rect"
name="ComposedMessageProcessor-ExampleusingbothSplitterandAggregator"></a>Example
using both Splitter and Aggregator</h3>
<p>In this example we want to check that a multipart order can be filled. Each
part of the order requires a check at a different inventory.</p>
@@ -147,6 +152,95 @@
<p><a shape="rect" class="external-link"
href="http://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ComposedMessageProcessorTest.java">camel-core/src/test/java/org/apache/camel/processor/ComposedMessageProcessorTest.java</a></p>
+<h3><a shape="rect"
name="ComposedMessageProcessor-ExampleusingonlySplitter"></a>Example using only
Splitter</h3>
+
+<p>In this example we want to split an incoming order using the <a
shape="rect" href="splitter.html" title="Splitter">Splitter</a> eip, transform
each order line, and then combine the order lines into a new order message.</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java"><span class="code-comment">// <span
class="code-keyword">this</span> routes starts from the direct:start endpoint
+</span><span class="code-comment">// the body is then splitted based on @
separator
+</span><span class="code-comment">// the splitter in Camel supports InOut as
well and <span class="code-keyword">for</span> that we need
+</span><span class="code-comment">// to be able to aggregate what response we
need to send back, so we provide our
+</span><span class="code-comment">// own strategy with the class
MyOrderStrategy.
+</span>from(<span class="code-quote">"direct:start"</span>)
+ .split(body().tokenize(<span class="code-quote">"@"</span>), <span
class="code-keyword">new</span> MyOrderStrategy())
+ <span class="code-comment">// each splitted message is then send to
<span class="code-keyword">this</span> bean where we can process it
+</span> .to(<span
class="code-quote">"bean:MyOrderService?method=handleOrder"</span>)
+ <span class="code-comment">// <span class="code-keyword">this</span>
is important to end the splitter route as we <span
class="code-keyword">do</span> not want to <span class="code-keyword">do</span>
more routing
+</span> <span class="code-comment">// on each splitted message
+</span> .end()
+ <span class="code-comment">// after we have splitted and handled each
message we want to send a single combined
+</span> <span class="code-comment">// response back to the original caller,
so we let <span class="code-keyword">this</span> bean build it <span
class="code-keyword">for</span> us
+</span> <span class="code-comment">// <span
class="code-keyword">this</span> bean will receive the result of the aggregate
strategy: MyOrderStrategy
+</span> .to(<span
class="code-quote">"bean:MyOrderService?method=buildCombinedResponse"</span>)
+</pre>
+</div></div>
+
+<div class="panelMacro"><table class="tipMacro"><colgroup span="1"><col
span="1" width="24"><col span="1"></colgroup><tr><td colspan="1" rowspan="1"
valign="top"><img align="middle"
src="https://cwiki.apache.org/confluence/images/icons/emoticons/check.gif"
width="16" height="16" alt="" border="0"></td><td colspan="1"
rowspan="1"><b>Using XML</b><br clear="none">If you use XML, then the
<split> tag offers the strategyReg attribute to refer to your custom
<tt>AggregationStrategy</tt></td></tr></table></div>
+
+<p>The bean with the methods to transform the order line and process the order
as well:</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java"><span class="code-keyword">public</span> <span
class="code-keyword">static</span> class MyOrderService {
+
+ <span class="code-keyword">private</span> <span
class="code-keyword">static</span> <span class="code-object">int</span> counter;
+
+ /**
+ * We just handle the order by returning a id line <span
class="code-keyword">for</span> the order
+ */
+ <span class="code-keyword">public</span> <span
class="code-object">String</span> handleOrder(<span
class="code-object">String</span> line) {
+ LOG.debug(<span class="code-quote">"HandleOrder: "</span> + line);
+ <span class="code-keyword">return</span> <span
class="code-quote">"(id="</span> + ++counter + <span
class="code-quote">",item="</span> + line + <span class="code-quote">")"</span>;
+ }
+
+ /**
+ * We use the same bean <span class="code-keyword">for</span> building the
combined response to send
+ * back to the original caller
+ */
+ <span class="code-keyword">public</span> <span
class="code-object">String</span> buildCombinedResponse(<span
class="code-object">String</span> line) {
+ LOG.debug(<span class="code-quote">"BuildCombinedResponse: "</span> +
line);
+ <span class="code-keyword">return</span> <span
class="code-quote">"Response["</span> + line + <span
class="code-quote">"]"</span>;
+ }
+}
+</pre>
+</div></div>
+
+<p>And the <tt>AggregationStrategy</tt> we use with the <a shape="rect"
href="splitter.html" title="Splitter">Splitter</a> eip to combine the orders
back again (eg fork/join):</p>
+<div class="code panel" style="border-width: 1px;"><div class="codeContent
panelContent">
+<pre class="code-java">/**
+ * This is our own order aggregation strategy where we can control
+ * how each splitted message should be combined. As we <span
class="code-keyword">do</span> not want to
+ * loos any message we copy from the <span class="code-keyword">new</span> to
the old to preserve the
+ * order lines as <span class="code-object">long</span> we process them
+ */
+<span class="code-keyword">public</span> <span
class="code-keyword">static</span> class MyOrderStrategy <span
class="code-keyword">implements</span> AggregationStrategy {
+
+ <span class="code-keyword">public</span> Exchange aggregate(Exchange
oldExchange, Exchange newExchange) {
+ <span class="code-comment">// put order together in old exchange by
adding the order from <span class="code-keyword">new</span> exchange
+</span>
+ <span class="code-keyword">if</span> (oldExchange == <span
class="code-keyword">null</span>) {
+ <span class="code-comment">// the first time we aggregate we only
have the <span class="code-keyword">new</span> exchange,
+</span> <span class="code-comment">// so we just <span
class="code-keyword">return</span> it
+</span> <span class="code-keyword">return</span> newExchange;
+ }
+
+ <span class="code-object">String</span> orders =
oldExchange.getIn().getBody(<span class="code-object">String</span>.class);
+ <span class="code-object">String</span> newLine =
newExchange.getIn().getBody(<span class="code-object">String</span>.class);
+
+ LOG.debug(<span class="code-quote">"Aggregate old orders: "</span> +
orders);
+ LOG.debug(<span class="code-quote">"Aggregate <span
class="code-keyword">new</span> order: "</span> + newLine);
+
+ <span class="code-comment">// put orders together separating by semi
colon
+</span> orders = orders + <span class="code-quote">";"</span> + newLine;
+ <span class="code-comment">// put combined order back on old to
preserve it
+</span> oldExchange.getIn().setBody(orders);
+
+ <span class="code-comment">// <span class="code-keyword">return</span>
old as <span class="code-keyword">this</span> is the one that has all the
orders gathered until now
+</span> <span class="code-keyword">return</span> oldExchange;
+ }
+}
+</pre>
+</div></div>
+
+
<h4><a shape="rect" name="ComposedMessageProcessor-UsingThisPattern"></a>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" title="Getting Started">Getting
Started</a>, you may also find the <a shape="rect" href="architecture.html"
title="Architecture">Architecture</a> useful particularly the description of <a
shape="rect" href="endpoint.html" title="Endpoint">Endpoint</a> and <a
shape="rect" href="uris.html" title="URIs">URIs</a>. Then you could try out
some of the <a shape="rect" href="examples.html" title="Examples">Examples</a>
first before trying this pattern out.</p></div>