// 根据 timestamp 查找对应的offset
long offset =
this.mqClientInstance.getMQClientAPIImpl().searchOffset(addr, topic,
queue.getQueueId(), timestamp, 3000);
// 构建按时间回溯消费进度
RollbackStats rollbackStats = new RollbackStats();
rollbackStats.setBrokerName(bd.getBrokerName());
rollbackStats.setQueueId(queue.getQueueId());
rollbackStats.setBrokerOffset(offsetWrapper.getBrokerOffset());
rollbackStats.setConsumerOffset(offsetWrapper.getConsumerOffset());
rollbackStats.setTimestampOffset(offset);
rollbackStats.setRollbackOffset(offsetWrapper.getConsumerOffset());
// 更新 offset
if (force || offset <= offsetWrapper.getConsumerOffset()) {
rollbackStats.setRollbackOffset(offset);
UpdateConsumerOffsetRequestHeader requestHeader =
new UpdateConsumerOffsetRequestHeader();
requestHeader.setConsumerGroup(consumerGroup);
requestHeader.setTopic(topic);
requestHeader.setQueueId(queue.getQueueId());