Alibaba Cloud RocketMQ

Alibaba Cloud RocketMQ analysis report

Before learning RocketMQ, we must first understand the following issues.

What is downtime?

Downtime refers to a phenomenon in which the operating system cannot recover from a serious system error, or a problem occurs at the system hardware level, which causes the system to be unresponsive for a long time and the computer has to be restarted. It is a normal phenomenon of computer operation, and it will happen to any computer.

Process messages synchronously and asynchronously?

The Producer sends a message to the Consumer, and the Consumer processes it immediately after receiving the message, that is, synchronously processing the message. The
Producer first sends the message to the MQ, and the Consumer can get the message processing in the MQ at any time, which is asynchronous processing.

TCP and HTTP protocols?

The TCP protocol corresponds to the transport layer, and the Http protocol corresponds to the application layer. Essentially, the two are not comparable. The Http protocol is built on top of the TCP protocol. When the browser needs to obtain web page data from the server, it will Make an Http request. Http will establish a connection channel to the server through tcp. When the data required for this request is completed, Http will immediately disconnect the TCP connection. This process is very short. So Http connection is a short connection, a stateless connection.
The so-called stateless means that every time the browser initiates a request to the server, it does not pass a connection, but establishes a new connection every time. If it is a connection, the server process can maintain the connection and remember some information status in the memory. After each request ends, the connection is closed and the related content is released, so you can't remember any state and become a stateless connection.

What is Maven?

Maven is a project management tool, it includes a project object model (Project Object Model), a set of standards, a project life cycle (Project Lifecycle), a dependency management system (Dependency Management System), and used to run the definition in The logic of the plugin's goal in the phase of the life cycle.

After understanding the above questions, we can start learning RocketMQ

What is the RocketMQ version of message queue?

The message queue RocketMQ version is a low-latency, high-concurrency, high-availability, and highly reliable distributed messaging middleware built by Alibaba Cloud based on Apache RocketMQ. The RocketMQ version of the message queue can not only provide asynchronous decoupling and peak-shaving and valley-filling capabilities for distributed application systems, but also has the characteristics of massive message accumulation, high throughput, and reliable retry required by Internet applications.

core concept

Topic: The message subject, the first-level message type, and the producer sends a message to it.
Producer: Also known as a message publisher, responsible for producing and sending messages to Topic.
Consumer: Also known as message subscriber, responsible for receiving and consuming messages from Topic.
Message: The combination of data and (optional) attributes sent by the producer to the Topic and finally delivered to the consumer.
Message attributes: The attributes that the producer can define for the message, including Message Key and Tag.
Group: A type of producer or consumer. This type of producer or consumer usually produces or consumes the same type of messages, and the logic of message publishing or subscription is consistent.

Messaging model

The RocketMQ version of the message queue supports publish and subscribe models. The message producer application creates topics and sends messages to topics. The consumer application creates a subscription to the topic in order to receive messages from it. Communication can be one-to-many (fan-out), many-to-one (fan-in), and many-to-many.
Insert picture description here
Producer cluster: used to indicate the application of sending messages. A producer cluster contains multiple producer instances, which can be multiple machines, multiple processes of one machine, or multiple producer objects of one process.
A producer cluster can send multiple topic messages. When sending distributed transaction messages, if the producer unexpectedly goes down midway, the RocketMQ version of the message queue server will actively call back any machine in the producer cluster to confirm the transaction status.

Consumer cluster: used to represent consumer messaging applications. A consumer cluster contains multiple consumer instances, which can be multiple machines, multiple processes, or multiple consumer objects of a process.
Multiple consumers in a consumer cluster consume messages in an evenly shared manner. If the broadcast mode is set, then each instance under this consumer cluster consumes the full amount of data.

A consumer cluster corresponds to a Group ID, and a Group ID can subscribe to multiple topics, as shown in Group 2 in Figure 1. The subscription relationship between Group and Topic can be set directly in the program. For specific setting methods, please refer to the resource application process optimization section in the product update log.

RocketMQ cluster construction

Introduction to each role

  • Producer: the sender of the message; for example: the sender
  • Consumer: message receiver; example: receiver
  • Broker: temporary storage and transmission of messages; example: post office
  • NameServer: Manage Broker; Example: the management organization of each post office
  • Topic: distinguish the types of messages; a sender can send a message to one or more topics; a message receiver can subscribe to one or more topic messages
  • Message Queue: equivalent to a topic partition; used to send and receive messages in parallel

The architecture diagram is as follows:
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_43372169/article/details/109744211