if (exchange.getPattern().isOutCapable()) {
// create a temporary queue and consumer for responses...
// note due to JMS transaction semantics we cannot use a single transaction
// for sending the request and receiving the response
Requestor requestor;
try {
requestor = endpoint.getRequestor();
} catch (Exception e) {
throw new RuntimeExchangeException(e, exchange);
}
final Destination replyTo = requestor.getReplyTo();
String correlationId = in.getHeader("JMSCorrelationID", String.class);
if (correlationId == null) {
correlationId = getUuidGenerator().generateId();
in.setHeader("JMSCorrelationID", correlationId);
}
// lets register the future object before we try send just in case
long requestTimeout = endpoint.getRequestTimeout();
FutureTask future = requestor.getReceiveFuture(correlationId, requestTimeout);
getInOutTemplate().send(endpoint.getDestination(), new MessageCreator() {
public Message createMessage(Session session) throws JMSException {
Message message = endpoint.getBinding().makeJmsMessage(exchange, in, session);
message.setJMSReplyTo(replyTo);