Rabbitmq Study Notes 2-Understanding messaging

Source: Internet
Author: User

The message contains two parts: 1. payload-the data you want to transmit. 2. lable-describes information about a payload, including the specific switch and recipient of the message.

The basic process of rabbitmq is as follows:

The client and server of rabbitmq communicate with the rabbitmq server through a channel.

Channel: the connection between the program and rabbitmq is through the channel, and the channel is based on the TCP protocol ?, A TCP connection can have multiple channels, which are similar to the following: a large cable contains many small wires. A large cable is a TCP connection and a small wire is a channel, why is this design necessary? Because the system creates and destroys TCP connections, multiple non-conflicting communication operations on one TCP can greatly increase the efficiency.


The message routing of amqp must contain three parts:Exchange, queue, bind).

1. Queue (Queue):The place where messages are stored and waiting for consumers to obtain them. Consumers can receive messages from queue in the following two ways.

(1) subscribe through amqp's basic. Consume command. In this way, the channel is set to the receiving mode until the queue subscription is canceled. After subscribing to a message, the consumer can automatically receive the next message from the queue (available) after consuming (or rejecting) The message recently received.In this subscription mode, after the producer publishes a message to the queue, the message is automatically received by the consumer..

(2) Use the basic. GET command of amqp to obtain the Next message. In this mode, only one message is obtained at a time, and the subscription is canceled. If you want to continue obtaining the next message, you need to send this command again. Note: Basic. Get should not be used in the for loop to replace basic. Consume, which will affect the performance of rabbit.



Exchange (switch): the router for the message, the label for parsing the message (lable)


Rabbitmq Study Notes 2-Understanding messaging

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.