Author: buildbot Date: Tue Aug 20 09:19:34 2013 New Revision: 875443 Log: Production update by buildbot for camel
Modified: websites/production/camel/content/aggregator2.html websites/production/camel/content/book-in-one-page.html websites/production/camel/content/book-pattern-appendix.html websites/production/camel/content/cache/main.pageCache Modified: websites/production/camel/content/aggregator2.html ============================================================================== --- websites/production/camel/content/aggregator2.html (original) +++ websites/production/camel/content/aggregator2.html Tue Aug 20 09:19:34 2013 @@ -571,6 +571,49 @@ public class MyBodyAppender { <p>When using XML DSL you must define the POJO as a <bean>.</p> +<h4><a shape="rect" name="Aggregator2-Aggregatingwhennodata"></a>Aggregating when no data</h4> + +<p>By default when using POJOs as AggregationStrategy, then the method is <b>only</b> invoked when there is data to be aggregated. Where as without using POJOs then you may have <tt>null</tt> as <tt>oldExchange</tt> or <tt>newExchange</tt> parameters. </p> + +<p>For example the <a shape="rect" href="aggregator2.html" title="Aggregator2">Aggregate</a> EIP will invoke the <tt>AggregationStrategy</tt> with <tt>oldExchange</tt> as null, for the first <a shape="rect" href="exchange.html" title="Exchange">Exchange</a> incoming to the aggregator. And then for subsequent <a shape="rect" href="exchange.html" title="Exchange">Exchange</a>s then <tt>oldExchange</tt> and <tt>newExchange</tt> parameters are both not null. </p> + +<h5><a shape="rect" name="Aggregator2-ExamplewithContentEnricherandnodata"></a>Example with <a shape="rect" href="content-enricher.html" title="Content Enricher">Content Enricher</a> and no data</h5> +<p>Though with POJOs as AggregationStrategy we made this simpler and only call the method when <tt>oldExchange</tt> and <tt>newExchange</tt> is not null, as that would be the most common use-case. If you need to allow <tt>oldExchange</tt> or <tt>newExchange</tt> to be null, then you can configure this with the POJO using the <tt>AggregationStrategyBeanAdapter</tt> as shown below. On the bean adapter we call <tt>setAllowNullNewExchange</tt> to allow the new exchange to be null.</p> + +<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> +<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ + public void configure() throws Exception { + AggregationStrategyBeanAdapter myStrategy = new AggregationStrategyBeanAdapter(appender, "append"); + myStrategy.setAllowNullNewExchange(true); + + from("direct:start") + .pollEnrich("seda:foo", 1000, myStrategy) + .to("mock:result"); + } +]]></script> +</div></div> + +<p>Then the <tt>append</tt> method in the POJO would need to deal with the situation that <tt>newExchange</tt> can be null:</p> +<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> +<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ + public class MyBodyAppender { + + public String append(String existing, String next) { + if (next == null) { + return "NewWasNull" + existing; + } else { + return existing + next; + } + } + + } +]]></script> +</div></div> + +<p>In the example above we use the <a shape="rect" href="content-enricher.html" title="Content Enricher">Content Enricher</a> EIP using <tt>pollEnrich</tt>. The <tt>newExchange</tt> will be null in the situation we could not get any data from the "seda:foo" endpoint, and therefore the timeout was hit after 1 second. So if we need to do some special merge logic we would need to set <tt>setAllowNullNewExchange=true</tt>, so the <tt>append</tt> method will be invoked. If we do not do that then when the timeout was hit, then the append method would normally not be invoked, meaning the <a shape="rect" href="content-enricher.html" title="Content Enricher">Content Enricher</a> did not merge/change the message. </p> + +<p>There is also a method <tt>setAllowNullOldExchange</tt> to set whether the <tt>oldExchange</tt> is allowed to be null.</p> + <h3><a shape="rect" name="Aggregator2-Seealso"></a>See also</h3> <ul class="alternate" type="square"><li>The <a shape="rect" href="loan-broker-example.html" title="Loan Broker Example">Loan Broker Example</a> which uses an aggregator</li><li><a shape="rect" class="external-link" href="http://tmielke.blogspot.com/2009/01/using-camel-aggregator-correctly.html" rel="nofollow">Blog post by Torsten Mielke</a> about using the aggregator correctly.</li><li>The old <a shape="rect" href="aggregator.html" title="Aggregator">Aggregator</a></li><li><a shape="rect" href="hawtdb.html" title="HawtDB">HawtDB</a>, <a shape="rect" href="leveldb.html" title="LevelDB">LevelDB</a> or <a shape="rect" href="sql-component.html" title="SQL Component">SQL Component</a> for persistence support</li><li><a shape="rect" href="aggregate-example.html" title="Aggregate Example">Aggregate Example</a> for an example application</li></ul> </div> 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 Aug 20 09:19:34 2013 @@ -18096,6 +18096,49 @@ public class MyBodyAppender { <p>When using XML DSL you must define the POJO as a <bean>.</p> +<h4><a shape="rect" name="BookInOnePage-Aggregatingwhennodata"></a>Aggregating when no data</h4> + +<p>By default when using POJOs as AggregationStrategy, then the method is <b>only</b> invoked when there is data to be aggregated. Where as without using POJOs then you may have <tt>null</tt> as <tt>oldExchange</tt> or <tt>newExchange</tt> parameters. </p> + +<p>For example the <a shape="rect" href="aggregator2.html" title="Aggregator2">Aggregate</a> EIP will invoke the <tt>AggregationStrategy</tt> with <tt>oldExchange</tt> as null, for the first <a shape="rect" href="exchange.html" title="Exchange">Exchange</a> incoming to the aggregator. And then for subsequent <a shape="rect" href="exchange.html" title="Exchange">Exchange</a>s then <tt>oldExchange</tt> and <tt>newExchange</tt> parameters are both not null. </p> + +<h5><a shape="rect" name="BookInOnePage-ExamplewithContentEnricherandnodata"></a>Example with <a shape="rect" href="content-enricher.html" title="Content Enricher">Content Enricher</a> and no data</h5> +<p>Though with POJOs as AggregationStrategy we made this simpler and only call the method when <tt>oldExchange</tt> and <tt>newExchange</tt> is not null, as that would be the most common use-case. If you need to allow <tt>oldExchange</tt> or <tt>newExchange</tt> to be null, then you can configure this with the POJO using the <tt>AggregationStrategyBeanAdapter</tt> as shown below. On the bean adapter we call <tt>setAllowNullNewExchange</tt> to allow the new exchange to be null.</p> + +<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> +<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ + public void configure() throws Exception { + AggregationStrategyBeanAdapter myStrategy = new AggregationStrategyBeanAdapter(appender, "append"); + myStrategy.setAllowNullNewExchange(true); + + from("direct:start") + .pollEnrich("seda:foo", 1000, myStrategy) + .to("mock:result"); + } +]]></script> +</div></div> + +<p>Then the <tt>append</tt> method in the POJO would need to deal with the situation that <tt>newExchange</tt> can be null:</p> +<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> +<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ + public class MyBodyAppender { + + public String append(String existing, String next) { + if (next == null) { + return "NewWasNull" + existing; + } else { + return existing + next; + } + } + + } +]]></script> +</div></div> + +<p>In the example above we use the <a shape="rect" href="content-enricher.html" title="Content Enricher">Content Enricher</a> EIP using <tt>pollEnrich</tt>. The <tt>newExchange</tt> will be null in the situation we could not get any data from the "seda:foo" endpoint, and therefore the timeout was hit after 1 second. So if we need to do some special merge logic we would need to set <tt>setAllowNullNewExchange=true</tt>, so the <tt>append</tt> method will be invoked. If we do not do that then when the timeout was hit, then the append method would normally not be invoked, meaning the <a shape="rect" href="content-enricher.html" title="Content Enricher">Content Enricher</a> did not merge/change the message. </p> + +<p>There is also a method <tt>setAllowNullOldExchange</tt> to set whether the <tt>oldExchange</tt> is allowed to be null.</p> + <h3><a shape="rect" name="BookInOnePage-Seealso"></a>See also</h3> <ul class="alternate" type="square"><li>The <a shape="rect" href="loan-broker-example.html" title="Loan Broker Example">Loan Broker Example</a> which uses an aggregator</li><li><a shape="rect" class="external-link" href="http://tmielke.blogspot.com/2009/01/using-camel-aggregator-correctly.html" rel="nofollow">Blog post by Torsten Mielke</a> about using the aggregator correctly.</li><li>The old <a shape="rect" href="aggregator.html" title="Aggregator">Aggregator</a></li><li><a shape="rect" href="hawtdb.html" title="HawtDB">HawtDB</a>, <a shape="rect" href="leveldb.html" title="LevelDB">LevelDB</a> or <a shape="rect" href="sql-component.html" title="SQL Component">SQL Component</a> for persistence support</li><li><a shape="rect" href="aggregate-example.html" title="Aggregate Example">Aggregate Example</a> for an example application</li></ul> 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 Aug 20 09:19:34 2013 @@ -2820,6 +2820,49 @@ public class MyBodyAppender { <p>When using XML DSL you must define the POJO as a <bean>.</p> +<h4><a shape="rect" name="BookPatternAppendix-Aggregatingwhennodata"></a>Aggregating when no data</h4> + +<p>By default when using POJOs as AggregationStrategy, then the method is <b>only</b> invoked when there is data to be aggregated. Where as without using POJOs then you may have <tt>null</tt> as <tt>oldExchange</tt> or <tt>newExchange</tt> parameters. </p> + +<p>For example the <a shape="rect" href="aggregator2.html" title="Aggregator2">Aggregate</a> EIP will invoke the <tt>AggregationStrategy</tt> with <tt>oldExchange</tt> as null, for the first <a shape="rect" href="exchange.html" title="Exchange">Exchange</a> incoming to the aggregator. And then for subsequent <a shape="rect" href="exchange.html" title="Exchange">Exchange</a>s then <tt>oldExchange</tt> and <tt>newExchange</tt> parameters are both not null. </p> + +<h5><a shape="rect" name="BookPatternAppendix-ExamplewithContentEnricherandnodata"></a>Example with <a shape="rect" href="content-enricher.html" title="Content Enricher">Content Enricher</a> and no data</h5> +<p>Though with POJOs as AggregationStrategy we made this simpler and only call the method when <tt>oldExchange</tt> and <tt>newExchange</tt> is not null, as that would be the most common use-case. If you need to allow <tt>oldExchange</tt> or <tt>newExchange</tt> to be null, then you can configure this with the POJO using the <tt>AggregationStrategyBeanAdapter</tt> as shown below. On the bean adapter we call <tt>setAllowNullNewExchange</tt> to allow the new exchange to be null.</p> + +<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> +<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ + public void configure() throws Exception { + AggregationStrategyBeanAdapter myStrategy = new AggregationStrategyBeanAdapter(appender, "append"); + myStrategy.setAllowNullNewExchange(true); + + from("direct:start") + .pollEnrich("seda:foo", 1000, myStrategy) + .to("mock:result"); + } +]]></script> +</div></div> + +<p>Then the <tt>append</tt> method in the POJO would need to deal with the situation that <tt>newExchange</tt> can be null:</p> +<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent"> +<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[ + public class MyBodyAppender { + + public String append(String existing, String next) { + if (next == null) { + return "NewWasNull" + existing; + } else { + return existing + next; + } + } + + } +]]></script> +</div></div> + +<p>In the example above we use the <a shape="rect" href="content-enricher.html" title="Content Enricher">Content Enricher</a> EIP using <tt>pollEnrich</tt>. The <tt>newExchange</tt> will be null in the situation we could not get any data from the "seda:foo" endpoint, and therefore the timeout was hit after 1 second. So if we need to do some special merge logic we would need to set <tt>setAllowNullNewExchange=true</tt>, so the <tt>append</tt> method will be invoked. If we do not do that then when the timeout was hit, then the append method would normally not be invoked, meaning the <a shape="rect" href="content-enricher.html" title="Content Enricher">Content Enricher</a> did not merge/change the message. </p> + +<p>There is also a method <tt>setAllowNullOldExchange</tt> to set whether the <tt>oldExchange</tt> is allowed to be null.</p> + <h3><a shape="rect" name="BookPatternAppendix-Seealso"></a>See also</h3> <ul class="alternate" type="square"><li>The <a shape="rect" href="loan-broker-example.html" title="Loan Broker Example">Loan Broker Example</a> which uses an aggregator</li><li><a shape="rect" class="external-link" href="http://tmielke.blogspot.com/2009/01/using-camel-aggregator-correctly.html" rel="nofollow">Blog post by Torsten Mielke</a> about using the aggregator correctly.</li><li>The old <a shape="rect" href="aggregator.html" title="Aggregator">Aggregator</a></li><li><a shape="rect" href="hawtdb.html" title="HawtDB">HawtDB</a>, <a shape="rect" href="leveldb.html" title="LevelDB">LevelDB</a> or <a shape="rect" href="sql-component.html" title="SQL Component">SQL Component</a> for persistence support</li><li><a shape="rect" href="aggregate-example.html" title="Aggregate Example">Aggregate Example</a> for an example application</li></ul> Modified: websites/production/camel/content/cache/main.pageCache ============================================================================== Binary files - no diff available.