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/08/20 07:26:43 UTC

[camel] branch master updated: CAMEL-12709: Splitter aggregation strategy should also deal with delegate strategy and have share unit of work set on both conditions. Thanks to Matthias Humbert for reporting.

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 e51059a  CAMEL-12709: Splitter aggregation strategy should also deal with delegate strategy and have share unit of work set on both conditions. Thanks to Matthias Humbert for reporting.
e51059a is described below

commit e51059acef2360f9a6fe56a813cfa7282cecb24f
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Aug 20 09:25:25 2018 +0200

    CAMEL-12709: Splitter aggregation strategy should also deal with delegate strategy and have share unit of work set on both conditions. Thanks to Matthias Humbert for reporting.
---
 .../src/main/java/org/apache/camel/processor/Splitter.java   | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/camel-core/src/main/java/org/apache/camel/processor/Splitter.java b/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
index 610c266..634aa11 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/Splitter.java
@@ -35,6 +35,7 @@ import org.apache.camel.Processor;
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.Traceable;
 import org.apache.camel.processor.aggregate.AggregationStrategy;
+import org.apache.camel.processor.aggregate.DelegateAggregationStrategy;
 import org.apache.camel.processor.aggregate.ShareUnitOfWorkAggregationStrategy;
 import org.apache.camel.processor.aggregate.UseOriginalAggregationStrategy;
 import org.apache.camel.spi.RouteContext;
@@ -96,13 +97,20 @@ public class Splitter extends MulticastProcessor implements AsyncProcessor, Trac
 
     @Override
     public boolean process(Exchange exchange, final AsyncCallback callback) {
-        final AggregationStrategy strategy = getAggregationStrategy();
+        AggregationStrategy strategy = getAggregationStrategy();
+
+        if (strategy instanceof DelegateAggregationStrategy) {
+            strategy = ((DelegateAggregationStrategy) strategy).getDelegate();
+        }
 
         // set original exchange if not already pre-configured
         if (strategy instanceof UseOriginalAggregationStrategy) {
             // need to create a new private instance, as we can also have concurrency issue so we cannot store state
             UseOriginalAggregationStrategy original = (UseOriginalAggregationStrategy) strategy;
-            UseOriginalAggregationStrategy clone = original.newInstance(exchange);
+            AggregationStrategy clone = original.newInstance(exchange);
+            if (isShareUnitOfWork()) {
+                clone = new ShareUnitOfWorkAggregationStrategy(clone);
+            }
             setAggregationStrategyOnExchange(exchange, clone);
         }