summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java')
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
index 0e88b283dc..06a061cdd9 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
@@ -208,6 +208,31 @@ public class RRBJMSBindingInvoker extends InterceptorAsyncImpl {
context.setRequestDestination(getRequestDestination(tuscanyMsg, session));
context.setReplyToDestination(getReplyToDestination(session));
+ Long ttl = jmsBinding.getOperationJMSTimeToLive(operationName);
+ if (ttl != null) {
+ context.setTimeToLive(ttl);
+ }
+
+ // For twoway operations, determine a request timeout.
+ // The SCA specs do not address how to do this. We use the following approach.
+ // - If JMSTimeToLive is specified, use double that value.
+ // Doubling is basically arbitrary. JMSTimeToLive expresses request
+ // transmission and queue time. Doubling it allows request execution
+ // and response delivery to take up to the same amount of time.
+ // Note that explicitly coding a JMSTimeToLive of 0 results in
+ // a message that doesn't expire and an indefinite wait.
+ // - If JMSTimeToLive is not specified, get the default request
+ // timeout from the JMS resource factory and simply use that for the
+ // request timeout and JMSTimeToLive value.
+ if (!operation.isNonBlocking()) {
+ if (ttl != null) {
+ context.setRequestTimeout(ttl * 2);
+ } else {
+ long timeout = jmsResourceFactory.getDefaultRequestTimeout();
+ context.setRequestTimeout(timeout);
+ context.setTimeToLive(timeout);
+ }
+ }
try {
tuscanyMsg = endpointReference.getBindingInvocationChain().getHeadInvoker().invoke(tuscanyMsg);