You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please ask questions in Github Discussion, see Q&A Guidelines.
RongtongJin
changed the title
在设置 setMaxReconsumeTimes 后,消费端顺序消费,无限重试
After setMaxReconsumeTimes is set, the order consumer will retry indefinitely
Feb 23, 2023
你好!
版本:RocketMQ 5.0.0
情况概述:消费端只有一个消费者,设置 MaxReconsumeTimes 值为 1,调用DefaultMQPushConsumer 的顺序消费端口,在消费重试次数达到 1 后,消息被消费端投入延迟队列,随后 broker 重新将消息投入了重试队列,并没有投入死信队列;
个人源码走查:
消息在重试超过指定次数后,由消费端投递至延迟队列时,消息的重试次数 == 最大重新重试次数;
消息在延迟时间到达后,重新投递时调用 SendMessageProcessor.sendMessage 方法,内部调用了 SendMessageProcessor.handleRetryAndDLQ 方法进行判断消息是否投递死信队列(且没有将消息的重试次数进行增加)。
下面为 SendMessageProcessor.handleRetryAndDLQ 源码:
上述方法中进入死信队列的条件是 reconsumeTimes > maxReconsumeTimes,由延迟队列投递的顺序消息没满足条件,最终导致消息投入了重试队列,随后消费端拉取该消息,重复上面的流程(消息的 reconsumeTimes 并没有增加)。
我想问下这里是需要消费端在消费时自行增加 reconsumeTimes 吗?且只有消息从重试队列中那消息后才需要自行增加,还是bug 呢
The text was updated successfully, but these errors were encountered: