A message processing method, a message reading method, a device and a readable medium

Share physical queues through multiple message sending ends, and use logical queues and indexes to store and read messages, solving the problem of low efficiency in message data storage in the prior art, realizing the optimization of hardware resources and reducing costs.

CN113296973BActive Publication Date: 2025-02-18ALIBABA GROUP HOLDING LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010700917.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-20
Publication Date
2025-02-18
Estimated Expiration
2040-07-20

AI Technical Summary

Technical Problem

The prior art is difficult to effectively process and store large amounts of message data, resulting in waste of hardware resources and increased costs.

Method used

The physical queue is shared by multiple message senders, and the message is stored and read by logical queues and indexes, achieving efficient storage and retrieval of messages.

Benefits of technology

Reduces consumption of hardware media, reduces hardware overhead, and improves the efficiency of message storage and reading.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113296973B_ABST
    Figure CN113296973B_ABST
Patent Text Reader

Abstract

The present application provides a message processing method, a message reading method, a device and a readable medium, comprising: obtaining to-be-processed messages of at least two message sending ends and identity information corresponding to the to-be-processed messages, and storing the to-be-processed messages in a physical queue corresponding to the identity information according to the identity information; wherein the number of the message sending ends is greater than the number of the physical queues. In the present application, by sharing a physical queue by multiple message sending ends, the consumption of hardware media can be reduced, thereby reducing hardware overhead.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network technology, and in particular to a message processing method, a message reading method, a device and a readable medium. Background Art

[0002] With the continuous development of science and technology, the number of applications on the market and the functions provided by applications are increasing. When users use applications, applications often generate a large number of messages. Since these messages can reflect users' usage habits, usage preferences and other factors, these messages are often of great significance to application providers.

[0003] Currently, there is an urgent need for a message processing method to store these messages for subsequent use. Summary of the invention

[0004] In view of the above problems, embodiments of the present application provide a message processing method, a message reading method, a device and a readable medium to implement message storage.

[0005] In order to solve the above problem, an embodiment of the present application discloses a message processing method, including: obtaining to-be-processed messages of at least two message senders and identity information corresponding to the to-be-processed messages;

[0006] According to the identity information, the to-be-processed message is stored in a physical queue corresponding to the identity information; wherein the number of the message sending ends is greater than the number of the physical queues.

[0007] The present application also discloses a message reading method, including:

[0008] Receiving a message reading request sent by a message receiving end; the message reading request includes identity information of a target message;

[0009] According to the identity information, a target message corresponding to the identity information is read from a physical queue; wherein the physical queue stores to-be-processed messages sent by at least two message senders; wherein the number of the message senders is greater than the number of the physical queues.

[0010] The embodiment of the present application also discloses a message processing method, including:

[0011] Obtaining to-be-processed messages of at least two message sending ends and identity information corresponding to the to-be-processed messages; the identity information includes a logical queue identifier corresponding to the message sending end to which the to-be-processed messages belong;

[0012] According to the logical queue identifier, determining the first storage location of the to-be-processed message in the index; wherein the index records the storage locations of the messages in the physical queue according to the logical queue identifier classification;

[0013] According to the first storage location, the pending messages are stored in the form of a bidirectional linked list in the physical queue corresponding to the logical queue identifier; wherein the pending messages belonging to the same logical queue identifier are in the same bidirectional linked list, and the number of message senders is greater than the number of physical queues.

[0014] The embodiment of the present application also discloses a message processing device, including:

[0015] An acquisition module, used to acquire the to-be-processed messages of at least two message senders and identity information corresponding to the to-be-processed messages;

[0016] The first storage module is used to store the to-be-processed message in a physical queue corresponding to the identity information according to the identity information; wherein the number of the message sending ends is greater than the number of the physical queues.

[0017] The embodiment of the present application also discloses a message processing device, including:

[0018] An acquisition module, used to acquire to-be-processed messages of at least two message sending ends and identity information corresponding to the to-be-processed messages; the identity information includes a logical queue identifier corresponding to the message sending end to which the to-be-processed messages belong;

[0019] A determination module, configured to determine, in an index, a first storage location of the message to be processed according to the logical queue identifier; wherein the index records the storage locations of the messages in the physical queue according to the logical queue identifier classification;

[0020] A storage module is used to store the pending messages in the form of a bidirectional linked list according to the first storage location to the physical queue corresponding to the logical queue identifier; wherein the pending messages belonging to the same logical queue identifier are in the same bidirectional linked list, and the number of message senders is greater than the number of physical queues.

[0021] The embodiment of the present application also discloses a message reading device, including:

[0022] An acquisition module, configured to receive a message reading request sent by a message receiving end; the message reading request includes identity information of a target message;

[0023] A reading module is used to read a target message corresponding to the identity information from a physical queue according to the identity information; wherein the physical queue stores to-be-processed messages sent by at least two message senders; wherein the number of the message senders is greater than the number of the physical queues.

[0024] Accordingly, the embodiment of the present application further discloses a device, including:

[0025] one or more processors; and

[0026] One or more machine-readable media having instructions stored thereon, when executed by the one or more processors, cause the apparatus to perform the above-described method.

[0027] Accordingly, the embodiments of the present application also disclose one or more machine-readable media on which instructions are stored, which, when executed by one or more processors, enable the device to perform the above method.

[0028] The embodiment of the present application includes the following advantages: A message processing method provided by the present application includes: obtaining to-be-processed messages of at least two message sending ends and identity information corresponding to the to-be-processed messages, and storing the to-be-processed messages in a physical queue corresponding to the identity information according to the identity information; wherein the number of the message sending ends is greater than the number of the physical queues. In the present application, by sharing the physical queue by multiple message sending ends, the consumption of hardware media can be reduced, thereby reducing hardware overhead. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1A This is an implementation architecture diagram of an embodiment of the present application;

[0030] Figure 1B This is a schematic diagram of a scenario in an embodiment of the present application;

[0031] Figure 1C This is another scenario schematic diagram of an embodiment of the present application;

[0032] Figure 2 It is a logical framework diagram of an embodiment of the present application;

[0033] Figure 3 This is a flow chart of the steps of a message processing method provided by an embodiment of the present application;

[0034] Figure 4A This is a flowchart of the specific steps of a message processing method provided by an embodiment of the present application;

[0035] Figure 4B This is a physical queue and index schematic diagram provided by an embodiment of the present application;

[0036] Figure 4C This is a message processing schematic diagram from a logical queue perspective provided by an embodiment of the present application;

[0037] Figure 5 This is a flowchart of a message reading method provided by an embodiment of the present application;

[0038] Figure 6 is a flowchart of another message processing method provided by an embodiment of the present application;

[0039] Figure 7 This is a structural diagram of a message processing device provided by an embodiment of the present application

[0040] Figure 8 is a structural diagram of another message processing device provided by an embodiment of the present application;

[0041] Fig. 9 is a structural diagram of a message reading device provided by an embodiment of the present application;

[0042] Fig.10 It is a structural schematic diagram of a device provided in another embodiment of the present application. DETAILED DESCRIPTION

[0043] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0044] In order to enable those skilled in the art to better understand the present application, the concepts involved in the present application are explained below:

[0045] Message sender: The source of pending messages that need to be persistently stored in the physical queue. The message sender can be a device running a service, for example, a server running a service. The message sender can also be a service, for example, one message sender can be one service.

[0046] Service: used to provide functions in the application. In order to facilitate the division of services, messages generated by a service are generally regarded as messages of the same data type. Messages generated by the same service belong to the same logical queue.

[0047] Persistent storage: A storage method that can ensure that the stored data will not be lost in scenarios such as power outages.

[0048] Physical queue: A queue that is built on independent hardware media, such as a disk, that does not lose data when power is lost.

[0049] Logical queue: Different logical queues correspond to different logical queue identifiers. A logical queue identifier uniquely indicates a logical queue. Messages belonging to the same logical queue identifier constitute the logical queue represented by the logical queue identifier.

[0050] Reference Figure 1A , which shows an implementation architecture diagram of an embodiment of the present application, and the implementation architecture includes: server S110, server S120 and server S130. Among them, service a is running in server S110, service b is running in server S120, and server S130 includes physical queue c. Server S110 and server S120 act as message senders, and server S130 can execute steps 1.1 and 1.2 to obtain the pending messages of server S110 and server S120 and the identity information corresponding to the pending messages. Furthermore, server S130 can execute step 1.3 to store the pending messages in physical queue c according to the identity information.

[0051] In this implementation architecture, the number of message senders is 2, and the number of physical queues is 1, that is, the number of message senders is greater than the number of physical queues. In this way, multiple message senders share the same physical queue, that is, multiple services share the physical queue, and multiple logical queues share the physical queue. Since physical queues need to be established based on independent hardware media that will not lose data when power is off, sharing physical queues can reduce the consumption of hardware media and thus reduce hardware overhead.

[0052] In an existing implementation, since different services are used to provide different functions in an application, in order to optimize and analyze the services, messages corresponding to the services are often obtained from stored messages for data analysis. Therefore, in order to facilitate the acquisition of messages corresponding to the services, a physical queue is often established for a service for storage, and a physical queue often corresponds to a physical queue file. In this way, when faced with a large number of services, a large number of physical queues need to be established, which will lead to the appearance of a large number of physical queue files. However, the number of physical queue files that a hardware device can support is limited. In this way, when faced with a large number of services, it is necessary to continuously increase hardware devices.

