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

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


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

commit a9cccd5184d98a2607a9d1fae94f210c82817a45
Author: Claus Ibsen <claus.ib...@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 efc91ae..e39b911 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);
         }
 

Reply via email to