if (replyDest == null) {
if (jmsBinding.getResponseDestinationName() != null) {
try {
replyDest = jmsResourceFactory.lookupDestination(jmsBinding.getResponseDestinationName());
} catch (NamingException e) {
throw new JMSBindingException("Exception lookingup response destination", e);
}
}
}
if (replyDest == null) {
// assume no reply is expected
if (msg.getBody() != null) {
logger.log(Level.FINE, "JMS service '" + service.getName() + "' dropped response as request has no replyTo");
}
return msg;
}
responseJMSMsg.setJMSDeliveryMode(requestJMSMsg.getJMSDeliveryMode());
responseJMSMsg.setJMSPriority(requestJMSMsg.getJMSPriority());
if (correlationScheme == null ||
JMSBindingConstants.CORRELATE_MSG_ID.equalsIgnoreCase(correlationScheme)) {
responseJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSMessageID());
} else if (JMSBindingConstants.CORRELATE_CORRELATION_ID.equalsIgnoreCase(correlationScheme)) {
responseJMSMsg.setJMSCorrelationID(requestJMSMsg.getJMSCorrelationID());
}
MessageProducer producer = session.createProducer(replyDest);
// Set jms header attributes in producer, not message.
int deliveryMode = requestJMSMsg.getJMSDeliveryMode();
producer.setDeliveryMode(deliveryMode);
int deliveryPriority = requestJMSMsg.getJMSPriority();
producer.setPriority(deliveryPriority);
producer.send((javax.jms.Message)msg.getBody());
producer.close();
context.closeJmsResponseSession();
return msg;
} catch (JMSException e) {
throw new JMSBindingException(e);
}
}