group

1. A group contains several different topics.

2. Consumers can consume messages from the same group only if they are in the same group as producers.


analogy

Mq groups are similar to Dubbo groups in that consumers of the same group can consume messages produced by producers of the same group.

topic

1. A topic contains multiple messages.

2. The smallest unit of message that a consumer subscribes to. In the same way that consumers subscribe messages to mq servers on a topic basis, producers write message data to a topic on a topic basis. A topic, the producer is constantly writing message data to the TOPIC of the MQ server, and the consumer is constantly reading message data from the MQ server for consumption processing.

The message queue

1. A topic contains messages that may be distributed in multiple message queues, and each message queue contains multiple message data.

2. Multiple message queues may be distributed on different nodes.

The message

A message is a piece of data, just like a record in a database table. Mq The smallest unit of read and write data.

What is the difference between messages and message queues?

Architecture diagram


The message

It is the smallest unit of production and consumption.


The message queue

A topic contains multiple message queues, each of which may be distributed on different machine nodes.

A topic also contains multiple messages stored in a data structure called a queue.

What’s the difference between a message and a message queue? A message is a data/message, and a message queue is a collection of data/messages.


Logical and physical message queues

Logical message queues and physical message queues correspond one to one. They are essentially the same thing and are linked by indexes. What does logic do? Improved read and write speed because of indexes.

Consumption patterns

1. All consumer nodes in the same group consume n data in total

2. All consumers in the same group consume N data at each node


What is the default consumption pattern?

In general, most application scenarios, by default, are all consumer nodes in the same topic consuming n data in total, that is, the same data is consumed by only one consumer in the consumer cluster.

Consumption order

Consumption order

1, no order The default is no order, that is, the same topic consumer spending the entire topic cluster dimensions or even the same message queue messages, there is no order, namely the data in the message queue, likely is advanced, and was the first out, but because the consumer is cluster, so it would be possible to after the message is a node to complete the processing.

Companies now simply do not have order requirements because they process messages for different orders each time, rather than different steps of the same order.

Most application scenarios require no order, as they are generally consumed.

2, a single message queue consumer cluster nodes according to the order of the same topic, consumption the same queue in sequence data, namely the same message queue for each of the data and advanced out first, after also be consumed first, only when the data was first after processing is completed, the next will be out of the message queue consumer data.

Application scenarios? Performance requirements are high because only a single node is ordered.

Messages from all nodes of a topic are ordered, that is, global messages are consumed in order.

Application scenarios? Performance requirements are low, as global data is consumed on a first-in, first-out basis.

other

1. What is the difference between message queues and nodes? 1) a node is a broker. 2) a broker contains multiple message queues. 3) Multiple message queues on the same topic, which may be distributed among different node brokers

2. What is the purpose of message queue data structures? Ensure that individual message queue data is consumed sequentially. In particular, data from the same message queue is consumed sequentially by different consumer nodes, as in case 2 above.

reference

Official documentation github.com/apache/rock…