[0053] Since the cost of adding a large number of hardware devices is relatively high, the embodiment of the present application adopts multiple services to share a physical queue. In this way, when faced with a large number of services, there is no need to add a large number of physical queues to meet storage needs. If a new service appears, the embodiment of the present application can put the message of the new service into a physical queue for storage. In this way, the number of physical queues required to be added can be reduced to a certain extent, thereby reducing hardware overhead.

[0054] Furthermore, when the server S130 obtains the pending message, it may receive the pending message sent by the server S110 and the server S120. The pending message of the server S110 may be generated by the service a, and the pending message of the server S120 may be generated by the service b. Among them, the message generated by the service may be generated when the function provided by the service in the application installed on the terminal device is used.

[0055] Reference Figure 1B , which shows a scenario diagram of an embodiment of the present application, in which an application d having the functions provided by service a and service b is installed in the terminal device S140. The user can use the application d having the functions provided by service a and service b, and accordingly, the terminal device S140 can return the messages generated during the use process to the server S110 and the server S120. The server S110 and the server S120 can treat these messages as pending messages, and send the pending messages and the identity information corresponding to the pending messages to the server S130. The server S130 can store the pending messages in the corresponding physical queue c according to the identity information.

[0056] Since the number of terminal devices is often large, the number of messages generated when the functions provided by the services in the applications installed in the terminal devices are used is often large. Therefore, in the embodiment of the present application, the terminal device returns the generated message to the server S110 and server S120 where the corresponding service is located, and the server S110 and server S120 send the pending message to the server S130 for storage, which can avoid the problem of excessive concurrency of S130 messages. For example, server S110 and server S120 can perform load balancing according to the number of messages returned by the received terminal devices, thereby controlling the concurrency.

[0057] Reference Figure 1C, which shows another scenario schematic diagram of an embodiment of the present application, in which an application e having functions provided by a payment service, an order service and a chat service is installed in the terminal device S140, and the user can use the functions provided in the application e. Accordingly, the terminal device S140 can return the corresponding messages generated during use to the server S110, the server S120 and the server S150. The server S110, the server S120 and the server S150 can take these messages as pending messages, and send the pending messages and the identity information corresponding to the pending messages to the server S130. The server S130 can store the pending messages in the corresponding physical queue c according to the identity information. In the embodiment of the present application, for the messages of the payment service, the order service and the chat service, the terminal device returns the generated messages to the server where the corresponding services are located, and these servers send the pending messages to the server S130 for storage, which can avoid the problem of excessive concurrency of messages in S130.

[0058] Reference Figure 2 , which shows a logical framework schematic diagram of an embodiment of the present application, and the logical framework may include: service S210, service S220, service S230, service S240, physical queue S250 and physical queue S260. Among them, service S210, service S220, service S230, and service S240 are message sending ends. When processing messages, the pending messages of service S210 and the pending messages of service S220 can be stored in the physical queue 250, and the pending messages of service S230 and the pending messages of service S240 can be stored in the physical queue 260. Since the number of message sending ends is greater than the number of physical queues. In this way, multiple message sending ends share the physical queue. Since the physical queue needs to be established based on an independent hardware medium that will not lose data when the power is off, compared with the method of using one physical queue for one service, sharing the physical queue can reduce the consumption of hardware media, thereby reducing hardware overhead.

[0059] Reference Figure 3 , shows a flow chart of the steps of a message processing method in an embodiment of the present application. The method may specifically include the following steps:

[0060] Step 101: Obtain to-be-processed messages of at least two message senders and identity information corresponding to the to-be-processed messages.

[0061] In an embodiment of the present application, the pending message may be a message that needs to be stored in a physical queue. The identity information may be information used to indicate which message sender the pending message belongs to. The pending message and the identity information corresponding to the pending message may be actively sent by the message sender. Accordingly, when acquiring, the pending message and the identity information corresponding to the pending message sent by the message sender may be received. Alternatively, it may also be actively read from the message sender.

[0062] Step 102: store the to-be-processed message into a physical queue corresponding to the identity information according to the identity information; wherein the number of the message sending ends is greater than the number of the physical queues.

[0063] In an embodiment of the present application, the correspondence between the message sending end and the physical queue can be preset, that is, the correspondence is used to indicate which message sending ends share which physical queues. Accordingly, when storing, since the identity information can indicate which message sending end the pending message belongs to, the corresponding physical queue can be determined based on the identity information and the correspondence, and the pending message can be stored in the corresponding physical queue. In this way, by presetting the correspondence between the message sending end and the physical queue, the pending message of the message sending end is stored in the corresponding physical queue, which can improve the storage efficiency to a certain extent.

[0064] Further, in an embodiment of the present application, the number of message sending ends is greater than the number of physical queues, wherein the specific values ​​of the number of message sending ends and the number of physical queues can be set according to actual conditions. For example, the number of physical queues can be set to be positively correlated with the amount of messages generated by the message sending end, that is, the greater the amount of messages generated by the message sending end, the greater the number of physical queues can be, and the smaller the amount of messages generated by the message sending end, the smaller the number of physical queues can be. In this way, to a certain extent, it is possible to reduce resource waste while ensuring that the physical queue can meet the storage requirements. It should be noted that in the case of multiple physical queues, after a physical queue is full, the messages to be processed that are subsequently obtained can be stored in the next physical queue to avoid wasting storage resources. Of course, it is also possible to randomly select a physical queue for storage.

[0065] In summary, the embodiment of the present application obtains the pending messages of at least two message senders and the identity information corresponding to the pending messages, and stores the pending messages in a physical queue corresponding to the identity information according to the identity information; wherein the number of the message senders is greater than the number of the physical queues. In the embodiment of the present application, by sharing the physical queue by multiple message senders, the consumption of hardware media can be reduced, thereby reducing hardware overhead.

[0066] Reference Figure 4A, shows a flowchart of specific steps of a message processing method provided by an embodiment of the present application, which may specifically include the following steps:

[0067] Step 201: Obtain to-be-processed messages of at least two message senders and identity information corresponding to the to-be-processed messages.

[0068] Optionally, in an implementation of the present application, the identity information may include a message sequence identifier corresponding to the to-be-processed message and a logical queue identifier corresponding to the message sender to which the to-be-processed message belongs. Step 201 may include:

[0069] Sub-step 2011, obtaining to-be-processed messages of at least two message sending ends, message sequence identifiers corresponding to the to-be-processed messages, and logical queue identifiers corresponding to the message sending ends to which the to-be-processed messages belong.

[0070] In the embodiment of the present application, the message sequence identifier can be represented as SequenceId, the logical queue identifier can be represented as QueueId, and the specific value of QueueId can be selected within a preset range, and the preset range can be set according to actual needs, and the embodiment of the present application does not limit this. SequenceId can represent the position of the message in the logical queue corresponding to the message sending end, and the SequenceId of messages belonging to the same QueueId can be monotonically increasing.

[0071] The message sender can specify the QueueId and SequenceId in the message to be processed, and accordingly, the QueueId and SequenceId can be directly obtained from the message sender. Among them, in one implementation of the present application, the QueueId can be pre-agreed with the message sender, and the SequenceId can be managed by the message sender. The message sender can ensure the uniqueness and incremental characteristics of the SequenceId when specifying the SequenceId. Accordingly, in the embodiment of the present application, step A can also be executed to implement the agreed QueueId: Step A, for any message sender, determine the logical queue identifier corresponding to the message sender, and notify the message sender of the logical queue identifier. In this step, when determining the logical queue identifier corresponding to the message sender, a value can be selected from a preset range as the logical queue identifier. When selecting, different values ​​can be selected for different message senders, thereby ensuring the global uniqueness of the QueueId. After notifying the message sender of the logical queue identifier, the message sender can specify the logical queue identifier in the message to be processed in the subsequent process.

[0072] In this implementation, no additional operations are required, and the to-be-processed message, QueueId, and SequenceId can be directly obtained from the message sending end. In this way, the operation efficiency can be ensured to a certain extent.

[0073] It should be noted that, for the message sending end, the message sending end generally has a greater difficulty in managing SequenceId. Therefore, in another implementation of the present application, step 201 may include:

[0074] Sub-step 2012, obtaining to-be-processed messages of at least two message sending ends, and logical queue identifiers corresponding to the message sending ends to which the to-be-processed messages belong.

[0075] This step can refer to the relevant description in the above sub-step 2011, which will not be repeated here.

[0076] Sub-step 2013, determining the message sequence identifier corresponding to the message to be processed.

[0077] In this step, when determining the message sequence identifier corresponding to the message sending end, a value may be selected from a preset message sequence identifier range as the message sequence identifier, and when selecting, the value may be selected in sequence for different message sending ends in a sequentially increasing manner, thereby ensuring that SequenceId can satisfy the uniqueness and increasing characteristics. In this implementation, the message sending end only needs to specify QueueId, thereby reducing the implementation difficulty of the message sending end to a certain extent.

[0078] Step 202: store the to-be-processed message into a physical queue corresponding to the identity information according to the identity information; wherein the number of the message sending ends is greater than the number of the physical queues.

[0079] Among them, the physical queue in the embodiment of the present application can be established by itself or directly use the existing physical queue in the traditional message queue product, for example, directly use the physical queue in Kafka or RocketMQ.

[0080] Optionally, when the identity information includes a logical queue identifier corresponding to the message sending end to which the message to be processed belongs, step B may be performed in the embodiment of the present application:

