summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-jms-runtime
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-10-20 19:42:00 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2010-10-20 19:42:00 +0000
commitd5a65eb652f6359e30b7e7a6f0db9ad07fdcd497 (patch)
treef8b67ced86408aca0d45538c533cb6e9084da1fa /sca-java-2.x/trunk/modules/binding-jms-runtime
parent205cc9b644f7462c721f8d63dc231014fe6b6b34 (diff)
Fix JMS refernces to honour the correlation attribute of the JMS binding
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1025695 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-jms-runtime')
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java19
1 files changed, 15 insertions, 4 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java
index 6681870612..cafcd12cf2 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportReferenceInterceptor.java
@@ -26,6 +26,7 @@ import javax.jms.Session;
import javax.naming.NamingException;
import org.apache.tuscany.sca.binding.jms.JMSBinding;
+import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
import org.apache.tuscany.sca.binding.jms.JMSBindingException;
import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
import org.apache.tuscany.sca.binding.jms.provider.JMSResourceFactory;
@@ -110,10 +111,20 @@ public class TransportReferenceInterceptor implements Interceptor {
javax.jms.Message requestMessage = (javax.jms.Message)msg.getBody();
- String msgSelector = "JMSCorrelationID = '" +
- requestMessage.getJMSMessageID() +
- "'";
- MessageConsumer consumer = session.createConsumer(context.getReplyToDestination(), msgSelector);
+ String msgSelector = null;
+ String correlationScheme = jmsBinding.getCorrelationScheme();
+ if (correlationScheme == null || JMSBindingConstants.CORRELATE_MSG_ID.equalsIgnoreCase(correlationScheme)) {
+ msgSelector = "JMSCorrelationID = '" + requestMessage.getJMSMessageID() + "'";
+ } else if (JMSBindingConstants.CORRELATE_CORRELATION_ID.equalsIgnoreCase(correlationScheme)) {
+ msgSelector = "JMSCorrelationID = '" + requestMessage.getJMSCorrelationID() + "'";
+ }
+
+ MessageConsumer consumer;
+ if (msgSelector != null) {
+ consumer = session.createConsumer(context.getReplyToDestination(), msgSelector);
+ } else {
+ consumer = session.createConsumer(context.getReplyToDestination());
+ }
javax.jms.Message replyMsg;
try {