This is the 16th day of my participation in the November Gwen Challenge. Check out the event details: The last Gwen Challenge 2021

preface

The RocketMQ message retry mechanism is mainly considered in two aspects: 1. Producer message failure retry 2. The consumer message failed and retry.

RocketMQ single-server deployment

To simulate a RocketMQ message retry scenario, we can build a simple stand-alone version of RocketMQ.

1. Download RocketMQ

Go to the Apache website and download the RocketMQ installation package. Here, I downloaded RocketMQ version 4.5.2. On the CentOS 8 COMMAND-LINE interface (CLI), run the following command to download the RocketMQ installation package

Wget HTTP: / / http://mirrors.tuna.tsinghua.edu.cn/apache/rocketmq/4.5.2/rocketmq-all-4.5.2-bin-release.zipCopy the code

2. Install RocketMQ

  1. Unpack the
Unzip rocketmq - all - 4.5.2 - bin - release. ZipCopy the code

Producer Producer retry

Retry on the Producer End Generally, the Producer fails to send messages to THE MQ server. For example, the Producer fails to send messages to the MQ server due to network problems.

Consumer Consumer retry

In the actual project development process, we will probably focus more on the consumer side retry mechanism. Consumer retries are generally divided into two types, Exception and Timeout.