[0081] Step B: in the index, the storage locations of the messages in the physical queue are recorded according to the logical queue identifier.

[0082] In the embodiment of the present application, the index can be used to characterize the corresponding relationship between the storage location of the message in the logical queue contained in the physical queue and the QueueId. The index can be specifically an index table, and the information in the index table can be stored in the form of key-value pairs (Key-Value). The index table can be based on persistent KV storage, specifically, the table can be stored through an embedded lightweight KV storage engine, such as LevelDB or RocksDB. Alternatively, it can also be stored by calling an external KV storage engine.

[0083] The storage location of the message can be the physical address of the message, and the message can be uniquely located by the physical address. When recording the storage location of the message in the physical queue by QueueId, the storage location of the message belonging to the QueueId can be recorded in correspondence with the QueueId. In this way, through the corresponding record, the storage location of the message in the logical queue corresponding to different QueueId can be found according to the index. When recording specifically, it can be that only the storage location of part of the message is recorded. In this way, the processing resources consumed by the record index can be reduced and the efficiency of the record index can be improved. Furthermore, in an embodiment of the present application, by recording the storage location of the message in the physical queue by QueueId in the index, when the pending message is subsequently stored, the storage location of the message belonging to the same QueueId as the pending message can be determined more quickly according to the index, thereby improving the storage efficiency of the pending message to a certain extent.

[0084] In an embodiment of the present application, the record indexing operation may be performed after the pending messages are stored in the physical queue for the first time, or the record indexing operation may be performed after a certain amount of pending messages are stored in the physical queue.

[0085] Optionally, in an implementation of the present application, step B may include sub-steps:

[0086] Sub-step B1, in the index, recording the third storage position of the head message and the first storage position of the tail message; wherein the head message and the tail message belong to the same logical queue identifier.

[0087] In this step, the messages belonging to the logical queue identifier can be first determined based on the logical queue identifier, and then the head message at the head of the queue can be determined from the logical queue composed of these messages, and then the storage address of the head message can be obtained as the third storage location. Also, the tail message at the tail of the queue can be determined, and then the storage address of the tail message can be obtained as the first storage location. Finally, the third storage location and the first storage location are written into the index. Since the third storage location and the first storage location can accurately represent the positions of the head and tail of the logical queue composed of the messages belonging to the logical queue identifier, therefore, in the embodiment of the present application, by recording the third storage location and the first storage location in the index, the convenience of subsequent message storage and message reading using the index can be improved to a certain extent.

[0088] Optionally, in an implementation of the present application, sub-step B1 may include:

[0089] Sub-step B11, when the head message and / or the tail message in the physical queue is changed, recording the third storage position of the changed head message and / or the first storage position of the changed tail message in the index.

[0090] Since the head-of-team message and / or the tail-of-team message may change, the previously recorded third storage location and the first storage location may be inaccurate. In an embodiment of the present application, when the head-of-team message and / or the tail-of-team message changes, the changed third storage location of the head-of-team message and / or the changed first storage location of the tail-of-team message are recorded in the index to ensure the accuracy of the storage location recorded in the index.

[0091] Optionally, step B may further include sub-steps:

[0092] Sub-step B2, in the index, recording a fourth storage location of at least one intermediate message between the head message and the tail message; the intermediate message, the head message and the tail message are messages belonging to the same logical queue identifier.

[0093] Among them, the more intermediate messages there are, the more information needs to be recorded, and accordingly, the more processing resources consumed. The fewer intermediate messages there are, the less information needs to be recorded, and accordingly, the fewer processing resources consumed. Therefore, the number of intermediate messages can be set according to actual needs. The specific location of the intermediate message can also be determined according to actual needs. For example, the intermediate message can be a message located in the middle of the queue. In an embodiment of the present application, by further recording the fourth storage location of the intermediate message in the index, the index can provide a richer location reference, thereby improving the convenience of subsequent use of the index for message storage and message reading to a certain extent.

[0094] Optionally, step 202 may include the following sub-steps:

[0095] Sub-step 2021, searching the index for a first storage location of a tail message corresponding to the logical queue identifier; wherein the tail message is a message belonging to the logical queue identifier among existing messages in the physical queue.

[0096] In this step, the QueueId may be matched with the QueueId recorded in the index to obtain a QueueId matching the QueueId, and then the storage location of the tail message may be obtained from the storage location of the message corresponding to the matching QueueId as the first storage location.

[0097] Sub-step 2022: storing the to-be-processed message in the physical queue according to the identity information and the first storage location.

[0098] In an embodiment of the present application, the first storage location is determined by an index, and the first storage location can more conveniently locate the logical queue to which the pending message belongs, thereby facilitating the storage of the pending message according to the logical queue. In this way, the storage efficiency is improved to a certain extent, ensuring that the storage complexity is low.

[0099] Optionally, in an implementation of the present application, sub-step 2022 may include:

[0100] Sub-step C1, encapsulates the to-be-processed message with bidirectional linked list information according to the identity information to obtain a second message; wherein the first storage location is set in the forward node information of the bidirectional linked list information, and the backward node information of the bidirectional linked list information is set to empty or set to a preset identifier.

[0101] In the embodiment of the present application, the bidirectional linked list information may include forward node information and backward node information. Optionally, when encapsulating the bidirectional linked list information for the message to be processed, the identity information may be associated with the message to be processed, and then the message to be processed is used as the payload, and the three parts of the forward node information, the payload, and the backward node information are encapsulated into one.

[0102] Setting the first storage location of the tail message in the forward node information may be storing the first storage location in the forward node information. Setting the first storage location of the tail message in the forward node information may allow the forward node information after setting to point to the tail message in the logical queue to which the pending message belongs, thereby linking the pending message as a new tail message with the previous tail message.

[0103] The preset identifier can be preset according to actual needs. For example, the preset identifier can be a number, a letter, a symbol, etc. In this way, by setting the backward node information to empty or setting the preset identifier, it is convenient to set the storage location of the new message to be processed in the backward node information when a new message to be processed is inserted later.

[0104] Sub-step C2, storing the second message in a second storage location in the physical queue.

[0105] Optionally, in an embodiment of the present application, a physical address may be first allocated to the second message according to an available storage area of ​​the physical queue as a second storage location, and then the second message may be stored in the second storage location.

[0106] Sub-step C3, according to the first storage location of the forward node information, query the message of the first storage location in the physical queue, and set the second storage location in the backward node information of the message.

[0107] In this step, the first storage location can be directly read from the forward node information, and then the first storage location can be accessed to determine the message at the first storage location, that is, the tail message of the logical queue to which the pending message belongs before the second message is stored. Then, the second storage location can be set in the backward node information of the message, and the second storage location can be set in the backward node information of the message, so that the backward node information after setting can point to the second message, that is, point to the new tail message, and then the pending message is linked to the previous tail message as the new tail message.

[0108] In the embodiment of the present application, by encapsulating the bidirectional linked list information for the pending messages when storing the pending messages, the messages of the logical queue ID to which the pending messages belong are formed into a logical queue in the form of a bidirectional linked list, and the pending messages belonging to the same logical queue ID are in the same bidirectional linked list. After finding a message in the logical queue, the forward adjacent message and the backward adjacent message of the message can be quickly found in the physical queue according to the bidirectional linked list information. In this way, the messages belonging to the same service can be quickly found through the bidirectional linked list information, and then the efficiency of message search is ensured while reducing the hardware overhead by sharing the physical queue, and the complexity is ensured to be low. In this way, when reading the message from the physical queue later, the message to be read can also be quickly found, thereby reducing the time overhead required for message search.

[0109] At the same time, in an embodiment of the present application, by setting the first storage position of the tail message in the forward node information, it is ensured that the second message is inserted at the tail of the logical queue to which the pending message belongs. Since the SequenceId of the pending messages increases sequentially, the second message is inserted at the tail of the queue. This ensures that the messages in the logical queue are linked sequentially in ascending order of SequenceID, thereby facilitating subsequent rapid search of messages from the physical queue according to the SequenceID of the message.

[0110] Optionally, in another implementation of the present application, sub-step 2022 may include:

[0111] Sub-step C4, encapsulating the message to be processed with one-way linked list information according to the identity information to obtain a second message; wherein the one-way linked list information is set to empty or set to a preset identifier.

[0112] In an embodiment of the present application, when encapsulating the one-way linked list information of the message to be processed, the identity information can be associated with the message to be processed, and then the message to be processed is used as the payload, and the one-way node information and the payload are encapsulated into one.

[0113] Sub-step C5: storing the second message in a second storage location in the physical queue.

[0114] Specifically, sub-step C4 and sub-step C5 may refer to the above-mentioned sub-step C1 and sub-step C2, and will not be described in detail here.

[0115] Sub-step C6, searching the physical queue for the message at the first storage location according to the first storage location found from the index, and setting the second storage location in the one-way linked list information of the message.

[0116] In this step, the first storage location can be read from the preset storage area first, wherein the preset storage area can be specially set for storing the first storage location. Accordingly, after the first storage location is queried in the index, the first storage location can be stored in the preset storage area to facilitate reading in this step. The first storage location can then be accessed to determine the message in the first storage location. Next, a second storage location can be set in the one-way linked list information of the message, so that the one-way linked list information after setting can point to the second message, that is, point to the new end-of-line message, and then the message to be processed is linked to the previous end-of-line message as the new end-of-line message.

