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 2010/06/21 16:38:29 UTC

svn commit: r956603 - in /camel/trunk/camel-core/src/main/java/org/apache/camel/processor: Pipeline.java RoutingSlip.java

Author: davsclaus
Date: Mon Jun 21 14:38:29 2010
New Revision: 956603

URL: http://svn.apache.org/viewvc?rev=956603&view=rev
Log:
CAMEL-2835: Routing slip EIP now fully supports async routing engine.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java?rev=956603&r1=956602&r2=956603&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java Mon Jun 21 14:38:29 2010
@@ -141,9 +141,9 @@ public class Pipeline extends MulticastP
         // implement asynchronous routing logic in callback so we can have the callback being
         // triggered and then continue routing where we left
         boolean sync = asyncProcessor.process(exchange, new AsyncCallback() {
-            public void done(boolean sync) {
+            public void done(boolean doneSync) {
                 // we only have to handle async completion of the pipeline
-                if (sync) {
+                if (doneSync) {
                     return;
                 }
 
@@ -178,8 +178,8 @@ public class Pipeline extends MulticastP
                     }
 
                     nextExchange = createNextExchange(nextExchange);
-                    sync = process(original, nextExchange, callback, processors, processor);
-                    if (!sync) {
+                    doneSync = process(original, nextExchange, callback, processors, processor);
+                    if (!doneSync) {
                         if (LOG.isTraceEnabled()) {
                             LOG.trace("Processing exchangeId: " + exchange.getExchangeId() + " is continued being processed asynchronously");
                         }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java?rev=956603&r1=956602&r2=956603&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/RoutingSlip.java Mon Jun 21 14:38:29 2010
@@ -47,6 +47,10 @@ import static org.apache.camel.util.Obje
  * Implements a <a href="http://camel.apache.org/routing-slip.html">Routing Slip</a>
  * pattern where the list of actual endpoints to send a message exchange to are
  * dependent on the value of a message header.
+ * <p/>
+ * This implementation mirrors the logic from the {@link org.apache.camel.processor.Pipeline} in the async variation
+ * as the failover load balancer is a specialized pipeline. So the trick is to keep doing the same as the
+ * pipeline to ensure it works the same and the async routing engine is flawless.
  */
 public class RoutingSlip extends ServiceSupport implements AsyncProcessor, Traceable {
     private static final transient Log LOG = LogFactory.getLog(RoutingSlip.class);
@@ -163,7 +167,7 @@ public class RoutingSlip extends Service
                 if (LOG.isTraceEnabled()) {
                     LOG.trace("Processing exchangeId: " + exchange.getExchangeId() + " is continued being processed asynchronously");
                 }
-                // the remainder of the pipeline will be completed async
+                // the remainder of the routing slip will be completed async
                 // so we break out now, then the callback will be invoked which then continue routing from where we left here
                 return false;
             }
@@ -372,7 +376,7 @@ public class RoutingSlip extends Service
     }
 
     private void updateRoutingSlipHeader(Exchange current) {
-        // only update the header value which used as the routingslip
+        // only update the header value which used as the routing slip
         if (header != null) {
             Message message = getResultMessage(current);
             String oldSlip = message.getHeader(header, String.class);