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:07:44 UTC
svn commit: r513653 - in
/incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common:
AsyncBaseLifeCycle.java EndpointDeliveryChannel.java ServiceMixComponent.java
Author: gnodet
Date: Fri Mar 2 00:07:43 2007
New Revision: 513653
URL: http://svn.apache.org/viewvc?view=rev&rev=513653
Log:
SM-861: servicemix-common does not properly set the correlationId for exchanges that are sent using sendSync
Modified:
incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java
incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java
incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/ServiceMixComponent.java
Modified: incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java?view=diff&rev=513653&r1=513652&r2=513653
==============================================================================
--- incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java (original)
+++ incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java Fri Mar 2 00:07:43 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/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java?view=diff&rev=513653&r1=513652&r2=513653
==============================================================================
--- incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java (original)
+++ incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java Fri Mar 2 00:07:43 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/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/ServiceMixComponent.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/ServiceMixComponent.java?view=diff&rev=513653&r1=513652&r2=513653
==============================================================================
--- incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/ServiceMixComponent.java (original)
+++ incubator/servicemix/trunk/common/servicemix-common/src/main/java/org/apache/servicemix/common/ServiceMixComponent.java Fri Mar 2 00:07:43 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;