[0117] In the embodiment of the present application, when storing the pending message, the one-way linked list information is encapsulated for the pending message, and the second storage location is set in the one-way linked list information of the message in the first storage location, so that the message of the logical queue identification to which the pending message belongs forms a one-way linked list according to the backward link direction from front to back, and the pending messages belonging to the same logical queue identification are in the same one-way linked list, thereby forming the logical queue to which the pending message belongs. After finding a message in the logical queue, the next adjacent message of the message in the backward link direction can be quickly found in the physical queue according to the one-way linked list information, thereby to a certain extent, by sharing the physical queue, while reducing the hardware overhead, ensuring the efficiency of message search and ensuring low complexity. In this way, when reading the message from the physical queue later, the message to be read can also be found more quickly, thereby to a certain extent reducing the time overhead required for message search.

[0118] Optionally, in another implementation of the present application, sub-step 2022 may include:

[0119] Sub-step C7, encapsulating the message to be processed into one-way linked list information according to the identity information to obtain a second message; wherein the first storage location is set in the one-way linked list information.

[0120] In the embodiment of the present application, the first storage location can be read from the preset storage area first, and then the first storage location can be set in the one-way linked list information. In this way, the one-way linked list information after setting can point to the message in the first storage location, that is, the current tail message, and then the to-be-processed message can be used as a new tail message to link with the previous tail message.

[0121] Sub-step C8, storing the second message in a second storage location in the physical queue.

[0122] This step can refer to the above sub-steps and will not be repeated here.

[0123] In the embodiment of the present application, when storing the pending message, the one-way linked list information is encapsulated for the pending message, and the first storage position is set in the one-way linked list information of the pending message encapsulation, so that the message of the logical queue identification to which the pending message belongs forms a one-way linked list according to the forward link direction from back to front, and the pending messages belonging to the same logical queue identification are in the same one-way linked list, thereby forming the logical queue to which the pending message belongs. After finding a message in the logical queue, the next adjacent message of the message in the forward link direction can be quickly found in the physical queue according to the one-way linked list information, thereby to a certain extent, by sharing the physical queue, reducing the hardware overhead, ensuring the efficiency of message search, and ensuring low complexity. In this way, when reading the message from the physical queue later, the message to be read can also be found more quickly, thereby reducing the time overhead required for message search to a certain extent. At the same time, in this implementation, only the one-way linked list information needs to be encapsulated, the one-way linked list information is set, and the steps of storing the second message are required. Compared with the previous implementation of encapsulating the one-way linked list information, fewer steps need to be executed, so the storage efficiency is higher.

[0124] Furthermore, in the embodiment of the present application, since the implementation method of the one-way linked list information requires an additional preset storage area to be set, while the implementation method of encapsulating the two-way linked list information does not require an additional preset storage area to store the first storage location, the message of the first storage location can be queried by directly reading the first storage location in the forward node information. Therefore, compared with the implementation method of encapsulating the one-way linked list information, the implementation method of encapsulating the two-way linked list information can reduce storage resource overhead and save storage resources.

[0125] Since in the implementation method of the one-way linked list information, only the one-way linked list information needs to be encapsulated and set, while in the implementation method of encapsulating the bidirectional linked list information, the bidirectional linked list information needs to be encapsulated and set, that is, the number of required encapsulations and the content required to be set are more. Therefore, compared with the implementation method of encapsulating the bidirectional linked list information, the implementation method of encapsulating the one-way linked list information can save processing resources.

[0126] Step 203: Receive a message reading request; the message reading request includes identity information of the target message.

[0127] In the embodiment of the present application, the message reading request may be sent by a message request end, and the message request end may be the same as or different from the message sender. The target message may be the message that the message request end needs to read.

[0128] Step 204: Read the target message from the physical queue according to the identity information.

[0129] Optionally, when the identity information includes the logical queue identifier corresponding to the message sending end to which the to-be-processed message belongs, step 204 may include sub-steps:

[0130] Sub-step 2041, when the cache does not store the read message read last time and the fifth storage location of the read message, searching for the target storage location of the identity information in the physical queue according to the index.

[0131] In the embodiment of the present application, since the message acquisition end often acquires the messages in the queue in sequence, each time a message is read, it is often read from the position of the message read last time. Therefore, after reading the message, the last message in the message read this time, the identity message of the message and its storage position are often cached, that is, the read message and the fifth storage position are cached to facilitate the subsequent rapid positioning of the message to be read. Accordingly, in the case where the read message and the fifth storage position of the read message are not stored in the cache, that is, in the case where there is no fifth storage position that can be used as a reference, the target storage position where the target message is located can be found according to the index. In the embodiment of the present application, by recording the index and determining the target storage position by searching the index when there is no fifth storage position that can be used as a reference, the efficiency of determining the target storage position can be improved to a certain extent, thereby improving the message reading efficiency.

[0132] Optionally, in the embodiment of the present application, the message sequence identifier of the message may also be recorded in the index. Accordingly, when the identity information includes the logical queue identifier and the message sequence identifier, and the index records the third storage location of the head message and the first storage location of the tail message, sub-step 2041 may include:

[0133] Sub-step 20411, in the index, based on the target logical queue identifier of the target message, the target message sequence identifier, the third storage position of the head message and the first storage position of the tail message, search the sixth storage position in the physical queue that is closest to the target message sequence identifier.

[0134] In the embodiment of the present application, when the to-be-processed message encapsulates the bidirectional linked list information, the absolute values ​​of the differences between the target message sequence identifier and the message sequence identifier of the first message and the message sequence identifier of the last message can be calculated respectively, and the storage position of the message with the smallest corresponding absolute value is obtained from the third storage position and the first storage position as the sixth storage position. For example, assuming that the absolute value of the difference between the target message sequence identifier and the message sequence identifier of the first message is the smallest, the third storage position of the first message can be obtained as the sixth storage position.

[0135] Optionally, in the case where the message to be processed encapsulates one-way linked list information, the sixth storage position in the physical queue that is closest to the target message sequence identifier in the link direction of the one-way linked list information can be searched. Specifically, the message that precedes the target message in the link direction can be determined based on the message sequence identifier of the head message, the message sequence identifier of the tail message, and the target message sequence identifier, and then the absolute value of the difference between the message sequence identifiers of these messages and the target message sequence identifier is calculated, and the storage position of the message with the smallest corresponding absolute value is used as the sixth storage position. Among them, if the message sequence identifier increases successively in the link direction, the message sequence identifier can be less than the target message sequence identifier and determined as the message that precedes the target message in the link direction. Conversely, the message sequence identifier can be greater than the target message sequence identifier and determined as the message that precedes the target message in the link direction.

[0136] Optionally, when the index also records a fourth storage location of at least one intermediate message between the head message and the tail message, sub-step 20411 may include:

[0137] Sub-step D, in the index, based on the target logical queue identifier of the target message, the target message sequence identifier, the third storage position of the head message, the fourth storage position of the middle message, and the first storage position of the tail message, search the sixth storage position in the physical queue that is closest to the target message sequence identifier.

[0138] In the embodiment of the present application, when the to-be-processed message encapsulates the bidirectional linked list information, the absolute values ​​of the differences between the target message sequence identifier and the message sequence identifier of the first message, the message sequence identifier of the last message, and the message sequence identifier of the middle message can be calculated respectively, and the storage position of the message with the smallest corresponding absolute value is obtained from the third storage position, the first storage position, and the fourth storage position as the sixth storage position. For example, assuming that the absolute value of the difference between the target message sequence identifier and the message sequence identifier of the first message is the smallest, the third storage position of the first message can be obtained as the sixth storage position.

[0139] Optionally, in the case where the to-be-processed message encapsulates the one-way linked list information, the message sequence identifier of the head message, the message sequence identifier of the tail message, the message sequence identifier of the middle message and the target message sequence identifier can be used to determine the message that precedes the target message in the link direction, and then the absolute value of the difference between the message sequence identifiers of these messages and the target message sequence identifier is calculated, and the storage position of the message with the smallest corresponding absolute value is obtained from the third storage position, the first storage position and the fourth storage position as the sixth storage position. For example, assuming that the message sequence identifiers in the link direction increase in sequence, the message sequence identifiers of the head message, the tail message and the middle message are 1, 7 and 12 respectively, and the target message sequence identifier is 5, then it can be determined that the head message is the closest message in the link direction, and the third storage position is determined as the sixth storage position.

[0140] In an embodiment of the present application, by recording the storage locations of the head message, the tail message and the middle message in the index, more references can be provided for determining the sixth storage location, thereby to a certain extent improving the proximity of the sixth storage location to the target storage location of the target message, thereby improving the efficiency of subsequent determination of the target storage location based on the sixth storage location and reducing time overhead.

[0141] Sub-step 2043, reading the target message from the target storage location.

[0142] Optionally, in the embodiment of the present application, sub-step 2043 may include:

[0143] Sub-step 20431, starting from the message corresponding to the sixth storage location, searching the target storage location of the target message from the physical queue according to the linked list information of the message; wherein the linked list information includes bidirectional linked list information or unidirectional linked list information.

[0144] In the case where the linked list information is a bidirectional linked list information, in this step, the positional relationship between the message corresponding to the sixth storage position and the target message can be determined based on the target message sequence identifier and the message sequence identifier of the message corresponding to the sixth storage position. If the target message is located after the message corresponding to the sixth storage position, the backward linked list information of the next message can be read in sequence starting from the message corresponding to the sixth storage position, and the next message can be located according to the backward linked list information until the message sequence identifier of the located next message is consistent with the target message sequence identifier. Then, the storage position of the message can be determined as the target storage position.

