summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk
diff options
context:
space:
mode:
Diffstat (limited to 'sca-java-2.x/trunk')
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java32
-rw-r--r--sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java15
2 files changed, 35 insertions, 12 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java
index 9e14ad0b1a..f7573b182b 100644
--- a/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java
+++ b/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java
@@ -18,25 +18,23 @@
*/
package org.apache.tuscany.sca.binding.jms.wire;
-import java.util.List;
-
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Queue;
import javax.jms.Topic;
-import org.apache.tuscany.sca.assembly.EndpointReference;
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.core.invocation.InterceptorAsyncImpl;
-import org.apache.tuscany.sca.invocation.Interceptor;
import org.apache.tuscany.sca.invocation.Invoker;
import org.apache.tuscany.sca.invocation.Message;
import org.apache.tuscany.sca.runtime.RuntimeComponentService;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+import org.apache.tuscany.sca.assembly.Binding;
+
/**
* JMS Binding Interceptor class that deals with a callback destination address on the service side
*
@@ -99,13 +97,25 @@ public class CallbackDestinationInterceptor extends InterceptorAsyncImpl {
// Place the Callback destination name into the Callback EPRs for the service endpoint
if (callbackdestName != null) {
- List<EndpointReference> refs = endpoint.getCallbackEndpointReferences();
- for (EndpointReference ref : refs ) {
- if (ref.getBinding() instanceof JMSBinding ) {
- JMSBinding callbackBinding = (JMSBinding) ref.getBinding();
- callbackBinding.setDestinationName(callbackdestName);
- } // end if
- } // end for
+ for (Binding b : service.getCallback().getBindings()) {
+ if (b instanceof JMSBinding) {
+ JMSBinding callbackBinding;
+ try {
+ callbackBinding = (JMSBinding)((JMSBinding)b).clone();
+ } catch (CloneNotSupportedException e) {
+ throw new RuntimeException(e);
+ }
+ callbackBinding.setDestinationName(callbackdestName);
+ msg.getHeaders().put("CALLBACK_BINDING", callbackBinding);
+ }
+ }
+// List<EndpointReference> refs = endpoint.getCallbackEndpointReferences();
+// for (EndpointReference ref : refs ) {
+// if (ref.getBinding() instanceof JMSBinding ) {
+// JMSBinding callbackBinding = (JMSBinding) ref.getBinding();
+// callbackBinding.setDestinationName(callbackdestName);
+// } // end if
+// } // end for
} // end if
// Callback ID not used at present
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
index 9dba10f605..fb8249544e 100644
--- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
+++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
@@ -150,7 +150,20 @@ public class CallbackServiceReferenceImpl<B> extends ServiceReferenceImpl<B> {
}
}
}
-/*
+
+ // This is used by the JMS binding to enable setting the JMS callback destination from the
+ // request, see CallbackDestinationInterceptor in the JMS binding module. It gets the JMS
+ // compliance tests passing again but doesn't seem like the perfect fix, when the changes
+ // mentioned below for TUSCANY-3932 happen it should fix this properly.
+ Message msgContext = ThreadMessageContext.getMessageContext();
+ if (msgContext != null){
+ Binding b = (Binding)msgContext.getHeaders().get("CALLBACK_BINDING");
+ if (b != null) {
+ endpointReference.setBinding(b);
+ }
+ }
+
+ /*
// TUSCANY-3932
// If the resolved endpoint has a binding with a absolute URI then assume
// that URL has been passed in in the forward message and really treat it