Rocketmq: 消息已经消费成功,而且消费了1 次,但是在rocketmq-console中 NOT_CONSUME_YET

Created on 24 Oct 2018  ·  4Comments  ·  Source: apache/rocketmq

BUG REPORT

  1. Please describe the issue you observed:
    消息明明已经消费成功了. 但是在rocketmq-console中显示的是NOT_CONSUME_YET
  2. What did you do (The steps to reproduce)?
  • What did you expect to see?

  • What did you see instead?

  1. Please tell us about your environment:
    centos
  2. Other information (e.g. detailed explanation, logs, related issues, suggestions how to fix, etc):
    用的是 rocketmq 4.0 版本
    image
bug

Most helpful comment

问题出在 域名和ip 的判断上
修改 这个类DefaultMQAdminExtImpl 的
public boolean consumed(final MessageExt msg, final String group)
方法
```
public boolean consumed(final MessageExt msg, final String group)
throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
log.info("开始检测消息是否已消费",group,msg);
ConsumeStats cstats = this.examineConsumeStats(group);

    ClusterInfo ci = this.examineBrokerClusterInfo();

    Iterator<Entry<MessageQueue, OffsetWrapper>> it = cstats.getOffsetTable().entrySet().iterator();
    log.info("it",it);
    while (it.hasNext()) {
        Entry<MessageQueue, OffsetWrapper> next = it.next();
        MessageQueue mq = next.getKey();
        if (mq.getTopic().equals(msg.getTopic()) && mq.getQueueId() == msg.getQueueId()) {
            BrokerData brokerData = ci.getBrokerAddrTable().get(mq.getBrokerName());
            log.info("服务器上的数据:",brokerData);
            if (brokerData != null) {
                String addr = brokerData.getBrokerAddrs().get(MixAll.MASTER_ID);
                log.info("dizhi:",addr,RemotingUtil.socketAddress2String(msg.getStoreHost()));
                log.info("haode:",next.getValue().getConsumerOffset() , msg.getQueueOffset());
                if (next.getValue().getConsumerOffset() > msg.getQueueOffset()) {
                    System.out.println("一个是域名一个是ip地址实际上是一样的.也返回true1");
                    return true;
                }

// if (addr.equals(RemotingUtil.socketAddress2String(msg.getStoreHost()))) {
// }
}
}else{
log.info("mq条件判断失败",mq);
}
}

    return false;
} ```

All 4 comments

问题出在 域名和ip 的判断上
修改 这个类DefaultMQAdminExtImpl 的
public boolean consumed(final MessageExt msg, final String group)
方法
```
public boolean consumed(final MessageExt msg, final String group)
throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
log.info("开始检测消息是否已消费",group,msg);
ConsumeStats cstats = this.examineConsumeStats(group);

    ClusterInfo ci = this.examineBrokerClusterInfo();

    Iterator<Entry<MessageQueue, OffsetWrapper>> it = cstats.getOffsetTable().entrySet().iterator();
    log.info("it",it);
    while (it.hasNext()) {
        Entry<MessageQueue, OffsetWrapper> next = it.next();
        MessageQueue mq = next.getKey();
        if (mq.getTopic().equals(msg.getTopic()) && mq.getQueueId() == msg.getQueueId()) {
            BrokerData brokerData = ci.getBrokerAddrTable().get(mq.getBrokerName());
            log.info("服务器上的数据:",brokerData);
            if (brokerData != null) {
                String addr = brokerData.getBrokerAddrs().get(MixAll.MASTER_ID);
                log.info("dizhi:",addr,RemotingUtil.socketAddress2String(msg.getStoreHost()));
                log.info("haode:",next.getValue().getConsumerOffset() , msg.getQueueOffset());
                if (next.getValue().getConsumerOffset() > msg.getQueueOffset()) {
                    System.out.println("一个是域名一个是ip地址实际上是一样的.也返回true1");
                    return true;
                }

// if (addr.equals(RemotingUtil.socketAddress2String(msg.getStoreHost()))) {
// }
}
}else{
log.info("mq条件判断失败",mq);
}
}

    return false;
} ```

@xingzhefeng 既然问题已经找到啦,欢迎提个pr到external里面呀,

great!
用我们老家话说 小伙子得劲得很

use IP addr instead of domain name or host name to config brokerIP1 and brokerIP2 would be better

Was this page helpful?
0 / 5 - 0 ratings