[0145] In the case where the linked list information is one-way linked list information, in this step, starting from the message corresponding to the sixth storage position, the one-way linked list information of the next message in the link direction of the one-way linked list information can be sequentially located, and the next message can be located according to the one-way linked list information until the message sequence identifier of the located next message is consistent with the target message sequence identifier, and the storage position of the message can be determined as the target storage position.

[0146] In an embodiment of the present application, by recording the storage positions of the head message and the tail message in the index and encapsulating the linked list information, during the process of reading the target message, the sixth storage position closest to the target message in the logical queue to which the target message belongs can be located from the index, and then starting from the nearest sixth storage position, the target storage position can be searched from the storage positions of messages belonging to the same service according to the linked list information. In this way, compared with the method of traversing the physical queues in sequence to determine the target storage position of the target message, starting from the nearest sixth storage position and searching for the target storage position of the target message according to the linked list information can improve the reading efficiency of the target message, reduce the overhead of message reading, and ensure that the complexity of message reading is low.

[0147] Optionally, step 204 may further include sub-steps:

[0148] Sub-step 2043, when the last read message and the fifth storage location of the read message are stored in the cache, determine the target storage location of the identity information in the physical queue according to the fifth storage location where the read message is located.

[0149] In this step, if the cache stores the read message and the fifth storage location of the read message, it means that there is a fifth storage location that can be used as a reference, so the target storage location can be determined based on the fifth storage location. Specifically, when the linked list information is a two-way linked list information, the storage location of the message indicated by the backward linked list information can be determined as the target storage location based on the backward linked list information of the fifth storage location. When the linked list information is a one-way linked list information, the next message of the read message in the link direction of the one-way linked list information can be determined based on the one-way linked list information of the fifth storage location, and the storage location of the message can be determined as the target storage location.

[0150] In an embodiment of the present application, when the read messages and the fifth storage location of the read messages are stored in the cache, that is, when there is a fifth storage location that can be used as a reference, in the method of determining the target storage location according to the fifth storage location, the index search operation can be omitted, thereby improving the efficiency of determining the target storage location.

[0151] Optionally, in the embodiment of the present application, at least one message belonging to the logical queue identifier after the target message can also be read from the physical queue. The specific number of messages read after the target message can be set according to actual needs. For example, the number can be set to 10, 100, 1000, etc. In the embodiment of the present application, by continuing to read at least one message belonging to the logical queue identifier after the target message from the physical queue, the number of messages read can be expanded, thereby improving the message reading.

[0152] It should be noted that in the embodiment of the present application, after the message in the physical queue is read, the length of time the message has been read can be recorded, and when the length of time is greater than a preset threshold, the message can be deleted, thereby avoiding the waste of physical queue storage resources. Accordingly, after deleting the message, the index can be updated to ensure the accuracy of the index.

[0153] Reference Figure 4B , showing a physical queue and index schematic diagram provided by the present application, in Figure 4B In (a), the physical queue stores messages belonging to the logical queue IDs: Q1, Q2, and Q3. In 4B(c), the messages in the physical queue include three parts: forward node information, load, and backward node information. In this way, the forward node information and backward node information of the message in the physical queue point to the forward adjacent message and the backward adjacent message in the logical queue to which it belongs, respectively. In 4B(b), the index table records the storage address and message sequence ID (Seq) of the head message, tail message, and middle message according to the logical queue ID classification to facilitate search.

[0154] Reference Figure 4C , shows a message processing diagram from the perspective of a logical queue provided by the present application. In this diagram, the message can be stored in a physical queue according to the message Message specified by the message producer (producer) and its identity information "QueueId=1Seq=x". The messages belonging to the same QueueId in the physical queue form a logical queue. It can be seen that the physical queue includes N logical queues. Correspondingly, the message consumer (customer) can obtain messages from the physical queue. Among them, the message producer can be the message sender, and the message consumer can be the message acquirer.

[0155] In summary, the present application provides a message processing method, comprising: obtaining pending messages of at least two message senders and identity information corresponding to the pending messages, and storing the pending messages in a physical queue corresponding to the identity information according to the identity information; wherein the number of the message senders is greater than the number of the physical queues; receiving a message read request; the message read request includes the identity information of the target message, and the target message is read from the physical queue according to the identity information. In the present application, by sharing a physical queue with multiple message senders, the consumption of hardware media can be reduced, thereby reducing hardware overhead. In the case of a large number of message senders, the message storage requirements of the message senders can be supported at a lower hardware cost.

[0156] At the same time, since the number of physical queues that a hardware device can support is limited, if there are a large number of message senders, by continuously increasing the number of physical queues, the supported number will be displayed, which will cause the hardware device to be unable to meet the message storage needs. This application shares physical queues, and there is no need to set up a large number of physical queues. In this way, when facing the storage needs of a large number of message senders, it can avoid the problem of too many physical queues causing the hardware device to be unable to support it to a certain extent.

[0157] Furthermore, compared to the method of using a non-relational database to simulate queues to meet the storage needs of a large number of queues, since the implementation logic of simulating queues is relatively complex, this application can reduce the implementation cost of meeting the needs to a certain extent by sharing physical queues. At the same time, there is no need to rely on non-relational databases, thereby avoiding the limitations of non-relational database selection and support capabilities.

[0158] Reference Figure 5 , shows a flow chart of the steps of a message reading method of the present application. The method may include the following steps:

[0159] Step 301: Receive a message reading request sent by a message receiving end; the message reading request includes identity information of a target message.

[0160] This step may refer to the above step 203 and will not be described again here.

[0161] Step 303: read a target message corresponding to the identity information from a physical queue according to the identity information; wherein the physical queue stores to-be-processed messages sent by at least two message senders; wherein the number of the message senders is greater than the number of the physical queues.

[0162] This step may refer to the above step 204 and will not be described again here.

[0163] In summary, the embodiment of the present application receives a message reading request sent by a message receiving end; the message reading request includes the identity information of the target message, and according to the identity information, reads the target message corresponding to the identity information from the physical queue; wherein the physical queue stores the to-be-processed messages sent by at least two message sending ends; wherein the number of the message sending ends is greater than the number of the physical queues. In the present application, by sharing the physical queue by multiple message sending ends, the consumption of hardware media can be reduced, thereby reducing hardware overhead.

[0164] Reference Figure 6 , shows a flowchart of another message processing method of the present application, which may include the following steps:

[0165] Step 401: Obtain to-be-processed messages of at least two message sending ends and identity information corresponding to the to-be-processed messages; the identity information includes a logical queue identifier corresponding to the message sending end to which the to-be-processed messages belong.

[0166] Optionally, this step may include the following steps: obtaining the pending messages of at least two message sending ends, the message sequence identifiers corresponding to the pending messages, and the logical queue identifier corresponding to the message sending end to which the pending messages belong; or, may include the following steps: obtaining the pending messages of at least two message sending ends, and the logical queue identifier corresponding to the message sending end to which the pending messages belong; determining the message sequence identifier corresponding to the pending messages. Optionally, the following steps may also be performed in the embodiment of the present application: for any message sending end, determining the logical queue identifier corresponding to the message sending end, and notifying the message sending end of the logical queue identifier. The specific implementation method of each step can refer to the relevant description in the aforementioned embodiment, which will not be repeated here.

[0167] Step 402: Determine a first storage location of the to-be-processed message in an index according to the logical queue identifier; wherein the index records the storage locations of the messages in the physical queue classified by the logical queue identifier.

[0168] Optionally, this step may include the following steps: in the index, query the first storage location of the tail message corresponding to the logical queue identifier; wherein the tail message is a message in the existing messages of the physical queue that belongs to the logical queue identifier. The operation of recording the storage location in the index may be implemented by the following steps: in the index, record the third storage location of the head message and the first storage location of the tail message; wherein the head message and the tail message belong to the same logical queue identifier. The specific implementation method of each step may refer to the relevant description in the aforementioned embodiment, which will not be repeated here.

[0169] Step 403: According to the first storage location, the pending messages are stored in the form of a bidirectional linked list in the physical queue corresponding to the logical queue identifier; wherein the pending messages belonging to the same logical queue identifier are in the same bidirectional linked list, and the number of message senders is greater than the number of physical queues.

[0170] This optional step may include the following steps: encapsulating the to-be-processed message in a two-way linked list according to the identity information to obtain a second message; wherein the first storage location is set in the forward node information of the two-way linked list information, and the backward node information of the two-way linked list information is set to be empty or set to a preset identifier; storing the second message in the second storage location in the physical queue; querying the message of the first storage location in the physical queue according to the first storage location of the forward node information, and setting the second storage location in the backward node information of the message. The specific implementation method of each step can refer to the relevant description in the aforementioned embodiment, which will not be repeated here.

