You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/03/02 09:14:13 UTC

svn commit: r513655 - in /incubator/servicemix/branches/servicemix-3.1/common/servicemix-common/src/main/java/org/apache/servicemix/common: AsyncBaseLifeCycle.java EndpointDeliveryChannel.java ServiceMixComponent.java

Author: gnodet
Date: Fri Mar  2 00:14:12 2007
New Revision: 513655

URL: http://svn.apache.org/viewvc?view=rev&rev=513655
Log:
SM-861: servicemix-common does not properly set the correlationId for exchanges that are sent using sendSync

Modified:
    incubator/servicemix/branches/servicemix-3.1/common/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java
    incubator/servicemix/branches/servicemix-3.1/common/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java
    incubator/servicemix/branches/servicemix-3.1/common/servicemix-common/src/main/java/org/apache/servicemix/common/ServiceMixComponent.java

Modified: incubator/servicemix/branches/servicemix-3.1/common/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-3.1/common/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java?view=diff&rev=513655&r1=513654&r2=513655
==============================================================================
--- incubator/servicemix/branches/servicemix-3.1/common/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java (original)
+++ incubator/servicemix/branches/servicemix-3.1/common/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java Fri Mar  2 00:14:12 2007
@@ -518,6 +518,12 @@
      * @throws MessagingException
      */
     public void sendConsumerExchange(MessageExchange exchange, Endpoint endpoint) throws MessagingException {
+        prepareConsumerExchange(exchange, endpoint);
+        // Send the exchange
+        channel.send(exchange);
+    }
+    
+    public void prepareConsumerExchange(MessageExchange exchange, Endpoint endpoint) {
         // Check if a correlation id is already set on the exchange, otherwise create it
         String correlationIDValue = (String) exchange.getProperty(JbiConstants.CORRELATION_ID);
         if (correlationIDValue == null) {
@@ -542,8 +548,6 @@
         // Set the sender endpoint property
         String key = EndpointSupport.getKey(endpoint);
         exchange.setProperty(JbiConstants.SENDER_ENDPOINT, key);
-        // Send the exchange
-        channel.send(exchange);
     }
 
     /**

Modified: incubator/servicemix/branches/servicemix-3.1/common/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-3.1/common/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java?view=diff&rev=513655&r1=513654&r2=513655
==============================================================================
--- incubator/servicemix/branches/servicemix-3.1/common/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java (original)
+++ incubator/servicemix/branches/servicemix-3.1/common/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java Fri Mar  2 00:14:12 2007
@@ -74,17 +74,24 @@
     public void send(MessageExchange exchange) throws MessagingException {
         if (exchange.getStatus() == ExchangeStatus.ACTIVE && exchange.getRole() == Role.CONSUMER) {
             ServiceMixComponent comp = endpoint.getServiceUnit().getComponent();
-            comp.sendConsumerExchange(exchange, endpoint);
-        } else {
-            channel.send(exchange);
+            comp.prepareConsumerExchange(exchange, endpoint);
         }
+        channel.send(exchange);
     }
 
     public boolean sendSync(MessageExchange exchange, long timeout) throws MessagingException {
+        if (exchange.getStatus() == ExchangeStatus.ACTIVE && exchange.getRole() == Role.CONSUMER) {
+            ServiceMixComponent comp = endpoint.getServiceUnit().getComponent();
+            comp.prepareConsumerExchange(exchange, endpoint);
+        }
         return channel.sendSync(exchange, timeout);
     }
 
     public boolean sendSync(MessageExchange exchange) throws MessagingException {
+        if (exchange.getStatus() == ExchangeStatus.ACTIVE && exchange.getRole() == Role.CONSUMER) {
+            ServiceMixComponent comp = endpoint.getServiceUnit().getComponent();
+            comp.prepareConsumerExchange(exchange, endpoint);
+        }
         return channel.sendSync(exchange);
     }
 }

Modified: incubator/servicemix/branches/servicemix-3.1/common/servicemix-common/src/main/java/org/apache/servicemix/common/ServiceMixComponent.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/branches/servicemix-3.1/common/servicemix-common/src/main/java/org/apache/servicemix/common/ServiceMixComponent.java?view=diff&rev=513655&r1=513654&r2=513655
==============================================================================
--- incubator/servicemix/branches/servicemix-3.1/common/servicemix-common/src/main/java/org/apache/servicemix/common/ServiceMixComponent.java (original)
+++ incubator/servicemix/branches/servicemix-3.1/common/servicemix-common/src/main/java/org/apache/servicemix/common/ServiceMixComponent.java Fri Mar  2 00:14:12 2007
@@ -59,11 +59,22 @@
     public String getComponentName();
     
     /**
+     * Prepare a consumer exchange from the given endpoint.
+     * The caller need to send / sendSync the exchange. 
+     * 
+     * @param exchange the exchange to send
+     * @param endpoint the endpoint sending the exchange
+     * @throws MessagingException
+     */
+    public void prepareConsumerExchange(MessageExchange exchange, Endpoint endpoint) throws MessagingException;
+
+    /**
      * Sends a consumer exchange from the given endpoint. 
      * 
      * @param exchange the exchange to send
      * @param endpoint the endpoint sending the exchange
      * @throws MessagingException
+     * @deprecated use prepareConsumerExchange
      */
     public void sendConsumerExchange(MessageExchange exchange, Endpoint endpoint) throws MessagingException;