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

Message queue consumption method and device

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

Active Publication Date: 2017-05-31
BEIJING QIHOO TECH CO LTD
View PDF5 Cites 14 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
  • Message queue consumption method and device
  • Message queue consumption method and device
  • Message queue consumption method and device

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, and at least can solve the technical problem of double spending caused by consumption from the oldest data offset position of a message queue after restart of every time in the prior art. The method includes the steps: building communication connection between a consuming task and a background database when the consuming task is started; acquiring current offset information of the message queue corresponding to the consuming task from the background database through the communication connection; reading message data in the message queue according to the acquired current offset information if the current offset information is successfully acquired; updating the current offset information of the message queue in the background database according to an offset address corresponding to the message data after the message data are read from the message queue.

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 Applications(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