Author: buildbot
Date: Fri Mar 7 14:19:23 2014
New Revision: 900457
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/aggregator2.html
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/file2.html
Modified: websites/production/camel/content/aggregator2.html
==============================================================================
--- websites/production/camel/content/aggregator2.html (original)
+++ websites/production/camel/content/aggregator2.html Fri Mar 7 14:19:23 2014
@@ -110,18 +110,18 @@ class StringAggregationStrategy implemen
class ArrayListAggregationStrategy implements AggregationStrategy {
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
- Object newBody = newExchange.getIn().getBody();
- ArrayList<Object> list = null;
+ Object newBody = newExchange.getIn().getBody();
+ ArrayList<Object> list = null;
if (oldExchange == null) {
- list = new ArrayList<Object>();
- list.add(newBody);
- newExchange.getIn().setBody(list);
- return newExchange;
+ list = new ArrayList<Object>();
+ list.add(newBody);
+ newExchange.getIn().setBody(list);
+ return newExchange;
} else {
list = oldExchange.getIn().getBody(ArrayList.class);
- list.add(newBody);
- return oldExchange;
- }
+ list.add(newBody);
+ return oldExchange;
+ }
}
}
]]></script>
@@ -353,7 +353,7 @@ public final class MyListOfNumbersStrate
<p>You can use POJOs as AggregationStrategy with
the other <a shape="rect" href="eip.html">EIP</a>s that supports aggregation,
such as <a shape="rect" href="splitter.html">Splitter</a>, <a shape="rect"
href="recipient-list.html">Recipient List</a>, etc.</p>
</div>
</div>
-<p>To use the <code>AggregationStrategy</code> you had to implement the
<code>org.apache.camel.processor.aggregate.AggregationStrategy</code>
interface, which means your logic would be tied to the Camel API. From
<strong>Camel 2.12</strong> onwards you can use a POJO for the logic and let
Camel adapt to your POJO. To use a POJO a convention must be followed:</p><ul
class="alternate"><li>there must be a public method to use</li><li>the method
must not be void</li><li>the method can be static or non-static</li><li>the
method must have 2 or more parameters</li><li>the parameters is paired so the
first 50% is applied to the <code>oldExchnage</code> and the reminder 50% is
for the <code>newExchange</code></li><li>.. meaning that there must be an equal
number of parameters, eg 2, 4, 6 etc.</li></ul><p>The paired methods is
expected to be ordered as follows:</p><ul class="alternate"><li>the first
parameter is the message body</li><li>the 2nd parameter is a Map of the
headers</li><li>the 3r
d parameter is a Map of the Exchange properties</li></ul><p>This convention is
best explained with some examples.</p><p>In the method below, we have only 2
parameters, so the 1st parameter is the body of the <code>oldExchange</code>,
and the 2nd is paired to the body of the <code>newExchange</code>:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
+<p>To use the <code>AggregationStrategy</code> you had to implement the
<code>org.apache.camel.processor.aggregate.AggregationStrategy</code>
interface, which means your logic would be tied to the Camel API. From
<strong>Camel 2.12</strong> onwards you can use a POJO for the logic and let
Camel adapt to your POJO. To use a POJO a convention must be followed:</p><ul
class="alternate"><li>there must be a public method to use</li><li>the method
must not be void</li><li>the method can be static or non-static</li><li>the
method must have 2 or more parameters</li><li>the parameters is paired so the
first 50% is applied to the <code>oldExchange</code> and the reminder 50% is
for the <code>newExchange</code></li><li>.. meaning that there must be an equal
number of parameters, eg 2, 4, 6 etc.</li></ul><p>The paired methods is
expected to be ordered as follows:</p><ul class="alternate"><li>the first
parameter is the message body</li><li>the 2nd parameter is a Map of the
headers</li><li>the 3r
d parameter is a Map of the Exchange properties</li></ul><p>This convention is
best explained with some examples.</p><p>In the method below, we have only 2
parameters, so the 1st parameter is the body of the <code>oldExchange</code>,
and the 2nd is paired to the body of the <code>newExchange</code>:</p><div
class="code panel pdl" style="border-width: 1px;"><div class="codeContent
panelContent pdl">
<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[public String append(String existing, String
next) {
return existing + next;
}
Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/camel/content/file2.html
==============================================================================
--- websites/production/camel/content/file2.html (original)
+++ websites/production/camel/content/file2.html Fri Mar 7 14:19:23 2014
@@ -296,7 +296,7 @@ private static class ProcessReport imple
}
]]></script>
</div></div><h4 id="File2-WritetosubdirectoryusingExchange.FILE_NAME">Write to
subdirectory using <code>Exchange.FILE_NAME</code></h4><p>Using a single route,
it is possible to write a file to any number of subdirectories. If you have a
route setup as such:</p><div class="code panel pdl" style="border-width:
1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[ <route>
+<script class="theme: Default; brush: xml; gutter: false"
type="syntaxhighlighter"><![CDATA[ <route>
<from uri="bean:myBean"/>
<to uri="file:/rootDirectory"/>
</route>
@@ -305,7 +305,11 @@ private static class ProcessReport imple
<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[Exchange.FILE_NAME = hello.txt =>
/rootDirectory/hello.txt
Exchange.FILE_NAME = foo/bye.txt => /rootDirectory/foo/bye.txt
]]></script>
-</div></div><p>This allows you to have a single route to write files to
multiple destinations.</p><h4 id="File2-Usingexpressionforfilenames">Using
expression for filenames</h4><p>In this sample we want to move consumed files
to a backup folder using today's date as a sub-folder name:</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>This allows you to have a single route to write files to
multiple destinations.</p><h4
id="File2-Writingfilethroughthetemporarydirectoryrelativetothefinaldestination">Writing
file through the temporary directory relative to the final
destination</h4><p>Sometime you need to temporarily write the files to some
directory relative to the destination directory. Such situation usually happens
when some external process with limited filtering capabilities is reading from
the directory you are writing to. In the example below files will be written to
the  <code>/var/myapp/filesInProgress</code> directory and after data
transfer is done, they will be atomically moved to
the<code> /var/myapp/finalDirectory </code>directory.</p><div class="code
panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[from("direct:start").
+
to("file:///var/myapp/finalDirectory?tempPrefix=/../filesInProgress/");
+]]></script>
+</div></div><h4 id="File2-Usingexpressionforfilenames">Using expression for
filenames</h4><p>In this sample we want to move consumed files to a backup
folder using today's date as a sub-folder name:</p><div class="code panel pdl"
style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="theme: Default; brush: java; gutter: false"
type="syntaxhighlighter"><![CDATA[from("file://inbox?move=backup/${date:now:yyyyMMdd}/${file:name}").to("...");
]]></script>
</div></div><p>See <a shape="rect" href="file-language.html">File Language</a>
for more samples.</p><h3
id="File2-Avoidingreadingthesamefilemorethanonce(idempotentconsumer)">Avoiding
reading the same file more than once (idempotent consumer)</h3><p>Camel
supports <a shape="rect" href="idempotent-consumer.html">Idempotent
Consumer</a> directly within the component so it will skip already processed
files. This feature can be enabled by setting the <code>idempotent=true</code>
option.</p><div class="code panel pdl" style="border-width: 1px;"><div
class="codeContent panelContent pdl">