Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the concept of rabbitmq

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "what is the concept of rabbitmq". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and go deep into it slowly to study and learn "what is the concept of rabbitmq" together.

First of all, after installing RMQ and activating the Web management service (you need to pause the service first, then restart it and read the post), you can access it through http://localhost:15672 (username/password: guest/guest, although this is called guest, it is indeed super administrator privilege).

This page is actually very interesting, so far, I think very useful content is, he can see your declaration Queue, Exchange, RoutingKey (this has to click on a certain Exchange to see). What's the point of seeing all this? Most importantly, they are real! And it exists on the RMQ server! It does not exist in producers, nor does it exist in consumers. In other words, they don't die with your program! (Of course you program them to die, of course they die, I mean generally.) Well, to expand, if your program declares a Queue and an Exchange that don't die automatically, then the first run, these two objects are created, then they will exist forever, the second run, you don't have to declare again. This is why some of the parameters in RabbitMQ.Client are strings, not object instances of general class libraries.

The author did not clearly explain a few basic concepts:

1. Consumer takes messages directly from Queue without going through Exchange. Keep this in mind, and from all the APIs that fetch messages, only accept the name of Queue, which can be confirmed.

2. Producer to send messages, is not directly sent to Queue inside, must go through Exchange, and send messages must specify RoutingKey. This can also be confirmed by the API for sending messages.

3. Exchange and Queue (can be one-to-many) are bound to each other through RoutingKey, a "link"! Exchange, RoutingKey and Queue are closely related. Keep that in mind too! When sending messages, Exchange and RoutingKey need to be specified, Queue cannot be specified. That makes Sense! A bit like an MVC relationship (Producer is a Model that passes messages (with RoutingKey) to Exchange, Exchange is a Controller that dispatches messages to a specified Queue(s)).

4. There are four types of Exchange: Direct, Fanout, Topic, and Headers. This can be understood by looking at the next four pictures.

5. RMQ provides a default Exchange with an empty string name. It is of type Direct, bound to all Queue (and the RoutingKey between each Queue and the nameless Exchange is the name of the Queue). The author says this: Whenever you declare a Queue, there is a default Exchange. I don't know if he's right, but there's a default Exchange that's right. This is true without your explicit declaration.

Here is the PEQC diagram:

There are four types of Exchange: Direct, Fanout, Topic, and Headers.

1. When creating ConnectFactory, we can pass in host name, port number, username/password, virtual Host, etc.

2. You can also use ampq://username: password @ hostname: port number/%2f

3. Channel is a lightweight TCP/IP connection, while Connection is very Expensive.

4. Messages are not sent directly to Queue, but by Producer via Exchange.

5. Whenever a Queue is declared, it is automatically bound to the default Exchange. It cannot be untied, deleted or declared explicitly. It can only be used to send messages.

Thank you for reading, the above is the content of "rabbitmq concept is what", after the study of this article, I believe that everyone has a deeper understanding of what rabbitmq concept is, and the specific use situation needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

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.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report