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 2018/02/24 12:07:54 UTC

[camel] branch master updated: Added BatchAggregationStrategy

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/master by this push:
     new 2907efb  Added BatchAggregationStrategy
2907efb is described below

commit 2907efba81623bf5cce7c5f765ac49fd8fbe3f1e
Author: LittleLightCz <an...@gmail.com>
AuthorDate: Sat Jan 27 12:29:25 2018 +0100

    Added BatchAggregationStrategy
---
 .../processor/aggregate/BatchAggregationStrategy.java    | 16 ++++++++++++++++
 .../apache/camel/util/toolbox/AggregationStrategies.java |  7 +++++++
 2 files changed, 23 insertions(+)

diff --git a/camel-core/src/main/java/org/apache/camel/processor/aggregate/BatchAggregationStrategy.java b/camel-core/src/main/java/org/apache/camel/processor/aggregate/BatchAggregationStrategy.java
new file mode 100644
index 0000000..2394888
--- /dev/null
+++ b/camel-core/src/main/java/org/apache/camel/processor/aggregate/BatchAggregationStrategy.java
@@ -0,0 +1,16 @@
+import org.apache.camel.Exchange;
+import org.apache.camel.processor.aggregate.AbstractListAggregationStrategy;
+
+/**
+ * Aggregate body of input {@link Message} into a single combined Exchange holding all the
+ * aggregated bodies in a {@link List} of type {@link Object} as the message body.
+ *
+ * This aggregation strategy can used in combination with {@link org.apache.camel.processor.Splitter} to batch messages
+ *
+ * @version
+ */
+public class BatchAggregationStrategy extends AbstractListAggregationStrategy<Object> {
+    public Object getValue(Exchange exchange) {
+        return exchange.getIn().getBody();
+    }
+}
diff --git a/camel-core/src/main/java/org/apache/camel/util/toolbox/AggregationStrategies.java b/camel-core/src/main/java/org/apache/camel/util/toolbox/AggregationStrategies.java
index 0dbfbb4..4fda638 100644
--- a/camel-core/src/main/java/org/apache/camel/util/toolbox/AggregationStrategies.java
+++ b/camel-core/src/main/java/org/apache/camel/util/toolbox/AggregationStrategies.java
@@ -76,6 +76,13 @@ public final class AggregationStrategies {
     }
 
     /**
+     * Creates a {@link BatchAggregationStrategy} aggregation strategy.
+     */
+    public static AggregationStrategy batch() {
+        return new BatchAggregationStrategy();
+    }
+
+    /**
      * Creates a {@link AggregationStrategyBeanAdapter} for using a POJO as the aggregation strategy.
      */
     public static AggregationStrategy bean(Object bean) {

-- 
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.