Message processing method, device, system, electronic device and storage medium
By processing messages in the message queue and task pool according to priority in the message management device, the problem that the traditional message queue model cannot meet the priority processing requirements in the live broadcast scenario is solved, and efficient message processing, real-time processing and service compatibility are achieved.
Patent Information
- Application Number
- CN202210590298.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-26
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2042-05-26
AI Technical Summary
In live broadcast scenarios, the traditional message queue model cannot effectively process priority messages due to its first-in, first-out characteristics, resulting in an increase in delay when a large number of messages accumulate, which cannot meet the special needs of the service.
By receiving multiple priorities from the message generation device and putting them into the storage message queue of the corresponding priority, the message is retrieved from high to low in order of priority according to the request of the message processing device and sending it to the message Processing devices, while processing messages in a specific mode in the message task pool, ensure real-time processing of high-priority messages.
It realizes the allocation and processing of messages in the message management device according to priority, avoids intrusion into the service layer, has good service compatibility and ease of use, ensures real-timeness of high-priority messages and meets message processing needs.
Smart Images

Figure CN115002224B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computers, and in particular to a message processing method, device, system, electronic device and storage medium. Background Art
[0002] As a cloud-native technology, distributed message queues (often also called message middleware) are asynchronous communication methods corresponding to synchronous communication methods. They have been widely used in distributed systems, playing the role of asynchronous decoupling, peak shaving and valley filling, etc. However, in specific service scenarios, such as live broadcast scenarios, the first-in-first-out (FIFO) feature of the queue model determines that it cannot meet certain special needs, and priority processing is required to ensure that even when a large number of other messages are piled up and not processed, service data such as live broadcast can be processed in advance to reduce the impact of delays. Summary of the invention
[0003] In order to solve the problems in the related art, the embodiments of the present disclosure provide a message processing method, device, system, electronic device and storage medium.
[0004] In a first aspect, an embodiment of the present disclosure provides a message processing method, including:
[0005] receiving messages of multiple priorities from a message generating device;
[0006] According to the priority of the received message, the message is placed into a storage message queue of the corresponding priority;
[0007] According to the request of the message processing device, the message is taken out from the storage message queue in order of priority from high to low;
[0008] The message is sent to the message processing device.
[0009] In the disclosed embodiment,
[0010] The retrieving the message from the stored message queue according to the request of the message processing device in descending order of priority includes:
[0011] Obtaining the number of messages requested by the message processing device;
[0012] Taking out a message from the stored message queue with the highest priority and sending it to the message processing device;
[0013] When the number of messages taken out from the highest priority storage message queue is less than the number of messages requested by the message processing device, messages are taken out from the second highest priority storage message queue and sent to the message processing device, and so on, until the number of messages taken out is equal to the number of messages requested by the message processing device, or the messages in all the storage message queues are taken out.
[0014] In a second aspect, an embodiment of the present disclosure provides a message processing method, including:
[0015] sending a request for a specified number of messages to a message management device;
[0016] Put the received messages into the message task pool according to a specific mode;
[0017] The messages in the message task pool are processed from a specified position of the message task pool in a specified order.
[0018] In the disclosed embodiment,
[0019] The step of placing the received message into the message task pool according to a specific mode includes:
[0020] Under the condition that the specific mode is the insert mode, placing the message into a specific position of the message task pool according to the priority of the message; and / or
[0021] Under the condition that the specific mode is the attachment mode, the received messages are sequentially placed at the end of the message task pool in the order in which they are received.
[0022] In the disclosed embodiment,
[0023] Placing the message into a specific position of the message task pool according to the priority of the message includes:
[0024] The received message with the highest priority is placed at the head of the message task pool, the received message with the second highest priority is placed at the corresponding priority position of the message task pool, and the message with the lowest priority is placed at the tail of the message task pool.
[0025] In a third aspect, an embodiment of the present disclosure provides a message processing method, including:
[0026] The message management device receives messages of multiple priorities from the message generation device;
[0027] The message management device places the received message at the tail of a storage message queue of a corresponding priority according to the priority of the received message;
[0028] The message processing device sends a request for a specific number of messages to the message management device;
[0029] The message management device takes out the message from the stored message queue according to the request of the message processing device and in descending order of priority;
[0030] The message management device sends the message to the message processing device;
[0031] The message processing device puts the received message into a message task pool according to a specific mode;
[0032] The message processing device processes the messages in the message task pool from a specified position of the message task pool in a specified order.
[0033] In the disclosed embodiment,
[0034] The message management device takes out the message from the stored message queue according to the request of the message processing device in descending order of priority, including:
[0035] The message management device obtains the number of messages requested by the message processing device;
[0036] The message management device takes out a message from the stored message queue with the highest priority and sends it to the message processing device;
[0037] When the number of messages taken out by the message management device from the stored message queue with the highest priority is less than the number of messages requested by the message processing device, messages are taken out from the stored message queue with the second highest priority and sent to the message processing device, and so on, until the number of messages taken out is equal to the number of messages requested by the message processing device, or the messages in all the stored message queues are taken out.
[0038] In the disclosed embodiment,
[0039] The message processing device places the received message into the message task pool according to a specific mode, including:
[0040] Under the condition that the specific mode is the insert mode, the message management device places the message into a specific position of the message task pool according to the priority of the message; and / or
[0041] Under the condition that the specific mode is the attachment mode, the message processing device puts the received messages into the tail of the message task pool in sequence according to the order of reception.
[0042] In a fourth aspect, an embodiment of the present disclosure provides a message processing device, characterized in that it includes:
[0043] A message receiving module, used for receiving messages of multiple priorities from a message generating device;
[0044] A message storage module, used for placing the received message into a storage message queue of a corresponding priority according to the priority of the received message;
[0045] A message fetching module, used to fetch the message from the stored message queue in descending order of priority according to a request of a message processing device;
[0046] A message sending module is used to send the message to the message processing device.
[0047] In a fifth aspect, an embodiment of the present disclosure provides a message processing device, characterized in that it includes:
[0048] A request sending module, used for sending a request for a specific number of messages to a message management device;
[0049] The task pool module is used to put the received messages into the message task pool according to a specific mode;
[0050] The message processing module is used to process the messages in the message task pool from the specified position of the message task pool in a specified order.
[0051] In a sixth aspect, an embodiment of the present disclosure provides a message processing system, characterized in that it includes:
[0052] A message generating device for:
[0053] Send messages of multiple priorities to the message management device,
[0054] Message management equipment, used for:
[0055] receiving messages of multiple priorities from a message generating device;
[0056] According to the priority of the received message, the message is placed into a storage message queue of the corresponding priority;
[0057] According to the request of the message processing device, the message is taken out from the storage message queue in order of priority from high to low;
[0058] sending the message to the message processing device,
[0059] Message processing equipment, used for:
[0060] sending a request for a specified number of messages to the message management device;
[0061] Put the received messages into the message task pool according to a specific mode;
[0062] The messages in the message task pool are processed in sequence from the head of the message task pool.
[0063] In the seventh aspect, an embodiment of the present disclosure provides an electronic device, comprising a memory and a processor, wherein the memory is used to store one or more computer instructions, and wherein the one or more computer instructions are executed by the processor to implement the method as described in any one of the first aspect and the second aspect.
[0064] In an eighth aspect, a computer-readable storage medium is provided in an embodiment of the present disclosure, on which computer instructions are stored. When the computer instructions are executed by a processor, the method described in any one of the first aspect and the second aspect is implemented.
[0065] In a ninth aspect, a computer program is provided in an embodiment of the present disclosure, which includes computer instructions, and when the computer instructions are executed by a processor, the method described in any one of the first aspect and the second aspect is implemented.
[0066] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0067] According to the technical solution provided by the embodiment of the present disclosure, messages of multiple priorities are received from a message generating device; according to the priority of the received message, the message is placed in a storage message queue of the corresponding priority; according to the request of the message processing device, the message is taken out from the storage message queue in order from high to low priority; the message is sent to the message processing device, so that the message is divided into multiple queues according to the priority in the message management device, and taken out according to the priority, which is completely decoupled from the specific service, avoids intrusion into the service layer, and has good service compatibility and ease of use.
[0068] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] Other features, objectives and advantages of the present disclosure will become more apparent through the following detailed description of non-limiting embodiments in conjunction with the accompanying drawings. In the accompanying drawings:
[0070] Figure 1 An exemplary schematic diagram showing an implementation scenario of a traditional message processing method.
[0071] Figure 2 An exemplary schematic diagram showing an implementation scenario of another traditional message processing method.
[0072] Figure 3An exemplary schematic diagram shows an implementation scenario of a message processing method according to an embodiment of the present disclosure.
[0073] Figure 4 An exemplary schematic diagram shows an implementation scenario of a message processing method according to an embodiment of the present disclosure.
[0074] Figure 5 A flowchart of a message processing method according to an embodiment of the present disclosure is shown.
[0075] Figure 6 A flowchart of a message processing method according to an embodiment of the present disclosure is shown.
[0076] Figure 7 A structural block diagram of a message processing device according to an embodiment of the present disclosure is shown.
[0077] Figure 8 A structural block diagram of a message processing device according to an embodiment of the present disclosure is shown.
[0078] Fig. 9 A structural block diagram of a message processing system according to an embodiment of the present disclosure is shown.
[0079] Fig.10 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown.
[0080] Fig.11 A schematic diagram showing the structure of a computer system suitable for implementing the method according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0081] Hereinafter, exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings so that those skilled in the art can easily implement them. In addition, for the sake of clarity, parts not related to the description of the exemplary embodiments are omitted in the accompanying drawings.
[0082] In the present disclosure, it should be understood that terms such as "include" or "have" are intended to indicate the presence of labels, numbers, steps, behaviors, components, parts, or combinations thereof disclosed in the present specification, and are not intended to exclude the possibility that one or more other labels, numbers, steps, behaviors, components, parts, or combinations thereof exist or are added.
[0083] It should also be noted that, in the absence of conflict, the embodiments and labels in the embodiments of the present disclosure can be combined with each other. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0084] Distributed message queues, as an asynchronous communication method corresponding to synchronous communication methods, have been widely used in distributed systems, playing the role of asynchronous decoupling, peak shaving and valley filling, etc. However, in specific service scenarios, such as live broadcast scenarios, the FIFO characteristics of the queue model determine that it cannot meet certain special needs, and priority processing is required to ensure that even when a large number of other messages are piled up and not processed, service data such as live broadcast can be processed in advance to reduce the impact of delays.
[0085] Figure 1 An exemplary schematic diagram showing an implementation scenario of a traditional message processing method.
[0086] like Figure 1 As shown, in the message generating device, the mapping relationship from priority to topic is completed, that is, the messages of priority 1, N, 2, 1 are mapped to topic-1, topic-N, topic-2, topic-1. In the message management device, corresponding to the messages of topic-1, topic-2, topic-N, topics 1, 2..., N have corresponding N consumer IDs at the message processing device, namely GID-1,..., GID-N. The topic is not transparent to the upper-layer application and the topic is still exposed. On the message generating device side, the message needs to be mapped to the corresponding topic according to the priority of the message; and on the message processing device side, N independent consumer processes will be implicitly started at the bottom layer to subscribe to N topics respectively. It is necessary to perform cumbersome adaptation of the service, which seriously invades the service layer, has poor upgrade compatibility, and poor usability.
[0087] Figure 2 An exemplary schematic diagram showing an implementation scenario of another traditional message processing method.
[0088] like Figure 2 As shown, for messages of different priorities in the message generating device, different priorities are bound to different parts in the message management device, with a high priority allocation ratio and a low priority ratio. The message generating device sends the message to a specific queue of the message management device based on the priority and the selection mechanism. On the message processing device side, the consumer process instance is based on the priority rebalancing strategy. According to the same ratio, more consumer instances with high priority access than those with low priority. In this scenario, cumbersome adaptation of the service is also required, which seriously intrudes on the service layer, has poor upgrade compatibility and poor usability.
[0089] To solve the above problems, the present disclosure proposes a data transmission method, device, electronic device, storage medium and program.
[0090] Figure 3 An exemplary schematic diagram shows an implementation scenario of a message processing method according to an embodiment of the present disclosure.
[0091] It can be understood by those skilled in the art that Figure 3 The implementation scenario of the message processing method is exemplified and does not constitute a limitation of the present disclosure.
[0092] like Figure 3 As shown, Figure 3 It includes: message generating equipment, message managing equipment and message processing equipment.
[0093] In the embodiment of the present disclosure, messages of different priorities are generated in the message generating device and are represented by blocks of different grayscales, where darker grayscales represent higher priorities.
[0094] The message management device includes multiple queues, for example, 5 queues with priorities from high to low. The highest priority queue includes 3 messages, and the secondary queues include 1, 1, 4, and 6 messages in sequence.
[0095] The message processing device requests a maximum of, for example, 6 messages from the message management device. When processing the request of the message processing device, the message management device scans the queues of each priority level in descending order of priority. If enough messages are taken out from the high-priority queue, the taken messages are sent to the message processing device and then returned. If the number of messages in the high-priority queue is insufficient, the messages in the queue of the next priority level are read, and so on, until a sufficient number of messages are read, or the messages in all queues are read out.
[0096] In the disclosed embodiment, the message management device takes out 3 messages from the highest priority queue, and takes out 1, 1, and 1 messages from subsequent and secondary queues in sequence, for a total of 6 messages, and sends them to the message processing device as a response to the message processing device's request for 6 messages.
[0097] Figure 4 An exemplary schematic diagram shows an implementation scenario of a message processing method according to an embodiment of the present disclosure.
[0098] It can be understood by those skilled in the art that Figure 4 The implementation scenario of the message processing method is exemplified and does not constitute a limitation of the present disclosure.
[0099] Specifically, Figure 4 An example is shown Figure 3 The message processing process of the message processing device in.
[0100] In the embodiment of the present disclosure, from the perspective of the message processing device, the message management device is equivalent to a single logical message queue. The logical message queue shows Figure 3 Multiple queues of different priorities in the message management device are equivalent to the logical structure of the message processing device.
[0101] In the embodiment of the present disclosure, in the logical message queue of the message management device, there may be low priority messages indicated by white filling and high priority messages indicated by gray filling, wherein the high priority message is the Nth message.
[0102] After the message processing device sends a request for two messages to the message management device, the message management device takes out the high priority message at position N and the low priority message at position 1 from the logical message queue, and sends them to the message processing device.
[0103] In the embodiment of the present disclosure, the message processing device may include two types: an attach mode message processing device and an insert mode message processing device. Both the attach mode message processing device and the insert mode message processing device include a task pool.
[0104] For the attached mode message processing device, the high priority message at position N and the low priority message at position 1 are attached to the tail of the task pool in sequence. The attached mode message processing device takes out messages from the head of the task pool in sequence for processing. In this mode, the existing messages in the task pool are processed first, and the processing of existing messages will not be delayed due to new messages. Among the newly added messages, high priority messages are processed before low priority messages, ensuring the real-time processing of high priority messages.
[0105] Those skilled in the art will appreciate that the message may also be attached to the head of the task pool and taken out from the tail of the task pool. Alternatively, the message may be taken out selectively instead of sequentially, and the present disclosure does not limit this.
[0106] For the insert mode message processing device, the high priority message at position N is inserted into the head of the task pool, and the low priority message at position 1 is added to the tail of the task pool. The insert mode message processing device takes out the messages from the head of the task pool in turn for processing. In this mode, the newly added high priority message at position N is processed first, thereby ensuring the real-time processing of the high priority message to the greatest extent. The original low priority message in the task pool may be delayed.
[0107] In the disclosed embodiment, only two types of priority messages are shown, namely high priority messages and low priority messages. When there are multiple priority messages in the logical message queue, such as the highest priority, the second highest priority, and the lowest priority (not shown in the figure), the message management device can take out the messages of multiple priorities according to the number of messages requested by the message processing device, in order from high to low priority. For the attachment mode message processing device, it is attached to the tail of the task pool in order from high to low priority. For the insertion mode message processing device, it is inserted into a specific position of the task pool according to the priority of the message. For example, the highest priority message is inserted into the head of the task pool, the lowest priority message is inserted into the tail of the task pool, and the second highest priority message is inserted into the second highest priority message position of the task pool.
[0108] Figure 5 A flowchart of a message processing method according to an embodiment of the present disclosure is shown.
[0109] Figure 5 Specifically shows Figure 3 A method for a message management device in a message management system to process a message.
[0110] like Figure 5 As shown, the message processing method includes steps S501, S502, S503, and S504.
[0111] In step S501 , messages of multiple priorities are received from a message generating device.
[0112] In step S502, according to the priority of the received message, the message is placed in a storage message queue of the corresponding priority.
[0113] In step S503, according to the request of the message processing device, the message is taken out from the stored message queue in descending order of priority.
[0114] In step S504, the message is sent to the message processing device.
[0115] As mentioned above Figure 3 According to the analysis, messages of different priorities are generated in the message generating device and represented by blocks of different gray levels, where dark gray represents high priority.
[0116] The message management device includes multiple queues, for example, 5 queues with priorities from high to low. The highest priority queue includes 3 messages, and the secondary queues include 1, 1, 4, and 6 messages in sequence.
[0117] The message processing device requests a maximum of, for example, 6 messages from the message management device. When processing the request of the message processing device, the message management device scans the queues of each priority level in descending order of priority. If enough messages are taken out from the high-priority queue, the taken messages are sent to the message processing device and then returned. If the number of messages in the high-priority queue is insufficient, the messages in the queue of the next priority level are read, and so on, until a sufficient number of messages are read, or the messages in all queues are read out.
[0118] In the disclosed embodiment, the message management device takes out 3 messages from the highest priority queue, and takes out 1, 1, and 1 messages from subsequent and secondary queues in sequence, for a total of 6 messages, and sends them to the message processing device as a response to the message processing device's request for 6 messages.
[0119] According to the embodiments of the present disclosure, messages of multiple priorities are received from a message generating device; the messages are placed into a storage message queue of the corresponding priority according to the priority of the received messages; the messages are taken out from the storage message queue in order from high to low priority according to the request of the message processing device; the messages are sent to the message processing device, thereby dividing the messages into multiple queues according to the priority in the message management device and taking them out according to the priority, which is completely decoupled from the specific services, avoids intrusion into the service layer, and has good service compatibility and ease of use.
[0120] According to an embodiment of the present disclosure, taking out the messages from the stored message queue according to the request of the message processing device in order from high to low priority includes: obtaining the number of messages requested by the message processing device; taking out messages from the stored message queue with the highest priority and sending them to the message processing device; when the number of messages taken out from the stored message queue with the highest priority is less than the number of messages requested by the message processing device, taking out messages from the stored message queue with the second highest priority and sending them to the message processing device, and so on, until the number of messages taken out is equal to the number of messages requested by the message processing device, or taking out the messages in all the stored message queues, thereby ensuring the real-time processing of high-priority messages and trying to meet the message processing device's requirements for the number of messages to be taken out.
[0121] Figure 6 A flowchart of a message processing method according to an embodiment of the present disclosure is shown.
[0122] Figure 6 Specifically shows Figure 3 , Figure 4 A method for a message processing device in a message processing device to process a message.
[0123] like Figure 6 As shown, the message processing method includes steps S601, S602, and S603.
[0124] In step S601, a request for a specific number of messages is sent to a message management device.
[0125] In step S602, the received message is put into the message task pool according to a specific mode.
[0126] In step S603, the messages in the message task pool are processed from the specified position of the message task pool in a specified order.
[0127] As mentioned above Figure 4 According to the analysis, when the message processing device sends a request for 2 messages to the message management device, the message management device takes out the high priority message at position N and the low priority message at position 1 from the logical message queue and sends them to the message processing device.
[0128] In the embodiment of the present disclosure, the message processing device may include two types: an attach mode message processing device and an insert mode message processing device. Both the attach mode message processing device and the insert mode message processing device include a task pool.
[0129] For the attached mode message processing device, the high priority message at position N and the low priority message at position 1 are attached to the tail of the task pool in sequence. The attached mode message processing device takes out messages from a specified position, such as the head, of the task pool in a specified order, such as in sequence, for processing. In this mode, the existing messages in the task pool are processed first, and the processing of the existing messages will not be delayed due to new messages. Among the newly added messages, high priority messages are processed before low priority messages, ensuring the real-time processing of high priority messages.
[0130] Those skilled in the art will appreciate that the message may be attached to the head of the task pool and taken out from the tail for processing, or may be taken out selectively instead of sequentially, which is not limited in the present disclosure.
[0131] For the insert mode message processing device, the high priority message at position N is inserted into the head of the task pool, and the low priority message at position 1 is added to the tail of the task pool. The attached mode message processing device takes out messages from the specified position of the task pool, such as the head, for processing in a specified order, such as in sequence. In this mode, the newly added high priority message at position N is processed first, thereby ensuring the real-time processing of the high priority message to the greatest extent. The original low priority message in the task pool may cause delays. In the embodiment of the present disclosure, only two priority messages are shown, namely high priority messages and low priority messages. When there are multiple priority messages in the logical message queue, such as the highest priority, the second highest priority, and the lowest priority (not shown in the figure), the message management device can take out the messages of multiple priorities according to the number of messages requested by the message processing device, in the order of priority from high to low. For the attached mode message processing device, it is attached to the tail of the task pool in the order of priority from high to low. For the insert mode message processing device, it is inserted into a specific position of the task pool according to the priority of the message. For example, the highest priority message is inserted into the head of the task pool, the lowest priority message is inserted into the tail of the task pool, and the second highest priority message is inserted into the second highest priority message position of the task pool.
[0132] According to an embodiment of the present disclosure, a request for a specific number of messages is sent to a message management device; the received messages are placed into a message task pool according to a specific mode; and the messages in the message task pool are processed from a specified position in the message task pool in a specified order, thereby meeting the real-time processing requirements for messages of different priorities according to different modes.
[0133] According to an embodiment of the present disclosure, placing the received message into the message task pool according to a specific mode includes: placing the message into a specific position of the message task pool according to the priority of the message under the condition that the specific mode is an insert mode; and / or placing the received messages into the tail of the message task pool in the order of reception in sequence under the condition that the specific mode is an attach mode, so that in the insert mode, the real-time processing requirements of high-priority messages are met to the greatest extent possible, and in the attach mode, the existing messages in the task pool are given priority and the real-time processing requirements of newly added high-priority messages are met.
[0134] According to an embodiment of the present disclosure, placing the message into a specific position of the message task pool according to the priority of the message includes: placing the received message with the highest priority into the head of the message task pool, placing the received message with the second highest priority into the corresponding priority position of the message task pool, and placing the lowest priority message into the tail of the message task pool, so that in the insertion mode, the insertion position in the task pool is finely managed according to the message priority, thereby meeting the real-time processing requirements of messages of different priorities.
[0135] In the embodiment of the present disclosure, based on the above Figure 3 , Figure 4 According to the analysis, the message generating device, the message managing device and the message processing device can interact in the following ways.
[0136] The message management device receives messages of multiple priorities from the message generation device;
[0137] The message management device places the received message at the tail of a storage message queue of a corresponding priority according to the priority of the received message;
[0138] The message processing device sends a request for a specific number of messages to the message management device;
[0139] The message management device takes out the message from the stored message queue according to the request of the message processing device and in descending order of priority;
[0140] The message management device sends the message to the message processing device;
[0141] The message processing device puts the received message into a message task pool according to a specific mode;
[0142] The message processing device processes the messages in the message task pool from a specified position of the message task pool in a specified order.
[0143] According to an embodiment of the present disclosure, a message management device receives messages of multiple priorities from a message generation device; the message management device puts the messages into the tail of a storage message queue of the corresponding priority according to the priority of the received messages; a message processing device sends a request for a specific number of messages to the message management device; the message management device takes out the messages from the storage message queue in order from high to low priority according to the request of the message processing device; the message management device sends the messages to the message processing device; the message processing device puts the received messages into a message task pool according to a specific mode; the message processing device processes the messages in the message task pool from a specified position of the message task pool in a specified order, so that the messages are divided into multiple queues according to priority in the message management device, and taken out according to priority, which is completely decoupled from specific services, avoids intrusion into the service layer, has good service compatibility and ease of use, and the message processing device meets the real-time processing requirements of messages of different priorities according to different modes.
[0144] According to an embodiment of the present disclosure, the message management device takes out the message from the stored message queue according to the request of the message processing device in order from high to low priority, including: the message management device obtains the number of messages requested by the message processing device; the message management device takes out messages from the stored message queue with the highest priority and sends them to the message processing device; when the number of messages taken out from the stored message queue with the highest priority by the message management device is less than the number of messages requested by the message processing device, the message management device takes out messages from the stored message queue with the second highest priority and sends them to the message processing device, and so on, until the number of messages taken out is equal to the number of messages requested by the message processing device, or the messages in all the stored message queues are taken out, thereby ensuring the real-time processing of high-priority messages and trying to meet the requirements of the message processing device for the number of messages to be taken out.
[0145] According to an embodiment of the present disclosure, the message processing device places the received message into the message task pool according to a specific mode, including: under the condition that the specific mode is the insert mode, the message management device places the message into a specific position of the message task pool according to the priority of the message; and / or under the condition that the specific mode is the attach mode, the message processing device places the received messages into the tail of the message task pool in sequence according to the order of reception, so that in the insert mode, the real-time processing requirements of high-priority messages are met to the greatest extent possible, and in the attach mode, the existing messages in the task pool are given priority and the real-time processing requirements of newly added high-priority messages are met.
[0146] Figure 7A structural block diagram of a message processing device according to an embodiment of the present disclosure is shown.
[0147] Figure 7 Specifically, for example Figure 3 A structural block diagram of a message processing device of a message management device in FIG.
[0148] like Figure 7 As shown, the message processing device 700 includes: a message receiving module 701, a message storage module 702, a message retrieving module 703, and a message sending module 704.
[0149] The message receiving module 701 is used to receive messages of multiple priorities from a message generating device;
[0150] The message storage module 702 is used to put the received message into a storage message queue of a corresponding priority according to the priority of the received message;
[0151] The message fetching module 703 is used to fetch the message from the stored message queue in descending order of priority according to the request of the message processing device;
[0152] The message sending module 704 is used to send the message to the message processing device.
[0153] According to the embodiments of the present disclosure, a message receiving module is used to receive messages of multiple priorities from a message generating device; a message storage module is used to place the messages into a storage message queue of a corresponding priority according to the priority of the received messages; a message retrieval module is used to retrieve the messages from the storage message queue in order of priority from high to low according to the request of a message processing device; and a message sending module is used to send the messages to the message processing device, so that the messages are divided into multiple queues according to priority in the message management device and retrieved according to priority. The message management device is completely decoupled from specific services to avoid intrusion into the service layer, and has good service compatibility and ease of use.
[0154] According to an embodiment of the present disclosure, taking out the messages from the stored message queue according to the request of the message processing device in order from high to low priority includes: obtaining the number of messages requested by the message processing device; taking out messages from the stored message queue with the highest priority and sending them to the message processing device; when the number of messages taken out from the stored message queue with the highest priority is less than the number of messages requested by the message processing device, taking out messages from the stored message queue with the second highest priority and sending them to the message processing device, and so on, until the number of messages taken out is equal to the number of messages requested by the message processing device, or taking out the messages in all the stored message queues, thereby ensuring the real-time processing of high-priority messages and trying to meet the message processing device's requirements for the number of messages to be taken out.
[0155] Figure 8 A structural block diagram of a message processing device according to an embodiment of the present disclosure is shown.
[0156] Figure 8 Specifically, for example Figure 3 , Figure 4 A structural block diagram of a message processing device of a message processing device in FIG.
[0157] like Figure 8 As shown, the message processing device 800 includes: a request sending module 801, a task pool module 802, and a message processing module 803.
[0158] A request sending module 801, configured to send a request for a specific number of messages to a message management device;
[0159] The task pool module 802 is used to put the received message into the message task pool according to a specific mode;
[0160] The message processing module 803 is used to process the messages in the message task pool from the specified position of the message task pool in a specified order.
[0161] According to the embodiment of the present disclosure, a request sending module is used to send a request for a specific number of messages to a message management device; a task pool module is used to put the received messages into a message task pool according to a specific mode; and a message processing module is used to process the messages in the message task pool from a specified position of the message task pool in a specified order, thereby meeting the real-time processing requirements for messages of different priorities according to different modes.
[0162] According to an embodiment of the present disclosure, placing the received message into the message task pool according to a specific mode includes: placing the message into a specific position of the message task pool according to the priority of the message under the condition that the specific mode is an insert mode; and / or placing the received messages into the tail of the message task pool in the order of reception in sequence under the condition that the specific mode is an attach mode, so that in the insert mode, the real-time processing requirements of high-priority messages are met to the greatest extent possible, and in the attach mode, the existing messages in the task pool are given priority and the real-time processing requirements of newly added high-priority messages are met.
[0163] According to an embodiment of the present disclosure, placing the message into a specific position of the message task pool according to the priority of the message includes: placing the received message with the highest priority into the head of the message task pool, placing the received message with the second highest priority into the corresponding priority position of the message task pool, and placing the lowest priority message into the tail of the message task pool, so that in the insertion mode, the insertion position in the task pool is finely managed according to the message priority, thereby meeting the real-time processing requirements of messages of different priorities.
[0164] Fig. 9 A structural block diagram of a message processing system according to an embodiment of the present disclosure is shown.
[0165] like Fig. 9 As shown, the message processing system 900 includes: a message generating device 901 , a message managing device 902 , and a message processing device 903 .
[0166] The message generating device 901 is used to send messages of multiple priorities to the message managing device.
[0167] The message management device 902 is used to: receive messages of multiple priorities from a message generating device; place the messages into a storage message queue of a corresponding priority according to the priority of the received messages; take out the messages from the storage message queue in descending order of priority according to the request of a message processing device; and send the messages to the message processing device.
[0168] The message processing device 903 is used to: send a request for a specific number of messages to the message management device; put the received messages into a message task pool according to a specific mode; and process the messages in the message task pool from a specified position in the message task pool in a specified order.
[0169] According to an embodiment of the present disclosure, a message generating device is used to: send messages of multiple priorities to a message managing device, and the message managing device is used to: receive messages of multiple priorities from a message generating device; according to the priority of the received message, place the message into a storage message queue of the corresponding priority; according to the request of a message processing device, take out the message from the storage message queue in order from high to low priority; send the message to the message processing device, and the message processing device is used to: send a request for a specific number of messages to the message managing device; place the received message into a message task pool according to a specific mode; and process the messages in the message task pool in sequence from the head of the message task pool, so that the messages are divided into multiple queues according to priority in the message managing device, and taken out according to priority. It is completely decoupled from specific services, avoids intrusion into the service layer, has good service compatibility and ease of use, and the message processing device meets the real-time processing requirements of messages of different priorities according to different modes.
[0170] Fig.10 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown.
[0171] like Fig.10 As shown, the electronic device 1000 includes a memory 1001 and a processor 1002, wherein the memory 1001 is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor 1002 to implement the following steps:
[0172] receiving messages of multiple priorities from a message generating device;
[0173] According to the priority of the received message, the message is placed into a storage message queue of the corresponding priority;
[0174] According to the request of the message processing device, the message is taken out from the storage message queue in order of priority from high to low;
[0175] The message is sent to the message processing device.
[0176] In the disclosed embodiment,
[0177] The retrieving the message from the stored message queue according to the request of the message processing device in descending order of priority includes:
[0178] Obtaining the number of messages requested by the message processing device;
[0179] Taking out a message from the stored message queue with the highest priority and sending it to the message processing device;
[0180] When the number of messages taken out from the highest priority storage message queue is less than the number of messages requested by the message processing device, messages are taken out from the second highest priority storage message queue and sent to the message processing device, and so on, until the number of messages taken out is equal to the number of messages requested by the message processing device, or the messages in all the storage message queues are taken out.
[0181] The one or more computer instructions are also executed by the processor 1002 to implement the following steps:
[0182] sending a request for a specified number of messages to a message management device;
[0183] Put the received messages into the message task pool according to a specific mode;
[0184] The messages in the message task pool are processed from a specified position of the message task pool in a specified order.
[0185] In the disclosed embodiment,
[0186] The step of placing the received message into the message task pool according to a specific mode includes:
[0187] Under the condition that the specific mode is the insert mode, placing the message into a specific position of the message task pool according to the priority of the message; and / or
[0188] Under the condition that the specific mode is the attachment mode, the received messages are sequentially placed at the end of the message task pool in the order in which they are received.
[0189] In the disclosed embodiment,
[0190] Placing the message into a specific position of the message task pool according to the priority of the message includes:
[0191] The received message with the highest priority is placed at the head of the message task pool, the received message with the second highest priority is placed at the corresponding priority position of the message task pool, and the message with the lowest priority is placed at the tail of the message task pool.
[0192] Fig.11 A schematic diagram showing the structure of a computer system suitable for implementing the method according to an embodiment of the present disclosure is shown.
[0193] like Fig.11As shown, the computer system 1100 includes a processing unit 1101, which can perform various processes in the above-mentioned embodiments according to a program stored in a read-only memory (ROM) 1102 or a program loaded from a storage part 1108 into a random access memory (RAM) 1103. In the RAM 1103, various programs and data required for the operation of the computer system 1100 are also stored. The processing unit 1101, the ROM 1102, and the RAM 1103 are connected to each other via a bus 704. An input / output (I / O) interface 1105 is also connected to the bus 1104.
[0194] The following components are connected to the I / O interface 1105: an input section 1106 including a keyboard, a mouse, etc.; an output section 1107 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a LAN card, a modem, etc. The communication section 1109 performs communication processing via a network such as the Internet. The drive 1110 is also connected to the I / O interface 1105 as needed. Removable media 1111, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive 1110 as needed, so that the computer program read therefrom is installed into the storage section 1108 as needed. Among them, the processing unit 1101 can be implemented as a processing unit such as a CPU, a GPU, a TPU, an FPGA, an NPU, etc.
[0195] In particular, according to an embodiment of the present disclosure, the method described above can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes computer instructions, and the computer instructions are executed by a processor to implement the method steps described above. In such an embodiment, the computer program product can be downloaded and installed from a network through the communication part 1109, and / or installed from a removable medium 1111.
[0196] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0197] The units or modules involved in the embodiments described in the present disclosure may be implemented by software or programmable hardware. The units or modules described may also be set in a processor, and the names of these units or modules do not constitute limitations on the units or modules themselves in some cases.
[0198] As another aspect, the present disclosure further provides a computer-readable storage medium, which may be a computer-readable storage medium included in the electronic device or computer system in the above embodiment; or a computer-readable storage medium that exists independently and is not assembled into a device. The computer-readable storage medium stores one or more programs, and the programs are used by one or more processors to execute the method described in the present disclosure.
[0199] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of the invention involved in the present disclosure is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the inventive concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other.
Claims
1. A message processing method, characterized in that: include: receiving messages of multiple priorities from a message generating device; According to the priority of the received message, the message is placed into a storage message queue of the corresponding priority; According to the request of the message processing device, the message is taken out from the storage message queue in order of priority from high to low; The message is sent to the message processing device, so that the message processing device puts the message into a message task pool according to a specific mode, and processes the messages in the message task pool from a specified position of the message task pool in a specified order.
2. The method according to claim 1, characterized in that The retrieving the message from the stored message queue according to the request of the message processing device in descending order of priority includes: Obtaining the number of messages requested by the message processing device; Taking out a message from the stored message queue with the highest priority and sending it to the message processing device; When the number of messages taken out from the highest priority storage message queue is less than the number of messages requested by the message processing device, messages are taken out from the second highest priority storage message queue and sent to the message processing device, and so on, until the number of messages taken out is equal to the number of messages requested by the message processing device, or the messages in all the storage message queues are taken out.
3. A message processing method, characterized in that: include: sending a request for a specified number of messages to a message management device; Put the received messages into the message task pool according to a specific mode; wherein the messages are stored in the corresponding storage message queue according to the priority by the message management device, and are taken out from the storage message queue in the order of priority from high to low; The messages in the message task pool are processed from a specified position of the message task pool in a specified order.
4. The method according to claim 3, characterized in that The step of placing the received message into the message task pool according to a specific mode includes: Under the condition that the specific mode is the insert mode, placing the message into a specific position of the message task pool according to the priority of the message; and / or Under the condition that the specific mode is the attachment mode, the received messages are sequentially placed at the end of the message task pool in the order in which they are received.
5. The method according to claim 4, characterized in that Placing the message into a specific position of the message task pool according to the priority of the message includes: The received message with the highest priority is placed at the head of the message task pool, the received message with the second highest priority is placed at the corresponding priority position of the message task pool, and the message with the lowest priority is placed at the tail of the message task pool.
6. A message processing method, characterized in that: include: The message management device receives messages of multiple priorities from the message generation device; The message management device places the received message at the tail of a storage message queue of a corresponding priority according to the priority of the received message; The message processing device sends a request for a specific number of messages to the message management device; The message management device takes out the message from the stored message queue according to the request of the message processing device and in descending order of priority; The message management device sends the message to the message processing device; The message processing device puts the received message into a message task pool according to a specific mode; The message processing device processes the messages in the message task pool from a specified position of the message task pool in a specified order.
7. The method according to claim 6, characterized in that The message management device takes out the message from the stored message queue according to the request of the message processing device in descending order of priority, including: The message management device obtains the number of messages requested by the message processing device; The message management device takes out a message from the stored message queue with the highest priority and sends it to the message processing device; When the number of messages taken out by the message management device from the stored message queue with the highest priority is less than the number of messages requested by the message processing device, messages are taken out from the stored message queue with the second highest priority and sent to the message processing device, and so on, until the number of messages taken out is equal to the number of messages requested by the message processing device, or the messages in all the stored message queues are taken out.
8. The method according to claim 6, characterized in that The message processing device places the received message into the message task pool according to a specific mode, including: Under the condition that the specific mode is the insert mode, the message management device places the message into a specific position of the message task pool according to the priority of the message; and / or Under the condition that the specific mode is the attachment mode, the message processing device puts the received messages into the tail of the message task pool in sequence according to the order of reception.
9. A message processing device, characterized in that: include: A message receiving module, used for receiving messages of multiple priorities from a message generating device; A message storage module, used for placing the received message into a storage message queue of a corresponding priority according to the priority of the received message; A message fetching module, used to fetch the message from the stored message queue in descending order of priority according to a request of a message processing device; The message sending module is used to send the message to the message processing device so that the message processing device puts the message into a message task pool according to a specific mode and processes the messages in the message task pool from a specified position of the message task pool in a specified order.
10. A message processing device, characterized in that: include: A request sending module, used for sending a request for a specific number of messages to a message management device; The task pool module is used to put the received messages into the message task pool according to a specific mode; wherein the messages are stored in the corresponding storage message queue according to the priority by the message management device, and are taken out from the storage message queue in the order of priority from high to low; The message processing module is used to process the messages in the message task pool from the specified position of the message task pool in a specified order.
11. A message processing system, characterized in that: include: A message generating device for: Send messages of multiple priorities to the message management device, Message management equipment, used for: receiving messages of multiple priorities from a message generating device; According to the priority of the received message, the message is placed into a storage message queue of the corresponding priority; According to the request of the message processing device, the message is taken out from the storage message queue in order of priority from high to low; sending the message to the message processing device, Message processing equipment, used for: sending a request for a specified number of messages to the message management device; Put the received messages into the message task pool according to a specific mode; The messages in the message task pool are processed from a specified position of the message task pool in a specified order.
12. An electronic device comprising a memory and a processor; wherein: The memory is used to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method steps described in any one of claims 1-5.
13. A readable storage medium having computer instructions stored thereon, wherein the computer instructions, when executed by a processor, implement the method steps described in any one of claims 1 to 5.
14. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by a processor, the method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Information caching method and device
CN105763481A
Inter-process communication method and device based on priority queue
CN106354573A
Message processing method and message processing device
CN107391283A
Message processing method, device and equipment
CN111404838A