In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
RabbitMQ delay message delay is how much, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Problem positioning
Because not all messages have no delay effect, through the problematic characteristics of the message, it is generally speculated that the long delay time may have led to the failure of message delay. To verify this reason, take the example in the previous article to test whether the delay time is directly related to the problem.
Use the API example (complete code is available in the Git repository at the end of the article) to modify the previous delay message, and add a request parameter delay to control the delay time:
@ GetMapping ("/ sendMessage") public String messageWithMQ (@ RequestParam String message, @ RequestParam Long delay) {log.info ("Send:" + message); testTopic.output () .send (MessageBuilder.withPayload (message) .setHeader ("x-delay", delay). Build (); return "ok";}
Then two requests were attempted:
Request 1: delay 5000 milliseconds. After the message was sent to MQ, there was indeed a delay of 5 seconds before it was consumed, without any problem.
Curl localhost:8080/sendMessage?message=hello&delay=5000
Request 2: delay of 1 year (31536000000 milliseconds). The message is consumed by consumers as soon as it is sent to MQ, with no delay effect at all.
Summary of curl localhost:8080/sendMessage?message=hello&delay=31536000000 problem
After you have identified the cause of the problem, you need to make some clear restrictions on the time of this function (the limit of delay time) to avoid similar problems. Further exploration shows that the failure here is directly related to the expiration time (TTL) of the message. In RabbitMQ, the expiration time of a message must be a non-negative 32-bit integer, that is, 0
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.