In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
RabbitMQ message how to jump the queue, I believe many inexperienced people are helpless about this, this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
Message middleware is used in all big factories, which is a knowledge point that must be asked during the interview process. The group has always agreed to a harmonious society and refused to jump the queue. However, in special circumstances, it is possible to jump the queue, such as emergency in a hospital. So how do RabbitMQ messages jump the queue?
The problem is simple, RabbitMQ has priority queues. So RabbitMQ message queue priority can be used to solve the "queue jumping" problem.
Producer generates messages into switches (If there is no declaration switch, it will hit the default exchange), the switch binds one or more queues, the message enters the queue, the consumer has been listening to the queue, and when there is a message in the queue, it starts to consume. Here is a message delivery process, queue is a stack queue, the queue is first-in-first-out, that is, the message comes and queues in turn. A queue does not allow for queue jumping and priority push of messages. However, if we say that multiple queues have different priorities, messages of different priorities enter different queues through rootingkeys, and queue messages with higher priorities are preferentially consumed, this can also form a relative priority, so it is not the priority of the message but the priority of the queue.
RabbitMQ messages are not queue jumping, but it provides priority queues. Queue jumping is to rely on high-priority queue to achieve.
In RabbitMQ, there are two steps to set the priority of a message: setting the x-max-priority parameter of the queue and setting the Priority parameter of the message.
It's that simple. Once you've done that, you can verify the priority queue. Of course, it should be noted that if the speed of the consumer side is greater than that of the producer side, and there is no message accumulation in the broker, it is meaningless to set the priority of the message sent, because the sender has just sent a message and is consumed by the consumer side, so it is equivalent to the broker having at most one message, so the priority is meaningless for a single message.
After reading the above content, do you know how to jump the queue for RabbitMQ messages? If you still want to learn more skills or want to know more related content, welcome to pay attention to 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.