コード例 #1
0
  @Override
  public void run() {
    try {
      Message message = getMessage();
      Destination tq = message.getReplyTo();

      RESP resp = process(false, tq);

      if (resp != null) {

        Message responseMsg = getSession().createMessage(resp, getPayloadType());
        // stamp the message
        responseMsg.setProperty("TIMESTAMP", System.currentTimeMillis());
        // copy the correlation id from the incoming message
        responseMsg.setCorrelationID(message.getCorrelationID());

        if (tq != null) {
          MessageProducer qsender = getSession().createProducer(tq);
          try {
            qsender.send(tq, responseMsg);
          } finally {
            qsender.close();
          }
        }
      }

      if (isClientAck()) {
        message.acknowledge();
      }
    } catch (Exception e) {
      logger.error(e);
    }
  }