camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/2] camel git commit: CAMEL-10195: rest-dsl - automatic binding failure with waitForTaskToComplete=Never
Date Fri, 29 Jul 2016 13:58:30 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.17.x 17f24adb6 -> 9fedf6aa6
  refs/heads/master d83c187a3 -> d1d2993f9


CAMEL-10195: rest-dsl - automatic binding failure with waitForTaskToComplete=Never


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d1d2993f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d1d2993f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d1d2993f

Branch: refs/heads/master
Commit: d1d2993f9ca0cb2834878199c19fba2015fd7621
Parents: d83c187
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Jul 29 15:56:32 2016 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Jul 29 15:57:46 2016 +0200

----------------------------------------------------------------------
 .../camel/component/seda/SedaProducer.java      | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d1d2993f/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java b/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java
index 1e28eaa..3e34e8a 100644
--- a/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java
+++ b/camel-core/src/main/java/org/apache/camel/component/seda/SedaProducer.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.seda;
 
+import java.util.List;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -25,6 +26,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.ExchangeTimedOutException;
 import org.apache.camel.WaitForTaskToComplete;
 import org.apache.camel.impl.DefaultAsyncProducer;
+import org.apache.camel.spi.Synchronization;
 import org.apache.camel.support.SynchronizationAdapter;
 import org.apache.camel.util.ExchangeHelper;
 
@@ -178,7 +180,23 @@ public class SedaProducer extends DefaultAsyncProducer {
 
     protected Exchange prepareCopy(Exchange exchange, boolean handover) {
         // use a new copy of the exchange to route async (and use same message id)
-        Exchange copy = ExchangeHelper.createCorrelatedCopy(exchange, handover, true);
+        Exchange copy = ExchangeHelper.createCorrelatedCopy(exchange, false, true);
+        // if handover we need to do special handover to avoid handing over
+        // RestBindingMarshalOnCompletion as it should not be handed over with SEDA
+        if (handover) {
+            List<Synchronization> completions = exchange.handoverCompletions();
+            if (completions != null) {
+                for (Synchronization sync : completions) {
+                    if (sync.getClass().getName().contains("RestBindingMarshalOnCompletion"))
{
+                        // keep this one
+                        exchange.addOnCompletion(sync);
+                    } else {
+                        // handover
+                        copy.addOnCompletion(sync);
+                    }
+                }
+            }
+        }
         // set a new from endpoint to be the seda queue
         copy.setFromEndpoint(endpoint);
         return copy;


Mime
View raw message