Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Consumption method and device of message queue

A message queue and message technology, applied in the field of communication, can solve the problems of reducing consumption efficiency, repeated data consumption, consumption errors, etc., and achieve the effect of improving consumption efficiency and avoiding repeated data consumption

Active Publication Date: 2020-02-18
BEIJING QIHOO TECH CO LTD
View PDF5 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] However, the inventor found in the process of implementing the present invention that the above-mentioned method in the prior art has at least the following defects: Since the consumption task consumes from the oldest data offset position every time it is started, if the consumption task If the task is interrupted and restarted multiple times during the consumption process, it will consume from the offset position of the oldest data in the message queue after each restart, which may cause repeated consumption of data, which reduces consumption efficiency , and easily lead to consumption errors

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Consumption method and device of message queue
  • Consumption method and device of message queue
  • Consumption method and device of message queue

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0028] figure 1 It shows a schematic flowchart of a message queue consumption method provided by Embodiment 1 of the present invention, and the method includes:

[0029] Step S110: When the consumption task starts, establish a communication connection with the background database.

[0030] Wherein, the consumption task refers to the task of reading and processing the message queue at the consumer end. Among them, one message queue may correspond to one or more consumption tasks, and one consumption task may also correspond to one or more message queues. When a consumption task is started, the consumption end executing the consumption task establishes a communication connection with the background database. The communication connection can be established in various ways, which is not limited in the present invention. Wherein, the start of the consumption task includes various situations such as starting the consumption task for the first time and restarting the consumption ta...

Embodiment 2

[0039] figure 2 It shows a schematic flowchart of a message queue consumption method provided by Embodiment 2 of the present invention, as shown in figure 2 As shown, the method includes:

[0040] Step S210: When the consumption task starts, establish a communication connection with the background database.

[0041] Wherein, the consumption task refers to the task of reading and processing the message queue at the consumer end. Among them, one message queue may correspond to one or more consumption tasks, and one consumption task may also correspond to one or more message queues. When a consumption task is started, the consumption end executing the consumption task establishes a communication connection with the background database. The communication connection can be established in various ways, which is not limited in the present invention. Wherein, the start of the consumption task includes various situations such as starting the consumption task for the first time and...

Embodiment 3

[0062] image 3 A schematic structural diagram of a message queue consumption device provided by Embodiment 3 of the present invention is shown, as shown in image 3 As shown, the device includes:

[0063] The establishment module 31 is adapted to establish a communication connection with the background database when the consumption task is started;

[0064] The obtaining module 32 is adapted to obtain the current offset information of the message queue corresponding to the consumption task from the background database through the communication connection;

[0065] The reading module 33 is adapted to read the message data in the message queue according to the acquired current offset information when the acquisition is successful;

[0066] The update module 34 is adapted to update the current offset information of the message queue in the background database according to the offset address corresponding to the message data each time a piece of message data is read from the me...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention discloses a message queue consumption method and device, which can at least solve the technical problem of repeated consumption caused by consuming from the offset position of the oldest data in the message queue in the prior art after each restart. The method includes: when the consumption task is started, establishing a communication connection with the background database; obtaining the current offset information of the message queue corresponding to the consumption task from the background database through the communication connection; if the acquisition is successful , then read the message data in the message queue according to the obtained current offset information; whenever a message data is read from the message queue, according to the offset address corresponding to the message data in the background The current offset information of the message queue is updated in the database.

Description

technical field [0001] The invention relates to the field of communication technology, in particular to a message queue consumption method and device. Background technique [0002] At present, after a business front-end producer generates a message, it usually stores the message to be processed in the message partition of the message queue, and then sends it to the back-end consumer for processing. In the prior art, whenever a consumption task at the consumer end is started, consumption starts from the oldest data offset position (that is, the data position with the earliest storage time) by default. [0003] However, the inventor found in the process of implementing the present invention that the above-mentioned method in the prior art has at least the following defects: Since the consumption task consumes from the oldest data offset position every time it is started, if the consumption task If the task is interrupted and restarted multiple times during the consumption pro...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): H04L12/879H04L49/901
CPCH04L49/901
Inventor 邓怡豪
Owner BEIJING QIHOO TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products