summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms
diff options
context:
space:
mode:
authorbdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68>2010-09-10 18:16:14 +0000
committerbdaniel <bdaniel@13f79535-47bb-0310-9956-ffa450edef68>2010-09-10 18:16:14 +0000
commit817ae75361395bafee6a520b96a9f07ba300675e (patch)
tree513ba96d0d1a8cb13cec70601ce551ad25518346 /sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms
parenteb89d828186360191296154d0bafb4fe4465ad96 (diff)
BJM_6015D Make sure scaCallbackDestination property is honored
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@995916 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms')
-rw-r--r--sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java33
1 files changed, 15 insertions, 18 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 2245f61ee7..541f47636f 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,11 +18,12 @@
*/
package org.apache.tuscany.sca.binding.jms.wire;
-import javax.jms.Destination;
+import java.util.List;
+
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;
@@ -35,10 +36,12 @@ import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
public class CallbackDestinationInterceptor implements Interceptor {
private Invoker next;
private RuntimeComponentService service;
+ private RuntimeEndpoint endpoint;
public CallbackDestinationInterceptor(RuntimeEndpoint endpoint) {
super();
this.service = (RuntimeComponentService) endpoint.getService();
+ this.endpoint = endpoint;
}
public Invoker getNext() {
@@ -57,26 +60,20 @@ public class CallbackDestinationInterceptor implements Interceptor {
try {
// get the jms context
JMSBindingContext context = msg.getBindingContext();
- javax.jms.Message jmsMsg = context.getJmsMsg();
-
- //ReferenceParameters parameters = msg.getFrom().getReferenceParameters(); TODO: 2.x migration, are these needed?
-
+ javax.jms.Message jmsMsg = context.getJmsMsg();
+
if (service.getInterfaceContract().getCallbackInterface() != null) {
String callbackdestName = jmsMsg.getStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY);
- if (callbackdestName == null && msg.getOperation().isNonBlocking()) {
- // if the request has a replyTo but this service operation is oneway but the service uses callbacks
- // then use the replyTo as the callback destination
- Destination replyTo = jmsMsg.getJMSReplyTo();
- if (replyTo != null) {
- callbackdestName = (replyTo instanceof Queue) ? ((Queue) replyTo).getQueueName() : ((Topic) replyTo).getTopicName();
- }
- }
if (callbackdestName != null) {
- // append "jms:" to make it an absolute uri so the invoker can determine it came in on the request
- // as otherwise the invoker should use the uri from the service callback binding
-// parameters.setCallbackReference(new EndpointReferenceImpl("jms:" + callbackdestName));
+ List<EndpointReference> refs = endpoint.getCallbackEndpointReferences();
+ for (EndpointReference ref : refs ) {
+ if (ref.getBinding() instanceof JMSBinding ) {
+ JMSBinding callbackBinding = (JMSBinding) ref.getBinding();
+ callbackBinding.setDestinationName(callbackdestName);
+ }
+ }
}
String callbackID = jmsMsg.getStringProperty(JMSBindingConstants.CALLBACK_ID_PROPERTY);