Consumption method, device, server and medium based on database message queue

A message queue and database technology, applied to devices, servers and media, consumption methods and fields based on database message queues, can solve problems such as increased time cost, cumbersome configuration, increased operation and maintenance costs, etc., to improve processing speed and expand applications Scenarios and low maintenance costs

CN108536544BActive Publication Date: 2021-06-25MICRO DREAM TECHTRONIC NETWORK TECH CHINACO
14 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Publication Date
2021-06-25

Smart Images

  • Figure 1
    Figure 1
  • Figure 2
    Figure 2
  • Figure 3
    Figure 3
Patent Text Reader

Abstract

Embodiments of the present invention provide a database message queue-based consumption method, device, server, and medium, the method including starting multiple independent consumption processes; controlling each of the consumption processes from the message queue data table stored in the database Read a sub-message queue, each sub-message queue includes multiple messages, each message has a unique message ID, and there is no intersection between the sets of message IDs contained in each sub-message queue. The embodiment of the present invention uses the database as the message queue service, which is convenient for deployment and low maintenance cost; although the existing technology also uses the database as the queue, it does not support multi-process consumption queues, and can only be processed by a single process, and the application scenarios are limited. The embodiment supports using the database as a message queue to open multiple processes for consumption, which solves the problem of repeated consumption during multi-process consumption, improves the processing speed of the queue, and expands the application scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

technical field

[0001] The invention relates to the server operation and maintenance of the Internet and the mobile Internet, in particular to a consumption method based on a database message queue, a device, a server and a medium. Background technique

[0002] In daily applications, it is often encountered that message queuing services are used to process some business logic asynchronously. In general, independent message queuing services, such as MemcacheQ, are chosen.

[0003] Although the existing technical solutions can satisfy daily business applications, the inventors of the present application found that the technical solutions of the prior art have the following problems in actual use:

[0004] 1. The message queue service needs to be deployed separately, and the configuration is cumbersome, which increases the operation and maintenance cost.

[0005] 2. When it is actually applied in an enterprise, it often needs to go through the process of applying for resources...

Examples

Embodiment 1

[0025] figure 1 is an overall flow chart of the database message queue-based consumption method of the embodiment of the present invention. like figure 1 As shown, the method includes: step 110, starting a plurality of independent consumption processes; step 120, controlling each consumption process to read a sub-message queue once from the message queue data table stored in the database, and each sub-message queue includes multiple Each message has a unique message ID, and there is no intersection between the sets of message IDs contained in each sub-message queue. The message queue contains many messages, and the consumer process reads the messages for subsequent operations. This can not only realize database-based multi-process reading consumption, reduce the burden on the database, but also avoid repeated consumption of message queues.

[0026] Optionally, the message queue data table includes a message ID field, and the message ID field is a self-incrementing field; an...

Embodiment 2

[0054] Figure 4 It is a logical functional block diagram of a consumer device based on a database message queue according to an embodiment of the present invention. like Figure 4 As shown, the consumption device includes: a starting unit 210, which is used to start a plurality of independent consumption processes; a control unit 220, which is used to control each of the consumption processes to read a message queue data table stored in the database one sub In the message queue, each sub-message queue includes multiple messages, each message has a unique message ID, and there is no intersection between the sets of message IDs contained in each sub-message queue.

[0055] Optionally, the message queue data table includes a message ID field, and the message ID field is a self-incrementing field; and, the message IDs of the multiple messages included in each sub-message queue are continuously incremented.

[0056] Optionally, the message queue data table includes a message ID ...