Consumption method and device of message queue
A message queue and message technology, applied in the field of communication, can solve the problems of dynamic adjustment, consumption failure, affecting the normal operation of the data processing system, etc., to improve the accuracy and avoid consumption failure.
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0017] figure 1 A schematic flowchart of a message queue consumption method provided by Embodiment 1 of the present invention is shown. like figure 1 As shown, the method includes the following steps:
[0018] Step S110: Assign corresponding consumer terminals to each message partition in the message queue for consumption, and regularly obtain the current consumption offset and maximum effective offset of the message partition corresponding to each consumer terminal.
[0019] Among them, the number of consumers can be set according to the number of message partitions in the message queue. In one setting method, the number of consumers is equal to the number of message partitions in the message queue. At this time, the consumer and message partitions are One-to-one correspondence, correspondingly, one consumer is fixedly responsible for consuming messages in a corresponding message partition. This method can minimize mutual interference between multiple consumers and consumpt...
Embodiment 2
[0027] figure 2 A schematic flowchart of a message queue consumption method provided by Embodiment 2 of the present invention is shown. like figure 2 As shown, the method includes the following steps:
[0028] Step S210: Assign corresponding consumer terminals to each message partition in the message queue for consumption.
[0029] Specifically, the number of consumers can be set according to the number of message partitions in the message queue. In one setting method, the number of consumers is equal to the number of message partitions in the message queue. At this time, the consumer and the message partition Correspondingly, a consumer is fixedly responsible for consuming messages in a corresponding message partition. This method can avoid mutual interference between multiple consumers and consumption confusion to the greatest extent. In another setting method, the number of consumers is greater than the number of message partitions in the message queue. At this time, t...
example 1
[0041] Assuming that there are three message partitions and three consumer ends, the remaining consumable volume of message partition 1 corresponding to consumer end 1 is 100 (pieces), and the remaining consumption volume of message partition 2 corresponding to consumer end 2 is 200 (pieces). The remaining consumption volume of message partition 3 corresponding to consumer end 3 is 800 (messages), and the current consumption speed of the three consumers is 200 (messages / second).
[0042] Correspondingly, the minimum value of the remaining consumable volume of the message partition corresponding to each consumer is 100, that is, the minimum consumable volume is 100. In addition, since the consumption terminal corresponding to the minimum consumable quantity is consumption terminal 1, its consumption speed is 200 (pieces / second), therefore, the reference consumption speed is 200 (pieces / second), which is adjusted according to the minimum consumable quantity (100) When the refere...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 


