All Products
Search
Document Center

ApsaraMQ for RabbitMQ:Consumption retry policies

Last Updated:Oct 15, 2024

This topic describes the default consumption retry policies that are used by ApsaraMQ for RabbitMQ brokers. You can use the information in this topic to understand how failed messages are processed and how to select a message processing policy that meets your business requirements.

Consumption retry process

The consumption retry mechanism allows the system to automatically redeliver or process failed messages when a temporary fault occurs. This helps improve system reliability and data consistency.

  • Ready: The message is sent to the queue and available for consumption.

  • Unack: The message is received and is being processed by the consumer.

image

Attributes of consumption retry policies

A consumption retry policy consists of the following key attributes: consumption timeout period and maximum delivery attempts.

image

Consumption timeout period

Consumption timeout period is the maximum time period that is allowed for consumers to receive and process messages. If a consumer fails to consume a message during the consumption timeout period, the message enters the Ready state and can be obtained and processed by another consumer. The following items describe the reasons why you must specify a proper value for the consumption timeout period attribute:

  • To prevent requests from being suspended for an extended period of time: If you specify an improper value for the consumption timeout period attribute, requests may be suspended for an extended period of time during consumption. This causes the accumulation of other messages and affects the overall system performance.

  • To ensure the reliability of message processing: If a consumer cannot process a message for an extended period of time, ApsaraMQ for RabbitMQ delivers the message to another consumer to ensure that the message is processed at the earliest opportunity.

Maximum delivery attempts

Maximum delivery attempts refer to the maximum number of times that the system can deliver a message to a consumer. The following items describe the reasons why you must specify a proper value for the maximum delivery attempts attribute:

  • To prevent messages from being retried for an unlimited number of times: You can configure the maximum delivery attempts attribute to prevent messages from being retried for an unlimited number of times and system resources from being wasted.

  • To allow failovers: After the maximum number of delivery attempts is reached, the system forwards the failed message to the dead-letter queue for subsequent analysis and processing.

Note

The x-delivery-limit attribute of a queue specifies the maximum number of retries. The maximum number of delivery attempts is calculated by using the following formula: Maximum delivery attempts = Value of the x-delivery-limit attribute + 1.

Parameters of instance retry policies

Instance edition

Serverless Edition

Professional Edition

Enterprise Edition

Enterprise Platinum Edition

Consumption timeout period

15 minutes

Default value: 5 minutes

10 minutes

Default value: 1 minute

15 minutes

Default value: 5 minutes

60 minutes

Default value: 30 minutes

Maximum delivery attempts

16

Default value: 16

16

Default value: 16

16

Default value: 16

64

Default value: 16

Modify a consumption retry policy

Important

After you modify the consumption retry policy for a queue, the new policy takes effect only after you restart the consumer application.

  1. Log on to the ApsaraMQ for RabbitMQ console.

  2. In the Resource Distribution section of the Overview page, select the region where your instance resides. Then, click the name of the instance in the instance list.

    • Retry policy of an instance

      1. On the Instance Details page, click the Retry Policy tab and then click Edit in the upper-right corner of the tab.

      2. In the Modify Retry Policy panel, configure the Maximum Number of Deliveries and Consumption Timeout Period parameters based on the descriptions in the preceding section.

    • Retry policy of a queue

      1. In the left-side navigation pane of the Instance Details page, click Queues. Then, click the name of the queue that you want to manage.

      2. On the Queue Details page, click the Retry Policy tab and then click Edit in the upper-right corner of the tab.

      3. In the Modify Retry Policy panel, configure the Inherit Instance Configurations, Maximum Number of Deliveries, and Consumption Timeout Period parameters based on the descriptions in the preceding section.

        image

        • If you set the Inherit Instance Configurations parameter to Yes, the retry policy of the queue changes with the retry policy of the instance to which the queue belongs.

        • If you set the Inherit Instance Configurations parameter to No, the retry policy of the queue does not change with the retry policy of the instance to which the queue belongs and the retry policy of the queue has a higher priority than the retry policy of the instance.

  3. Click OK.