In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
It is believed that many inexperienced people are at a loss about how to realize the consumption of dead message by distributed message service DMS. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
What's the dead letter message?
Dead letter messages refer to messages that cannot be consumed normally. The distributed message service DMS supports exception handling of messages. When the repeated consumption of a message still fails, DMS will forward the message to the dead-letter queue with a validity period of 72 hours. Users can re-consume the dead-letter message as needed. When consuming dead letter messages, only the dead letter messages generated by this consumer group can be consumed. The dead-letter messages of globally ordered ordinary queues are still stored in the dead-letter queue in the order of first-in first-out (FIFO).
How to consume dead letter messages
Consume the dead letter messages generated by the specified consumer group. Multiple messages can be consumed at the same time, and the message load consumed each time does not exceed 512KB. Only NORMAL queues and FIFO queues can open dead-letter messages, because only NORMAL and FIFO queues can consume dead-letter messages.
URI
GET / v1.0 / {project_id} / queues/ {queue_id} / groups/ {consumer_group_id} / deadletters?max_msgs= {max_msgs} & time_wait= {time_wait} & ack_wait= {ack_wait}
For the description of the parameters, please see the following table:
Name
Types
Is it required?
Description
Value range
Project_id
String
Yes
Project ID.
N/A
Queue_id
String
Yes
The specified queue ID.
N/A
Consumer_group_id
String
Yes
The ID of the consumer group. Gets the consumer group ID from viewing the response messages for all consumer groups in the specified queue.
N/A
Max_msgs
Int
No
Gets the number of dead letter messages that can be consumed.
Description:
The number of messages returned by a single consumption may be less than the specified number, but multiple consumption will eventually get all the messages.
Value range: 1-10.
Default value: 10
Time_wait
Int
No
Set the read message wait time when the consumable dead letter in the consumption group is 0.
If there is a new dead letter message within the waiting time, the consumption result is returned immediately. If there is no new dead letter message within the waiting time, the consumption result is returned after the waiting time.
Value range: 1 "60s"
Default value: 3s
Note: without this parameter or if the configuration is empty, the default is 3s.
Ack_wait
Int
No
Commit submission timeout, within which confirmation is submitted and the confirmation is valid. If the specified time is exceeded, the system will report a message confirmation timeout, or the handler is invalid.
Value range: 1500s
Default value: 30s
Note: without this parameter or if the configuration is empty, the default is 30s.
Response parameter
Parameters.
Types
Description
Message
JSON object
The content of the message
Handler
String
Message handler
Message parameter
Parameters.
Types
Description
Body
JSON
The content of the message body.
Attributes
JSON object
A list of properties.
How to confirm that dead letter messages have been consumed
During the period when the consumer consumes the dead letter message, the dead letter message still stays in the queue, but the dead letter message cannot be consumed again by the consumption group within 30 seconds from the beginning of the consumption. If the consumption is not confirmed by the consumer within these 30 seconds, DMS believes that the dead letter message is not successfully consumed and can continue to be consumed.
If the dead letter message is confirmed to be consumed successfully, the dead letter message cannot be consumed by the consumer group again. The retention time of the dead letter message is 72 hours (unless the consumer group is deleted), and it will be deleted after 72 hours.
When confirming the bulk consumption of messages, the confirmation must be submitted strictly according to the order of message consumption. DMS determines whether the message consumption is successful or not. If a message is not confirmed or the consumption fails, it will not continue to be detected. By default, all subsequent message consumption fails. It is recommended that when the processing of a message fails, it is no longer necessary to continue to process the subsequent messages in this batch of messages, and directly confirm the messages that have been processed correctly.
Note that only NORMAL queues and FIFO queues can turn on dead-letter messages, because only NORMAL and FIFO queues can consume dead-letter messages.
URI
POST / v1.0/ {project_id} / queues/ {queue_id} / groups/ {consumer_group_id} / deadletters/ack
For the description of the parameters, please see the following table:
Name
Types
Is it required?
Description
Project_id
String
Yes
Project ID.
Queue_id
String
Yes
Queue ID.
Consumer_group_id
String
Yes
Consumer group ID.
The request parameters and message parameters are shown in the following table:
Name
Types
Is it required?
Description
Message
Array
Yes
An array of confirmation messages.
Name
Types
Is it required?
Description
Handler
String
Yes
The ID returned during consumption.
Status
String
Yes
The state in which the client processes the data.
Value is "success" or "fail".
Response parameter
The response parameters are shown in the following table:
Parameters.
Types
Description
Success
Int
The number of successful confirmations (N means that the first N dead letter messages were confirmed successfully).
Fail
Int
The number of confirmation failures (N means that the confirmation of the last N dead messages failed).
After reading the above, have you mastered how the distributed message service DMS implements the consumption of dead messages? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.