[0171] In summary, the embodiment of the present application obtains the pending messages of at least two message senders and the identity information corresponding to the pending messages, the identity information includes the logical queue identifier corresponding to the message sender to which the pending messages belong, and determines the first storage position of the pending messages in the index according to the logical queue identifier, wherein the index records the storage positions of the messages in the physical queue according to the logical queue identifier. According to the first storage position, the pending messages are stored in the form of a two-way linked list to the physical queue corresponding to the logical queue identifier; wherein the pending messages belonging to the same logical queue identifier are in the same two-way linked list, and the number of message senders is greater than the number of physical queues. In the embodiment of the present application, by sharing the physical queue by multiple message senders, the consumption of hardware media can be reduced, thereby reducing hardware overhead. At the same time, the first storage position can be located more conveniently through the recorded index, thereby ensuring storage efficiency to a certain extent. Further, by storing in the form of a two-way linked list, the pending messages belonging to the same logical queue identifier can be in the same two-way linked list. In this way, when the message is subsequently found, the forward adjacent message and the backward adjacent message of the message can be quickly found in the physical queue according to the bidirectional linked list, thereby ensuring the efficiency of message search.

[0172] Optionally, in the embodiment of the present application, the message reading can also be implemented by the following steps:

[0173] Step E: receiving a message reading request; the message reading request includes the identity information of the target message; the identity information of the target message includes the target logical queue identifier and the target message sequence identifier.

[0174] The implementation of this step can refer to the relevant description in the above embodiment, which will not be repeated here.

[0175] Step F: searching the storage location in the physical queue that is closest to the target message sequence identifier according to the index, the target logical queue identifier and the target message sequence identifier.

[0176] Optionally, this step can be performed when the last read message and the fifth storage position of the read message are not stored in the cache. Furthermore, when the third storage position of the head message and the first storage position of the tail message are recorded in the index, this step can be implemented by the following steps: in the index, according to the target logical queue identifier of the target message, the target message sequence identifier, the third storage position of the head message and the first storage position of the tail message, search the storage position in the physical queue that is closest to the target message sequence identifier. The specific implementation method of each step can refer to the relevant description in the aforementioned embodiment, which will not be repeated here.

[0177] Step G: searching the target storage location of the target message from the physical queue according to the bidirectional linked list information of the message corresponding to the nearest storage location.

[0178] Optionally, in this step, starting from the message corresponding to the most recent storage location, the target storage location of the target message can be searched from the physical queue according to the bidirectional linked list information of the message.

[0179] Step H: Read the target message from the target storage location.

[0180] The implementation of this step can refer to the relevant description in the above embodiment, which will not be repeated here.

[0181] Optionally, the following operations may also be performed in the embodiment of the present application: when the last read message and the fifth storage location of the read message are stored in the cache, the target storage location of the identity information in the physical queue is determined according to the fifth storage location of the read message.

[0182] Optionally, the following operations may also be performed in the embodiment of the present application: reading from the physical queue at least one message that belongs to the logical queue identifier after the target message.

[0183] The specific implementation method of each operation can refer to the relevant description in the above embodiment, which will not be repeated here.

[0184] Reference Figure 7 , shows a structural diagram of a message processing device of the present application, including:

[0185] The acquisition module 501 is used to acquire to-be-processed messages of at least two message sending ends and identity information corresponding to the to-be-processed messages; the identity information includes a logical queue identifier corresponding to the message sending end to which the to-be-processed messages belong.

[0186] The determination module 502 is used to determine the first storage location of the to-be-processed message in the index according to the logical queue identifier; wherein the index records the storage locations of the messages in the physical queue classified by the logical queue identifier.

[0187] The storage module 503 is used to store the pending messages in the form of a bidirectional linked list according to the first storage location to the physical queue corresponding to the logical queue identifier; wherein the pending messages belonging to the same logical queue identifier are in the same bidirectional linked list, and the number of message senders is greater than the number of physical queues.

[0188] Optionally, the device further comprises:

[0189] The receiving module is used to receive a message reading request; the message reading request includes the identity information of the target message; the identity information of the target message includes the target logical queue identifier and the target message sequence identifier.

[0190] The first search module is used to search for a storage location in the physical queue that is closest to the target message sequence identifier according to the index, the target logical queue identifier and the target message sequence identifier.

[0191] The second search module is used to search the target storage location of the target message from the physical queue according to the bidirectional linked list information of the message corresponding to the latest storage location.

[0192] A reading module is used to read the target message from the target storage location.

[0193] In summary, the device provided in the embodiment of the present application obtains the pending messages of at least two message sending ends and the identity information corresponding to the pending messages, and the identity information includes the logical queue identifier corresponding to the message sending end to which the pending messages belong, and determines the first storage position of the pending messages in the index according to the logical queue identifier, wherein the index records the storage positions of the messages in the physical queue according to the logical queue identifier. According to the first storage position, the pending messages are stored in the form of a two-way linked list to the physical queue corresponding to the logical queue identifier; wherein the pending messages belonging to the same logical queue identifier are in the same two-way linked list, and the number of message sending ends is greater than the number of physical queues. In the embodiment of the present application, by sharing the physical queue by multiple message sending ends, the consumption of hardware media can be reduced, thereby reducing hardware overhead. At the same time, the first storage position can be located more conveniently through the recorded index, thereby ensuring storage efficiency to a certain extent. Further, by storing in the form of a two-way linked list, the pending messages belonging to the same logical queue identifier can be in the same two-way linked list. In this way, when the message is subsequently found, the forward adjacent message and the backward adjacent message of the message can be quickly found in the physical queue according to the bidirectional linked list, thereby ensuring the efficiency of message search.

[0194] Reference Figure 8 , shows a structural diagram of another message processing device of the present application, including:

[0195] An acquisition module 601 is used to acquire to-be-processed messages of at least two message senders and identity information corresponding to the to-be-processed messages;

[0196] The first storage module 602 is used to store the to-be-processed message into a physical queue corresponding to the identity information according to the identity information; wherein the number of the message sending terminals is greater than the number of the physical queues.

[0197] Optionally, when the identity information includes a logical queue identifier corresponding to the message sending end to which the to-be-processed message belongs, the method further includes:

[0198] The second storage module is used to record the storage locations of the messages in the physical queue in the index according to the classification of the logical queue identifier.

[0199] Optionally, the first storage module 602 includes:

[0200] A query submodule, used to query the first storage location of the tail message corresponding to the logical queue identifier in the index; wherein the tail message is a message belonging to the logical queue identifier among the existing messages of the physical queue;

[0201] The storage submodule is used to store the to-be-processed message in the physical queue according to the identity information and the first storage location.

[0202] Optionally, the storage submodule includes:

[0203] A first encapsulation unit, configured to encapsulate bidirectional linked list information for the message to be processed according to the identity information;

[0204] A first setting unit, configured to set the first storage location in the forward node information of the bidirectional linked list information, and to set the backward node information of the bidirectional linked list information to be empty or to be set to a preset identifier, to obtain a second message;

[0205] a first storage unit, configured to store the second message in a second storage location in the physical queue;

[0206] A second setting unit is used to query the message of the first storage location in the physical queue according to the first storage location of the forward node information, and set the second storage location in the backward node information of the message.

[0207] Optionally, the storage submodule includes:

[0208] A second encapsulation unit, configured to encapsulate one-way linked list information for the message to be processed according to the identity information;

[0209] A third setting unit, used to set the one-way linked list information to empty or to a preset identifier, to obtain a second message;

[0210] a second storage unit, configured to store the second message in a second storage location in the physical queue;

[0211] The fourth setting unit is used to search for the message of the first storage location in the physical queue according to the first storage location found from the index, and set the second storage location in the one-way linked list information of the message.

[0212] Optionally, the storage submodule includes:

[0213] A third encapsulation unit, configured to encapsulate one-way linked list information for the message to be processed according to the identity information;

[0214] a fifth setting unit, configured to set the first storage location in the one-way linked list information to obtain a second message;

[0215] The third storage unit is used to store the second message in a second storage location in the physical queue.

[0216] Optionally, the second storage module includes:

[0217] The first recording submodule is used to record the third storage position of the head message and the first storage position of the tail message in the index; wherein the head message and the tail message belong to the same logical queue identifier.

[0218] Optionally, the first recording submodule includes:

[0219] A recording subunit is used to record the third storage position of the changed head message and / or the first storage position of the changed tail message in the index when the head message and / or the tail message in the physical queue are changed.

[0220] Optionally, the second storage module further includes:

[0221] The second recording submodule is used to record, in the index, a fourth storage position of at least one intermediate message between the head message and the tail message; the intermediate message, the head message and the tail message belong to the same logical queue identifier.

[0222] Optionally, the identity information includes a message sequence identifier corresponding to the to-be-processed message and a logical queue identifier corresponding to a message sending end to which the to-be-processed message belongs;

[0223] The acquisition module 601 includes:

[0224] A first acquisition submodule is used to acquire to-be-processed messages of at least two message sending ends, message sequence identifiers corresponding to the to-be-processed messages, and logical queue identifiers corresponding to the message sending ends to which the to-be-processed messages belong;

[0225] Alternatively, the acquisition module 601 includes:

[0226] A second acquisition submodule is used to acquire to-be-processed messages of at least two message sending ends, and a logical queue identifier corresponding to the message sending end to which the to-be-processed messages belong;

[0227] The first determining submodule is used to determine a message sequence identifier corresponding to the message to be processed.

[0228] Optionally, also include:

[0229] The determination module is used to determine the logical queue identifier corresponding to any message sending end, and notify the message sending end of the logical queue identifier.

[0230] Optionally, also include:

[0231] A receiving module, configured to receive a message reading request; the message reading request includes identity information of a target message;

[0232] The first reading module is used to read the target message from the physical queue according to the identity information.

[0233] Optionally, also include:

[0234] A recording module is used to record the message sequence identifier of the message in the index.

