Uploaded image for project: 'Apache RocketMQ'
  1. Apache RocketMQ
  2. ROCKETMQ-237

ConsumeFromWhere.CONSUME_FROM_TIMESTAMP not work

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 4.0.0-incubating, 4.1.0-incubating
    • None
    • rocketmq-client
    • None

    Description

      When I create a New ConsumeGroup and setConsumeTimestamp use the following code:

      this.defaultMQPushConsumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_TIMESTAMP);           this.defaultMQPushConsumer.setConsumeTimestamp(MQ_MSG_CONSUME_TIMESTAMP);
      
      ms.mq.consume.timestamp=20170630120000
      

      I notice that ReblancePushImpl 161# The field lastOffset always return 0:
      Maybe as a new group ,should return -1?

      case CONSUME_FROM_TIMESTAMP: {
                      long lastOffset = offsetStore.readOffset(mq, ReadOffsetType.READ_FROM_STORE);
                      if (lastOffset >= 0) {
                          result = lastOffset;
                      } else if (-1 == lastOffset) {
                          if (mq.getTopic().startsWith(MixAll.RETRY_GROUP_TOPIC_PREFIX)) {
                              try {
                                  result = this.mQClientFactory.getMQAdminImpl().maxOffset(mq);
                              } catch (MQClientException e) {
                                  result = -1;
                              }
                          } else {
                              try {
                                  long timestamp = UtilAll.parseDate(this.defaultMQPushConsumerImpl.getDefaultMQPushConsumer().getConsumeTimestamp(),
                                      UtilAll.YYYYMMDDHHMMSS).getTime();
                                  result = this.mQClientFactory.getMQAdminImpl().searchOffset(mq, timestamp);
                              } catch (MQClientException e) {
                                  result = -1;
                              }
                          }
                      } else {
                          result = -1;
                      }
                      break;
                  }
      

      Attachments

        Activity

          People

            vintagewang Xiaorui Wang
            Jinglee JineLee
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: