You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/05/23 11:26:23 UTC
svn commit: r777874 - in
/camel/trunk/camel-core/src/main/java/org/apache/camel:
component/file/GenericFileOnCompletion.java
processor/aggregate/AggregationStrategy.java
Author: davsclaus
Date: Sat May 23 09:26:23 2009
New Revision: 777874
URL: http://svn.apache.org/viewvc?rev=777874&view=rev
Log:
CAMEL-1638: Added javadoc comments to explain the recent change with the AggregationStrategy that is now also invoked on the very first exchange.
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategy.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java?rev=777874&r1=777873&r2=777874&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java Sat May 23 09:26:23 2009
@@ -26,7 +26,7 @@
/**
* On completion strategy that performs the nessasary work after the {@link Exchange} has been processed.
* <p/>
- * The work is for instance to move the processed file into a backup folder, delete the file or
+ * The work is for example to move the processed file into a backup folder, delete the file or
* in case of processing failure do a rollback.
*
* @version $Revision$
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategy.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategy.java?rev=777874&r1=777873&r2=777874&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategy.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/aggregate/AggregationStrategy.java Sat May 23 09:26:23 2009
@@ -20,6 +20,14 @@
/**
* A strategy for aggregating two exchanges together into a single exchange.
+ * <p/>
+ * On the first invocation of the {@link #aggregate(org.apache.camel.Exchange, org.apache.camel.Exchange) aggregate}
+ * method the <tt>oldExchange</tt> parameter is <tt>null</tt>. The reason is that we have not aggregated anything yet.
+ * So its only the <tt>newExchange</tt> that has a value. Usually you just return the <tt>newExchange</tt> in this
+ * situation. But you still have the power to decide what to do, for example you can do some alternation on the exchange
+ * or remove some headers. And a more common use case is for instance to count some values from the body payload. That
+ * could be to sum up a total amount etc.
+ * <p/>
* Possible implementations include performing some kind of combining or delta
* processing, such as adding line items together into an invoice or just using
* the newest exchange and removing old exchanges such as for state tracking or
@@ -30,10 +38,9 @@
public interface AggregationStrategy {
/**
- * Aggregates an old and new exchange together to create a single combined
- * exchange
+ * Aggregates an old and new exchange together to create a single combined exchange
*
- * @param oldExchange the oldest exchange
+ * @param oldExchange the oldest exchange (is <tt>null</tt> on first aggregation as we only have the new exchange)
* @param newExchange the newest exchange
* @return a combined composite of the two exchanges
*/