diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2008-07-15 09:17:05 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2008-07-15 09:17:05 +0000 |
commit | 20777692c2aea486ad8a568f61fa423213acedf1 (patch) | |
tree | b2eef51b8ce69a58126dc3697b3b81048ffbc006 /java/sca/modules/binding-jms-runtime | |
parent | 6048239c0ae566f82dccb2ef2ad879997c21b43b (diff) |
Comment out support for physical destination names as it doesn't work properly yet, add support for the scaConversationId header
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@676844 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/binding-jms-runtime')
3 files changed, 54 insertions, 10 deletions
diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java index c2e971fe1d..706a0e049c 100644 --- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingInvoker.java @@ -260,7 +260,7 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics { requestMsg.setJMSDeliveryMode(jmsBinding.getDeliveryMode()); requestMsg.setJMSPriority(jmsBinding.getPriority()); - setCallbackHeaders(tuscanyMsg, requestMsg); + setHeaders(tuscanyMsg, requestMsg); requestMessageProcessor.setOperationName(operationName, requestMsg); requestMsg.setJMSReplyTo(replyToDest); @@ -294,7 +294,7 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics { return requestDestination; } - protected void setCallbackHeaders(org.apache.tuscany.sca.invocation.Message tuscanyMsg, Message jmsMsg) throws JMSException { + protected void setHeaders(org.apache.tuscany.sca.invocation.Message tuscanyMsg, Message jmsMsg) throws JMSException { if (hasCallback()) { ReferenceParameters parameters = tuscanyMsg.getFrom().getReferenceParameters(); @@ -307,6 +307,11 @@ public class JMSBindingInvoker implements Invoker, DataExchangeSemantics { if (callbackDestName != null) { jmsMsg.setStringProperty(JMSBindingConstants.CALLBACK_Q_PROPERTY, callbackDestName); } + + Object conversationID = parameters.getConversationID(); + if (conversationID != null) { + jmsMsg.setStringProperty(JMSBindingConstants.CONVERSATION_ID_PROPERTY, conversationID.toString()); + } } } diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java index f04ef38f26..6f5f571cb5 100644 --- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSBindingListener.java @@ -126,21 +126,18 @@ public class JMSBindingListener implements MessageListener { tuscanyMsg.setBody(requestPayload); tuscanyMsg.setOperation(operation); - setCallbackProperties(requestJMSMsg, tuscanyMsg, operation); + setHeaderProperties(requestJMSMsg, tuscanyMsg, operation); return service.getRuntimeWire(jmsBinding).invoke(operation, tuscanyMsg); } - protected void setCallbackProperties(Message requestJMSMsg, MessageImpl tuscanyMsg, Operation operation) throws JMSException { + protected void setHeaderProperties(Message requestJMSMsg, MessageImpl tuscanyMsg, Operation operation) throws JMSException { if (service.getInterfaceContract().getCallbackInterface() != null) { EndpointReference from = new EndpointReferenceImpl(null); tuscanyMsg.setFrom(from); - from.setCallbackEndpoint(new EndpointReferenceImpl("/")); // TODO: - // whats - // this - // for? + from.setCallbackEndpoint(new EndpointReferenceImpl("/")); // TODO: whats this for? ReferenceParameters parameters = from.getReferenceParameters(); @@ -164,6 +161,11 @@ public class JMSBindingListener implements MessageListener { if (callbackID != null) { parameters.setCallbackID(callbackID); } + + String conversationID = requestJMSMsg.getStringProperty(JMSBindingConstants.CONVERSATION_ID_PROPERTY); + if (conversationID != null) { + parameters.setConversationID(conversationID); + } } } diff --git a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java index e4a403e0b2..97dbc208a9 100644 --- a/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java +++ b/java/sca/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/JMSResourceFactory.java @@ -29,6 +29,7 @@ import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; +import org.apache.tuscany.sca.binding.jms.impl.JMSBindingConstants; import org.apache.tuscany.sca.binding.jms.impl.JMSBindingException; /** @@ -144,8 +145,44 @@ public class JMSResourceFactory { } } - public Destination lookupDestination(String jndiName) throws NamingException { - return (Destination)jndiLookUp(jndiName); + public Destination lookupDestination(String destName) throws NamingException { + if (JMSBindingConstants.DEFAULT_DESTINATION_NAME.equals(destName)) { + return null; + } + + Destination dest = (Destination)jndiLookUp(destName); + if (dest == null) { + dest = lookupPhysical(destName); + } + return dest; + } + + protected Destination lookupPhysical(String jndiName) { + + // TODO: the SCA JMS spec says a destination name may be a non-jndi plain destination name + +// Session session = null; +// try { +// +// Destination dest; +// session = createSession(); +// dest = session.createQueue(jndiName); +// return dest; +// +// } catch (JMSException e) { +// throw new JMSBindingException(e); +// } catch (NamingException e) { +// throw new JMSBindingException(e); +// } finally { +// if (session != null) { +// try { +// session.close(); +// } catch (JMSException e) { +// throw new JMSBindingException(e); +// } +// } +// } + return null; } /** |