response.setJMSCorrelationID(message.getJMSCorrelationID());
if (endpoint.isUseMsgIdInResponse()) { response.setJMSCorrelationID(message.getJMSMessageID()); } else { response.setJMSCorrelationID(message.getJMSCorrelationID()); }
    public void process(MessageExchange exchange) throws Exception {        Context context = (Context) pendingMessages.remove(exchange.getExchangeId());        Message message = (Message) context.getProperty(Message.class.getName());        Message response = null;        Connection connection = null;        try {            if (exchange.getStatus() == ExchangeStatus.DONE) {                return;            }            connection = connectionFactory.createConnection();            Session session = connection.createSession(true, Session.SESSION_TRANSACTED);            response = fromNMSResponse(exchange, context, session);            if (response != null) {                MessageProducer producer = session.createProducer(message.getJMSReplyTo());                response.setJMSCorrelationID(message.getJMSCorrelationID());                producer.send(response);            }        } finally {            if (connection != null) {                connection.close();            }            if (exchange.getStatus() == ExchangeStatus.ACTIVE) {                exchange.setStatus(ExchangeStatus.DONE);                channel.send(exchange);            }        }    }