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 2012/05/23 21:06:51 UTC

svn commit: r1341982 - in /camel/branches/camel-2.8.x: ./ camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java camel-core/src/test/java/org/apache/camel/issues/SedaMultipleConsumersIssueTest.java

Author: davsclaus
Date: Wed May 23 19:06:51 2012
New Revision: 1341982

URL: http://svn.apache.org/viewvc?rev=1341982&view=rev
Log:
CAMEL-5303: Fixed in-out over seda/vm with multiConsumers enabled. Should done when all consumers is done, and not on the first.

Added:
    camel/branches/camel-2.8.x/camel-core/src/test/java/org/apache/camel/issues/SedaMultipleConsumersIssueTest.java
      - copied unchanged from r1341979, camel/branches/camel-2.9.x/camel-core/src/test/java/org/apache/camel/issues/SedaMultipleConsumersIssueTest.java
Modified:
    camel/branches/camel-2.8.x/   (props changed)
    camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1341978
  Merged /camel/branches/camel-2.9.x:r1341979

Propchange: camel/branches/camel-2.8.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java?rev=1341982&r1=1341981&r2=1341982&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java (original)
+++ camel/branches/camel-2.8.x/camel-core/src/main/java/org/apache/camel/component/seda/SedaConsumer.java Wed May 23 19:06:51 2012
@@ -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.ExecutorService;
@@ -36,9 +37,11 @@ import org.apache.camel.impl.converter.A
 import org.apache.camel.processor.MulticastProcessor;
 import org.apache.camel.spi.ExceptionHandler;
 import org.apache.camel.spi.ShutdownAware;
+import org.apache.camel.spi.Synchronization;
 import org.apache.camel.util.AsyncProcessorHelper;
 import org.apache.camel.util.ExchangeHelper;
 import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.UnitOfWorkHelper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -218,7 +221,7 @@ public class SedaConsumer extends Servic
      * @param exchange the exchange
      * @throws Exception can be thrown if processing of the exchange failed
      */
-    protected void sendToConsumers(Exchange exchange) throws Exception {
+    protected void sendToConsumers(final Exchange exchange) throws Exception {
         int size = endpoint.getConsumers().size();
 
         // if there are multiple consumers then multicast to them
@@ -232,7 +235,10 @@ public class SedaConsumer extends Servic
             if (LOG.isDebugEnabled()) {
                 LOG.debug("Multicasting to {} consumers for Exchange: {}", endpoint.getConsumers().size(), exchange);
             }
-           
+
+            // handover completions, as we need to done this when the multicast is done
+            final List<Synchronization> completions = exchange.handoverCompletions();
+
             // use a multicast processor to process it
             MulticastProcessor mp = endpoint.getConsumerMulticastProcessor();
             ObjectHelper.notNull(mp, "ConsumerMulticastProcessor", this);
@@ -240,7 +246,8 @@ public class SedaConsumer extends Servic
             // and use the asynchronous routing engine to support it
             AsyncProcessorHelper.process(mp, exchange, new AsyncCallback() {
                 public void done(boolean doneSync) {
-                    // noop
+                    // done the uow on the completions
+                    UnitOfWorkHelper.doneSynchronizations(exchange, completions, LOG);
                 }
             });
         } else {