[0235] Optionally, when the identity information includes a logical queue identifier corresponding to a message sending end to which the to-be-processed message belongs, the first reading module includes:

[0236] A first search submodule, configured to search for a target storage location of the identity information in the physical queue according to the index when the last read message and the fifth storage location of the read message are not stored in the cache;

[0237] The first reading submodule is used to read the target message from the target storage location.

[0238] Optionally, also include:

[0239] The second determination submodule is used to determine the target storage position of the identity information in the physical queue according to the fifth storage position where the read message is located when the last read message and the fifth storage position of the read message are stored in the cache.

[0240] Optionally, when the identity information includes a logical queue identifier and a message sequence identifier, and the index records a third storage location of a head message and a first storage location of a tail message, the first search submodule includes:

[0241] a search unit, configured to search, in the index, for a sixth storage position in the physical queue that is closest to the target message sequence identifier according to the target logical queue identifier of the target message, the target message sequence identifier, the third storage position of the head message, and the first storage position of the tail message;

[0242] The first reading module includes:

[0243] A second search submodule, configured to start from the message corresponding to the sixth storage location and search the target storage location of the target message from the physical queue according to the linked list information of the message; wherein the linked list information includes bidirectional linked list information or unidirectional linked list information;

[0244] The second reading submodule is used to read the target message from the target storage location.

[0245] Optionally, when the index further records a fourth storage location of at least one intermediate message between the head message and the tail message, the search unit includes:

[0246] The first search subunit is used to search the sixth storage position in the physical queue that is closest to the target message sequence identifier in the index based on the target logical queue identifier of the target message, the target message sequence identifier, the third storage position of the head message, the fourth storage position of the middle message, and the first storage position of the tail message.

[0247] Optionally, in the case where the to-be-processed message is encapsulated with one-way linked list information, the search unit includes:

[0248] The second search subunit is used to search for a sixth storage position in the physical queue that is closest to the target message sequence identifier in the link direction of the one-way linked list information.

[0249] Optionally, also include:

[0250] The second reading module is used to read at least one message belonging to the logical queue identifier after the target message from the physical queue.

[0251] In summary, the device provided in the embodiment of the present application obtains the pending messages of at least two message senders and the identity information corresponding to the pending messages, and stores the pending messages in a physical queue corresponding to the identity information according to the identity information; wherein the number of the message senders is greater than the number of the physical queues. In the present application, by sharing the physical queue by multiple message senders, the consumption of hardware media can be reduced, thereby reducing hardware overhead.

[0252] Reference Fig. 9 , shows a structural diagram of a message reading device of the present application, including:

[0253] The acquisition module 611 is used to receive a message reading request sent by a message receiving end; the message reading request includes the identity information of the target message;

[0254] The reading module 612 is used to read the target message corresponding to the identity information from the physical queue according to the identity information; wherein the physical queue stores the pending messages sent by at least two message senders; wherein the number of the message senders is greater than the number of the physical queues.

[0255] In summary, the embodiment of the present application receives a message reading request sent by a message receiving end; the message reading request includes the identity information of the target message, and according to the identity information, reads the target message corresponding to the identity information from the physical queue; wherein the physical queue stores the to-be-processed messages sent by at least two message sending ends; wherein the number of the message sending ends is greater than the number of the physical queues. In the present application, by sharing the physical queue by multiple message sending ends, the consumption of hardware media can be reduced, thereby reducing hardware overhead.

[0256] The embodiment of the present application also provides a non-volatile readable storage medium, which stores one or more modules (programs). When the one or more modules are applied to a device, the device can execute instructions (instructions) of each method step in the embodiment of the present application.

[0257] The present application embodiment provides one or more machine-readable media on which instructions are stored, and when executed by one or more processors, an electronic device executes one or more of the methods described in the above embodiments. In the present application embodiment, the electronic device includes various types of devices such as terminal devices and servers (clusters).

[0258] The embodiments of the present disclosure may be implemented as a device configured as desired using any appropriate hardware, firmware, software, or any combination thereof, and the device may include electronic devices such as terminal devices and servers (clusters). Fig.10 An exemplary device 700333 that can be used to implement various embodiments described in this application is schematically shown.

[0259] For one embodiment, Fig.10 An exemplary apparatus 700 is shown having one or more processors 702, a control module (chip set) 704 coupled to at least one of the processor(s) 702, a memory 706 coupled to the control module 704, a non-volatile memory (NVM) / storage device 708 coupled to the control module 704, one or more input / output devices 710 coupled to the control module 704, and a network interface 712 coupled to the control module 704.

[0260] The processor 702 may include one or more single-core or multi-core processors, and the processor 702 may include any combination of general-purpose processors or special-purpose processors (such as graphics processors, application processors, baseband processors, etc.). In some embodiments, the device 700 can be used as a terminal device, server (cluster), etc. described in the embodiments of the present application.

[0261] In some embodiments, the apparatus 700 may include one or more computer-readable media (e.g., memory 706 or NVM / storage device 708) having instructions 714 and one or more processors 702 combined with the one or more computer-readable media and configured to execute the instructions 714 to implement a module to perform the actions described in the present disclosure.

[0262] For one embodiment, the control module 704 may include any suitable interface controller to provide any suitable interface to at least one of the processor(s) 702 and / or any suitable device or component in communication with the control module 704 .

[0263] The control module 704 may include a memory controller module to provide an interface to the memory 706. The memory controller module may be a hardware module, a software module, and / or a firmware module.

[0264] The memory 706 may be used, for example, to load and store data and / or instructions 714 for the device 700. For one embodiment, the memory 706 may include any suitable volatile memory, such as a suitable DRAM. In some embodiments, the memory 706 may include double data rate type four synchronous dynamic random access memory (DDR4 SDRAM).

[0265] For one embodiment, control module 704 may include one or more input / output controllers to provide an interface to NVM / storage device 708 and input / output device(s) 710 .

[0266] For example, NVM / storage 708 may be used to store data and / or instructions 714. NVM / storage 708 may include any suitable non-volatile memory (e.g., flash memory) and / or may include any suitable non-volatile storage device(s) (e.g., one or more hard disk drives (HDDs), one or more compact disk (CD) drives, and / or one or more digital versatile disk (DVD) drives).

[0267] NVM / storage device 708 may include storage resources that are physically part of the device on which apparatus 700 is installed, or it may be accessible to the device without being part of the device. For example, NVM / storage device 708 may be accessed via input / output device(s) 710 over a network.

[0268] (One or more) input / output devices 710 may provide an interface for the apparatus 700 to communicate with any other appropriate device, and the input / output device 710 may include a communication component, an audio component, a sensor component, etc. The network interface 712 may provide an interface for the apparatus 700 to communicate through one or more networks, and the apparatus 700 may wirelessly communicate with one or more components of a wireless network according to any of one or more wireless network standards and / or protocols, for example, accessing a wireless network based on a communication standard, such as WiFi, 2G, 3G, 4G, 5G, etc., or a combination thereof for wireless communication.

[0269] For one embodiment, at least one of the processor(s) 702 may be packaged together with the logic of one or more controllers (e.g., a memory controller module) of the control module 704. For one embodiment, at least one of the processor(s) 702 may be packaged together with the logic of one or more controllers of the control module 704 to form a system-in-package (SiP). For one embodiment, at least one of the processor(s) 702 may be integrated on the same die with the logic of one or more controllers of the control module 704. For one embodiment, at least one of the processor(s) 702 may be integrated on the same die with the logic of one or more controllers of the control module 704 to form a system-on-chip (SoC).

[0270] In various embodiments, the apparatus 700 may be, but is not limited to, a terminal device such as a server, a desktop computing device, or a mobile computing device (e.g., a laptop computing device, a handheld computing device, a tablet computer, a netbook, etc.). In various embodiments, the apparatus 700 may have more or fewer components and / or a different architecture. For example, in some embodiments, the apparatus 700 includes one or more cameras, a keyboard, a liquid crystal display (LCD) screen (including a touch screen display), a non-volatile memory port, multiple antennas, a graphics chip, an application-specific integrated circuit (ASIC), and a speaker.

[0271] Among them, the main control chip can be used as a processor or control module in the detection device, sensor data, location information, etc. are stored in a memory or NVM / storage device, the sensor group can be used as an input / output device, and the communication interface may include a network interface.

[0272] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0273] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0274] The present application embodiment is described with reference to the flowchart and / or block diagram of the method, terminal device (system) and computer program product according to the embodiment of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, and the combination of the process and / or box in the flowchart and / or block diagram can be realized by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing terminal device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device produce a device for realizing the function specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.

[0275] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0276] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce computer-implemented processing, so that the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0277] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0278] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0279] The above is a detailed introduction to a sandbox implementation method and device, an electronic device and a storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A message processing method, characterized in that: The method comprises: Obtaining to-be-processed messages from at least two message senders and identity information corresponding to the to-be-processed messages; In the case where the identity information includes a logical queue identifier corresponding to the message sending end to which the to-be-processed message belongs, in the index, the storage location of the message in the physical queue corresponding to the identity information is recorded according to the logical queue identifier; In the index, query the first storage location of the tail message corresponding to the logical queue identifier; wherein the tail message is a message belonging to the logical queue identifier among the existing messages of the physical queue; According to the identity information and the first storage location, the to-be-processed message is stored in the physical queue; wherein the number of the message sending ends is greater than the number of the physical queues.

