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
This commit is contained in:
parent
6048239c0a
commit
20777692c2
4 changed files with 55 additions and 10 deletions
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -67,5 +67,6 @@ public interface JMSBindingConstants {
|
|||
|
||||
String CALLBACK_ID_PROPERTY = "CallbackID";
|
||||
String CALLBACK_Q_PROPERTY = "scaCallbackQueue ";
|
||||
String CONVERSATION_ID_PROPERTY = "scaConversationId";
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue