All Products
Search
Document Center

How should I retry if my message consumption fails

Last Updated: Mar 28, 2019

Clustering consumption

If the logic code of the consumption service returns Action.ReconsumerLater or NULL, or throws an exception, the message will undergo the retry process, and will retry at most 16 times. If the message fails after retrying 16 times, it will be discarded. Interval between two retries is as follows:

Retry number Retry interval
1 10s
2 30s
3 1 min
4 2 min
5 3 min
6 4 min
7 5 min
8 6 min
9 7 min
10 8 min
11 9 min
12 10 min
13 20 min
14 30 min
15 1 h
16 2 h

The message.getReconsumeTimes() method can be called to obtain the number of message retries.

Broadcasting consumption

Broadcasting consumption can ensure that a message will be consumed at least once, but will not retry after a consumption fails.