2. The method according to claim 1, characterized in that The storing the to-be-processed message in the physical queue according to the identity information and the first storage location includes: According to the identity information, encapsulate the to-be-processed message with bidirectional linked list information to obtain a second message; wherein the first storage location is set in the forward node information of the bidirectional linked list information, and the backward node information of the bidirectional linked list information is set to be empty or set to a preset identifier; storing the second message in a second storage location in the physical queue; According to the first storage location of the forward node information, the message at the first storage location is searched in the physical queue, and the second storage location is set in the backward node information of the message.

3. The method according to claim 1, characterized in that The storing the to-be-processed message in the physical queue according to the identity information and the first storage location includes: According to the identity information, encapsulate the one-way linked list information for the message to be processed to obtain a second message; wherein the one-way linked list information is set to be empty or set to a preset identifier; storing the second message in a second storage location in the physical queue; According to the first storage location found from the index, the message of the first storage location is searched in the physical queue, and the second storage location is set in the one-way linked list information of the message.

4. The method according to claim 1, characterized in that: The storing the to-be-processed message in the physical queue according to the identity information and the first storage location includes: According to the identity information, encapsulate the message to be processed into one-way linked list information to obtain a second message; wherein the first storage location is set in the one-way linked list information; The second message is stored in a second storage location in the physical queue.

5. The method according to claim 1, characterized in that The storage location of the message in the physical queue corresponding to the identity information is recorded in the index according to the logical queue identifier classification, including: In the index, the third storage position of the head message and the first storage position of the tail message are recorded; wherein the head message and the tail message belong to the same logical queue identifier.

6. The method according to claim 5, characterized in that The third storage location of the first message and the first storage location of the last message are recorded in the index, including: When the head message and / or the tail message in the physical queue is changed, the third storage position of the changed head message and / or the first storage position of the changed tail message is recorded in the index.

7. The method according to claim 5, characterized in that Also includes: In the index, a fourth storage location of at least one intermediate message between the head message and the tail message is recorded; the intermediate message, the head message and the tail message are messages belonging to the same logical queue identifier.

8. The method according to any one of claims 1 to 7, characterized in that: The identity information includes a message sequence identifier corresponding to the to-be-processed message and a logical queue identifier corresponding to the message sending end to which the to-be-processed message belongs; The obtaining of to-be-processed messages of at least two message sending ends and identity information corresponding to the to-be-processed messages includes: Acquire to-be-processed messages of at least two message sending ends, message sequence identifiers corresponding to the to-be-processed messages, and logical queue identifiers corresponding to the message sending ends to which the to-be-processed messages belong; Alternatively, the obtaining of to-be-processed messages of at least two message senders and identity information corresponding to the to-be-processed messages includes: Obtaining to-be-processed messages of at least two message sending ends, and logical queue identifiers corresponding to the message sending ends to which the to-be-processed messages belong; Determine a message sequence identifier corresponding to the message to be processed.

9. The method according to claim 8, characterized in that Also includes: For any message sending end, a logical queue identifier corresponding to the message sending end is determined, and the message sending end is notified of the logical queue identifier.

10. The method according to any one of claims 1 to 7, characterized in that: Also includes: Receiving a message reading request; the message reading request includes identity information of a target message; The target message is read from the physical queue according to the identity information.

11. The method according to claim 10, characterized in that Also includes: In the index, the message sequence identifier of the message is recorded.

12. The method according to claim 11, characterized in that In a case where the identity information includes a logical queue identifier corresponding to a message sending end to which the to-be-processed message belongs, reading the target message from a physical queue according to the identity information includes: In the case that the last read message and the fifth storage location of the read message are not stored in the cache, searching for a target storage location of the identity information in the physical queue according to the index; The target message is read from the target storage location.

13. The method according to claim 12, characterized in that Also includes: In the case where the last read message and the fifth storage position of the read message are stored in the cache, the target storage position of the identity information in the physical queue is determined according to the fifth storage position where the read message is located.

14. The method according to claim 12, characterized in that In a case where the identity information includes a logical queue identifier and a message sequence identifier, and the index records a third storage location of a head message and a first storage location of a tail message, searching for a target storage location of the identity information in the physical queue according to the index includes: In the index, according to the target logical queue identifier of the target message, the target message sequence identifier, the third storage location of the head message and the first storage location of the tail message, find the sixth storage location in the physical queue that is closest to the target message sequence identifier; The step of reading the target message from the physical queue according to the identity information includes: Starting from the message corresponding to the sixth storage location, searching the target storage location of the target message from the physical queue according to the linked list information of the message; wherein the linked list information includes bidirectional linked list information or unidirectional linked list information; The target message is read from the target storage location.

15. The method according to claim 14, characterized in that In a case where the index further records a fourth storage position of at least one intermediate message between the head message and the tail message, searching, in the index, according to the target logical queue identifier of the target message, the target message sequence identifier, the third storage position of the head message, and the first storage position of the tail message, a sixth storage position in the physical queue closest to the target message sequence identifier includes: In the index, based on the target logical queue identifier of the target message, the target message sequence identifier, the third storage position of the head message, the fourth storage position of the middle message, and the first storage position of the tail message, the sixth storage position in the physical queue that is closest to the target message sequence identifier is searched.

16. The method according to claim 14, characterized in that In the case where the one-way linked list information is encapsulated for the message to be processed, searching the sixth storage location closest to the target message sequence identifier in the physical queue includes: Searching for a sixth storage location in the physical queue that is closest to the target message sequence identifier in the link direction of the one-way linked list information.

17. The method according to claim 10, characterized in that Also includes: At least one message belonging to the logical queue identifier after the target message is read from the physical queue.

18. A message processing method, characterized in that: The method comprises: Obtaining to-be-processed messages of at least two message sending ends and identity information corresponding to the to-be-processed messages; the identity information includes a logical queue identifier corresponding to the message sending end to which the to-be-processed messages belong; According to the logical queue identifier, determine the first storage location of the to-be-processed message in the index; wherein the index records the storage locations of the messages in the physical queue according to the logical queue identifier; the first storage location is the storage location of the tail message corresponding to the logical queue representation queried in the index, and the tail message is a message in the existing messages of the physical queue that belongs to the logical queue identifier; According to the identity information, encapsulate the to-be-processed message with bidirectional linked list information to obtain a second message; wherein the first storage location is set in the forward node information of the bidirectional linked list information, and the backward node information of the bidirectional linked list information is set to be empty or set to a preset identifier; storing the second message in a second storage location in the physical queue; According to the first storage location of the forward node information, the message at the first storage location is queried in the physical queue, and the second storage location is set in the backward node information of the message; wherein, the pending messages belonging to the same logical queue identifier are in the same bidirectional linked list, and the number of message senders is greater than the number of physical queues.

19. The method according to claim 18, characterized in that The method further comprises: Receive a message read request; the message read request includes identity information of a target message; the identity information of the target message includes a target logical queue identifier and a target message sequence identifier; According to the index, the target logical queue identifier and the target message sequence identifier, searching for a storage location in the physical queue that is closest to the target message sequence identifier; According to the bidirectional linked list information of the message corresponding to the most recent storage location, searching the target storage location of the target message from the physical queue; The target message is read from the target storage location.

20. A message processing device, characterized in that: The device comprises: An acquisition module, used to acquire the to-be-processed messages of at least two message senders and identity information corresponding to the to-be-processed messages; A second storage module is used to record the storage location of the message in the physical queue corresponding to the identity information in the index according to the logical queue identifier when the identity information includes the logical queue identifier corresponding to the message sending end to which the to-be-processed message belongs; A first storage module is used to query the first storage position of the tail message corresponding to the logical queue identifier in the index; wherein the tail message is a message belonging to the logical queue identifier among the existing messages of the physical queue; based on the identity information and the first storage position, the to-be-processed message is stored in the physical queue; wherein the number of the message senders is greater than the number of the physical queues.

21. A message processing device, characterized in that: The device comprises: An acquisition module, used to acquire to-be-processed messages of at least two message sending ends and identity information corresponding to the to-be-processed messages; the identity information includes a logical queue identifier corresponding to the message sending end to which the to-be-processed messages belong; A determination module, configured to determine a first storage location of the to-be-processed message in an index according to the logical queue identifier; wherein the index records the storage locations of messages in a physical queue according to the logical queue identifier; the first storage location is the storage location of a tail message corresponding to the logical queue representation queried in the index, and the tail message is a message in the existing messages of the physical queue that belongs to the logical queue identifier; A storage module is used to encapsulate the to-be-processed message in a bidirectional linked list according to the identity information to obtain a second message; wherein the first storage location is set in the forward node information of the bidirectional linked list information, and the backward node information of the bidirectional linked list information is set to empty or set to a preset identifier; the second message is stored in the second storage location in the physical queue; according to the first storage location of the forward node information, the message at the first storage location is queried in the physical queue, and the second storage location is set in the backward node information of the message; wherein the to-be-processed messages belonging to the same logical queue identifier are in the same bidirectional linked list, and the number of the message sending ends is greater than the number of the physical queues.

22. A device, characterized in that: include: one or more processors; and One or more machine-readable media having instructions stored thereon, which when executed by the one or more processors, cause the apparatus to perform the method of any one of claims 1 to 19.

23. One or more machine-readable media having stored thereon instructions which, when executed by one or more processors, perform the method of any one of claims 1 to 19.

Citation Information

Patent Citations

  • Message processing method and device

    CN104079508A

  • Database transaction processing method and device based on message queue

    CN105512244A