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:26 UTC

[camel] branch camel-2.22.x 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 camel-2.22.x
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/camel-2.22.x by this push:
     new f0b93fc  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.
f0b93fc is described below

commit f0b93fc867bbd5c83d8a0b1841da14fb79454d95
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 1f53748..6851ead 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
@@ -36,6 +36,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;
@@ -98,13 +99,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);
         }