private MessageExtBrokerInner messageTimeup(MessageExt msgExt) {
      MessageExtBrokerInner msgInner = new MessageExtBrokerInner();
      msgInner.setBody(msgExt.getBody());
      msgInner.setFlag(msgExt.getFlag());
      msgInner.setProperties(msgExt.getProperties());

      TopicFilterType topicFilterType = MessageExt.parseTopicFilterType(msgInner.getSysFlag());
      long tagsCodeValue =
          MessageExtBrokerInner.tagsString2tagsCode(topicFilterType, msgInner.getTags());
      msgInner.setTagsCode(tagsCodeValue);
      msgInner.setPropertiesString(MessageDecoder.messageProperties2String(msgExt.getProperties()));

      msgInner.setSysFlag(msgExt.getSysFlag());
      msgInner.setBornTimestamp(msgExt.getBornTimestamp());
      msgInner.setBornHost(msgExt.getBornHost());
      msgInner.setStoreHost(msgExt.getStoreHost());
      msgInner.setReconsumeTimes(msgExt.getReconsumeTimes());

      msgInner.setWaitStoreMsgOK(false);
      msgInner.clearProperty(Message.PROPERTY_DELAY_TIME_LEVEL);

      // 恢复Topic
      msgInner.setTopic(msgInner.getProperty(Message.PROPERTY_REAL_TOPIC));

      // 恢复QueueId
      String queueIdStr = msgInner.getProperty(Message.PROPERTY_REAL_QUEUE_ID);
      int queueId = Integer.parseInt(queueIdStr);
      msgInner.setQueueId(queueId);

      return msgInner;
    }
Esempio n. 2
0
  public MessageExtBrokerInner buildMessage() {
    MessageExtBrokerInner msg = new MessageExtBrokerInner();
    msg.setTopic("AAA");
    msg.setTags("TAG1");
    msg.setKeys("Hello");
    msg.setBody(MessageBody);
    msg.setKeys(String.valueOf(System.currentTimeMillis()));
    msg.setQueueId(Math.abs(QueueId.getAndIncrement()) % QUEUE_TOTAL);
    msg.setSysFlag(4);
    msg.setBornTimestamp(System.currentTimeMillis());
    msg.setStoreHost(StoreHost);
    msg.setBornHost(BornHost);

    return msg;
  }