[RabbitMQ] A brief introduction to basic terms and consoles
References: "RabbitMQ Practical Guide"
For other related concepts and installation, please click: [RabbitMQ] Basic related concepts and installation
1.RabbitMQ basic nouns
- RabbitMQ model architecture
I think this paragraph in the book is very appropriate. RabbitMQ is essentially a model of producers and consumers.
The message is sent by the producer . The message contains two parts, the message label and the message body. The message body is naturally the data we send, and the label is the identifier of the message body, just like the header information in http, such as an exchanger. The name and a routing key, both of which are rabbitmq nouns, will be explained in more detail later.
The consumer connects to the rabbitmq server and subscribes to a message queue to accept messages in the queue. What is received is only the message body and does not know who the producer is. The timing and speed of consumption can be set by oneself.
rabbitMQ Broker is actually a service node, or a service instance, or server. The above process book also shows:
- related nouns:
Let’s first look at a big picture, which contains more detailed content. Next,
we will briefly introduce the functions of each component.- The Broker
service node, like the rabbitMQ Broker mentioned above, is an application that receives and distributes messages. RabbitMQ Server is the Message Broker. - Virtual host
, also referred to as virtual machine, is designed for multi-tenancy and security reasons. RabbitMQ divides the basic components of AMQP into a virtual group, similar to the concept of namespace in the network. When multiple different users use the services provided by the same RabbitMQ server, multiple vhosts can be divided, and each user creates exchange/queue, etc. in their own vhost. - Connection
connection, the TCP connection required for communication between publisher producers and consumers and broker service nodes. - Channel
channel, information channel, if a Connection is established every time RabbitMQ is accessed, the overhead of establishing a TCP Connection will be very huge and the efficiency will be low when the message volume is large. Channel is a logical connection established inside the connection. If the application supports multi-threading, each thread usually creates a separate channel for communication. The AMQP method contains the channel id to help the client and message broker identify the channel, so the channels are completely isolated. of. Channel, as a lightweight Connection, greatly reduces the operating system's overhead in establishing TCP connections. There are also channel-related concepts in the network IO model. - Queue
message queue, referred to as queue, messages sent by producers will be distributed by the switch, and then stored in the corresponding queue, waiting to be taken (consumed) by consumers.
- Exchange
switch, the message sent by the producer reaches the first stop of the broker, which is abbreviated as an English capital X. According to the distribution rules, it matches the routing key (routing key) in the query table and distributes the message to the queue (queue). There are three commonly used types: direct (point-to-point), topic (publish-subscribe) and fanout broadcast (multicast).
- RoutingKey
routing key, the value that the producer needs to specify when sending a message, is the message label in the above message. The switch will distribute it to the corresponding queue based on this routing key. - Binding and BindingKey
bind and bind key. Binding is an action, which is an action to establish a connection between the switch and the queue. Binding key is a specific value that needs to be used during binding. For example, producer The routing key sent is abc123, which is sent to switch X. When queue A and switch X are bound, the binding key is abc123. If they match, the virtual machine will forward the message to queue A.
Replenish:
- The Broker
2. Brief introduction to RabbitMQ console
-
Overview
-
Totals Overview
Overview of all content. -
Nodes
You can observe the status information of all rabbitmq nodes in the cluster in this tab. We do not have a cluster here, so we only have one local service node.
-
All port number Prots and web information monitored are our management plug-in information.
-
Import and export node definition information json format
-
-
Connections
All information connected to this service node can be viewed here, including producer and consumer connections. -
Channels
Information channels, all information channels connected to rabbitmq can be viewed here, and are sub-content of Connections. -
Exchanges
View all switches and create a switch via page input here. Of course, it is not recommended to create it this way. It will definitely be more intuitive if we create it in the code. This is also a creation channel, just understand it. Inside are all the switches that come with it by default. -
Queue
Queue, there is no default queue and it is empty by default. You can still create a queue through the page. -
Admin
User window
We can simply create a user and a virtual host.
Create a virtual host:
Create a new user and bind the virtual host to the new user:
At this time, there is no virtual host under the account and its corresponding
virtual host is bound to it. At the same time, the guest Remove the permissions:
logout and then log in with a new user:
OK
that's all.