qianlongzt opened a new issue #615:
URL: https://github.com/apache/rocketmq-client-go/issues/615


   1. 在集群消费模式下,使用顺序消费。如果消费失败,会导致消费者卡死,不能继续消费,重启可以继续消费。
   
   
   代码中 顺序消费会 takeMessages,消息 会从 cacheMsg 到 consumingMsgOrderlyTreeMap
   
   
https://github.com/apache/rocketmq-client-go/blob/7e36c751e428c781eedf44704a77acd5bd0fe26c/consumer/process_queue.go#L268-L276
   
   如果消费失败,会putMessage 进msgCache。
   
   
https://github.com/apache/rocketmq-client-go/blob/7e36c751e428c781eedf44704a77acd5bd0fe26c/consumer/push_consumer.go#L1095-L1098
   
   putMessage 会判断是不是在msgCache 中,但是缺少 consumingMsgOrderlyTreeMap 
判断,导致顺序消费且消费失败的情况下,cachedMsgCount 一直增加。
   
   
https://github.com/apache/rocketmq-client-go/blob/7e36c751e428c781eedf44704a77acd5bd0fe26c/consumer/process_queue.go#L95-L105
   
   
   修复方法应该就是 在putMessage中判断 consumingMsgOrderlyTreeMap 是否存在。
   
   ```go
                _, found = pq.consumingMsgOrderlyTreeMap.Get(msg.QueueOffset)
                if found {
                        continue
                }
   ```
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to