Retry队列是什么
当消息消费失败时,消费者会将消息发往retry队列,等待重试
Retry队列的命名方式为:%RETRY%GROUP_NAME,也就是说每个消费组都会有自己独立的Retry队列
生产逻辑
RequestCode:CONSUMER_SEND_MSG_BACK
脉络图如下:
Client端
Concurrently模式
在以下几种情况下会向Retry队列发送该条消息
- 当消息消费失败返回RECONSUME_LATER,并且是Clustering模式时
- 清理本地超时消息(已拉取缓存在内存中的消息)
public void processConsumeResult(
final ConsumeConcurrentlyStatus status,
final ConsumeConcurrentlyContext context,
final ConsumeRequest consumeRequest
) {
switch (this.defaultMQPushConsumer.getMessageModel()) {
case BROADCASTING:
for (int i = ackIndex + 1; i < consumeRequest.getMsgs().size(); i++) {
MessageExt msg = consumeRequest.getMsgs().get(i);
log.warn("BROADCASTING, the message consume failed, drop it, {}", msg.toString());
}
break;
case CLUSTERING:
List<MessageExt> msgBackFailed = new ArrayList<MessageExt>(consumeRequest.getMsgs().size());