tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r682318 - /tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
Date Mon, 04 Aug 2008 10:44:09 GMT
Author: antelder
Date: Mon Aug  4 03:44:08 2008
New Revision: 682318

URL: http://svn.apache.org/viewvc?rev=682318&view=rev
Log:
Tidy up header processing

Modified:
    tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java

Modified: tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java?rev=682318&r1=682317&r2=682318&view=diff
==============================================================================
--- tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
(original)
+++ tuscany/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java
Mon Aug  4 03:44:08 2008
@@ -20,6 +20,7 @@
 
 import java.lang.reflect.InvocationTargetException;
 
+import javax.jms.DeliveryMode;
 import javax.jms.Destination;
 import javax.jms.JMSException;
 import javax.jms.Message;
@@ -41,7 +42,7 @@
 import org.osoa.sca.ServiceRuntimeException;
 
 /**
- * Interceptor for the JMS binding.
+ * Invoker for the JMS binding.
  * 
  * @version $Rev$ $Date$
  */
@@ -259,12 +260,16 @@
 
         setHeaders(tuscanyMsg, requestMsg);
 
-        requestMessageProcessor.setOperationName(operationName, requestMsg);
         requestMsg.setJMSReplyTo(replyToDest);
 
         Destination requestDest = getRequestDestination(tuscanyMsg, session);
 
         MessageProducer producer = session.createProducer(requestDest);
+
+        if (jmsBinding.getOperationJMSTimeToLive(operationName) != null) {
+            producer.setTimeToLive(jmsBinding.getOperationJMSTimeToLive(operationName));
+        }
+
         try {
             producer.send(requestMsg);
         } finally {
@@ -293,8 +298,23 @@
 
     protected void setHeaders(org.apache.tuscany.sca.invocation.Message tuscanyMsg, Message
jmsMsg) throws JMSException {
 
-        jmsMsg.setJMSDeliveryMode(jmsBinding.getDeliveryMode());
-        jmsMsg.setJMSPriority(jmsBinding.getPriority());
+        requestMessageProcessor.setOperationName(jmsBinding.getNativeOperationName(operationName),
jmsMsg);
+
+        if (jmsBinding.getOperationJMSDeliveryMode(operationName) != null) {
+            if (jmsBinding.getOperationJMSDeliveryMode(operationName)) {
+                jmsMsg.setJMSDeliveryMode(DeliveryMode.PERSISTENT);
+            } else {
+                jmsMsg.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
+            }
+        }
+
+        if (jmsBinding.getOperationJMSPriority(operationName) != null) {
+            jmsMsg.setJMSPriority(jmsBinding.getOperationJMSPriority(operationName));
+        }
+
+        if (jmsBinding.getOperationJMSType(operationName) != null) {
+            jmsMsg.setJMSType(jmsBinding.getOperationJMSType(operationName));
+        }
 
         ReferenceParameters parameters = tuscanyMsg.getFrom().getReferenceParameters();
 
@@ -329,10 +349,18 @@
     protected Message receiveReply(Session session, Destination replyToDest, String requestMsgId)
throws JMSException, NamingException {
         String msgSelector = "JMSCorrelationID = '" + requestMsgId + "'";
         MessageConsumer consumer = session.createConsumer(replyToDest, msgSelector);
+      
+        long receiveWait;
+        if (jmsBinding.getOperationJMSTimeToLive(operationName) != null) {
+            receiveWait = jmsBinding.getOperationJMSTimeToLive(operationName) * 2;      
 
+        } else {
+            receiveWait = JMSBindingConstants.DEFAULT_TIME_TO_LIVE;
+        }
+        
         Message replyMsg;
         try {
             jmsResourceFactory.startConnection();
-            replyMsg = consumer.receive(jmsBinding.getTimeToLive());
+            replyMsg = consumer.receive(receiveWait);
         } finally {
             consumer.close();
         }



Mime
View raw message