Message processing system and method, storage medium and computer program product
By caching the information of multiple message consumption units in the message processing system, monitoring and assisting in processing message accumulation, the response delay problem caused by the accumulation of message servers is solved, and the message processing efficiency and availability are improved.
Patent Information
- Application Number
- CN202410780748.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2024-09-24
AI Technical Summary
When using message queues, messages may accumulate in the message server, resulting in response delays. The existing solution requires pausing consumer consumption actions, creating new topics and consumers, and processing accumulated messages. The process is cumbersome and inefficient.
Design a message processing system that stores the message information of multiple message consumption units through cache, monitors the status of each message consumption unit, determines the unit without accumulation status as the consumption unit of concern, assists the unit in the accumulation status to process messages, and realizes message processing. of rapid consumption.
There is no need for temporary development, which improves the efficiency of message accumulation processing, reduces development workload, ensures that messages can be consumed quickly and timely, and reduces response delays.
Smart Images

Figure CN118689663A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a message processing system, a message processing method, a storage medium, and a computer program product. Background Art
[0002] With the rapid development of Internet technology, the scale of data is also increasing. Correspondingly, new challenges are posed to the processing efficiency and availability of databases. When using message queues such as rocketMq and kafka, consumers consume messages from message servers. If messages are accumulated on the message server or in the partitions of the message server, response delays will occur.
[0003] To solve this problem, currently the consumption actions of existing consumers are usually suspended, new topics and consumers are created, and the messages corresponding to the new topics are consumed by the new consumers. After the accumulated messages are processed, the original message consumption architecture is restored.
[0004] However, the above method requires temporary development work every time when messages are accumulated, which has a large workload, and the accumulated messages cannot be consumed quickly and timely, and the efficiency of processing accumulated messages is low. Summary of the invention
[0005] In order to solve one of the above technical problems, the present disclosure provides a message processing system, a message processing method, a readable storage medium and a computer program product.
[0006] According to one aspect of the present disclosure, a message processing system is provided, including a processor and a memory, the memory storing a computer program, and when the computer program is executed by the processor, the message processing system performs the following process: storing message information of N message consumption units in a cache manner, wherein N≥2; when the i-th message consumption unit among the N message consumption units is in a state of no message accumulation, determining whether other message consumption units other than the i-th message consumption unit among the N message consumption units are in a state of message accumulation based on the message information, wherein 1≤i≤N; treating other message consumption units in the state of message accumulation as focus consumption units of the i-th message consumption unit; and when the i-th message consumption unit's own messages are all consumed, enabling the i-th message consumption unit to obtain the messages of the focus consumption unit for consumption.
[0007] According to the message processing system of at least one embodiment of the present disclosure, the message information of each message consumption unit includes a message queue that needs to be consumed and a message queue that has been consumed successfully.
[0008] According to the message processing system of at least one embodiment of the present disclosure, storing message information of N message consumption units includes: obtaining a message queue from a message production unit, and partitioning the message queue into N partitions, wherein the N partitions correspond one-to-one to the N message consumption units.
[0009] According to the message processing system of at least one embodiment of the present disclosure, in the process that the i-th message consumption unit obtains the message of the concerned consumption unit for consumption, the i-th message consumption unit obtains the message from the message queue that needs to be consumed of the concerned consumption unit for consumption, and stores the successfully consumed message in the successfully consumed message queue of the concerned consumption unit.
[0010] According to the message processing system of at least one embodiment of the present disclosure, in the process of taking other message consumption units in a message accumulation state as the focus consumption units of the i-th message consumption unit, it includes: monitoring whether the N message consumption units are in a message accumulation state; and when the i-th message consumption unit is not in a message accumulation state, taking other message consumption units in a message accumulation state as the focus consumption units.
[0011] According to the message processing system of at least one embodiment of the present disclosure, during the process of the i-th message consumption unit consuming its own message, the message is obtained from the message queue that needs to be consumed in the message information of the i-th message consumption unit stored in a cache manner for consumption.
[0012] According to the message processing system of at least one embodiment of the present disclosure, during the process in which the i-th message consumption unit consumes the message of the concerned consumption unit, the message is obtained from the message queue that needs to be consumed in the message information of the concerned consumption unit stored in a cache manner for consumption.
[0013] According to the message processing system of at least one embodiment of the present disclosure, after the i-th message consumption unit successfully consumes the message of the concerned consumption unit, the successfully consumed message is stored in the successfully consumed message queue of the concerned consumption unit.
[0014] According to the message processing system of at least one embodiment of the present disclosure, the message information also includes message storage offset information, and the message accumulation state of the N message consumption units is determined according to the message storage offset information and the message queue that needs to be consumed.
[0015] According to the message processing system of at least one embodiment of the present disclosure, the N message consumption units belong to a message consumption unit group corresponding to messages of the same topic, and are used to process messages of the same topic.
[0016] According to another aspect of the present disclosure, a message processing method is provided, including: storing message information of N message consumption units in a cache manner, wherein N≥2; when the i-th message consumption unit among the N message consumption units is in a state of no message accumulation, determining whether other message consumption units other than the i-th message consumption unit among the N message consumption units are in a message accumulation state based on the message information, wherein 1≤i≤N; taking the other message consumption units in the message accumulation state as focus consumption units of the i-th message consumption unit; and when the i-th message consumption unit's own messages are all consumed, enabling the i-th message consumption unit to obtain the messages of the focus consumption unit for consumption.
[0017] According to another aspect of the present disclosure, a readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, it is used to implement the message processing method as described above.
[0018] According to another aspect of the present disclosure, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, it is at least used to implement the message processing method as described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings illustrate exemplary embodiments of the present disclosure and together with the description serve to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification.
[0020] Figure 1 It is a schematic diagram of an application scenario of a message processing system according to an embodiment of the present disclosure.
[0021] Figure 2 It is an overall schematic diagram of a message processing method according to an embodiment of the present disclosure.
[0022] Figure 3 It is a timing diagram of the interaction between various units in one implementation of the message processing system according to the present disclosure.
[0023] Figure 4 It is a schematic diagram of a message processing method according to an embodiment of the present disclosure.
[0024] Figure 5 It is a schematic diagram of a message processing method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0025] The present disclosure is further described in detail below in conjunction with the accompanying drawings and examples. It is understood that the specific examples described herein are only used to explain the relevant content, rather than to limit the present disclosure. It should also be noted that, for ease of description, only the parts related to the present disclosure are shown in the accompanying drawings.
[0026] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure can be combined with each other. The technical solution of the present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0027] In the disclosed implementation, the message is produced by the message production unit and stored in the message server in the form of a message queue. The message consumption unit consumes the message stored in the message server.
[0028] In the process of consuming messages by the message consumption unit, uneven message sending and other reasons may cause message accumulation in the message server or some partitions of the message server, resulting in the inability to quickly consume the messages. In view of this, the embodiments of the present disclosure provide a message processing system and method to solve the above technical problems.
[0029] Figure 1 1 shows an exemplary architecture of the message processing system 100 of the present disclosure. Figure 1 As shown, the message processing system 100 may include a message production unit 101, a message server 102, a message consumption unit 103, and a cache storage unit 104. The message production unit 101 is used to produce messages. The message production unit 101 can be multiple machines, or multiple processes of a machine, or multiple production objects of a process. The message consumption unit 103 is used to consume messages. The message consumption unit 103 can be multiple machines, or multiple processes of a machine, or multiple consumption objects of a process.
[0030] The message server 102 receives and stores messages produced by the message production unit 101, and receives and processes message subscription requests from the message consumption unit 103. The message consumption unit 103 can receive messages from messages stored in the message server 102 or receive messages pushed by the message server 102 for consumption (processing). Figure 1 As shown, the message production unit 101 and the message consumption unit 103 interact with the message server 102 to realize the production, storage and consumption of messages. In the present application, a cache storage unit 104 is also included, which can be used to receive messages from the message server 102 and store them in a cache manner. For example, the cache storage unit 104 can be in the form of a Redis database. In the present application, the cache storage unit 104 can be regarded as a part of the message server 102, or it can be regarded as a separate database, etc.
[0031] Figure 2 A schematic diagram of message processing according to an embodiment of the present disclosure is shown. As shown in the figure, a message production unit can generate messages, and the messages can be sent to a message server in the form of a message queue. The message server can store messages from the message production unit. For example, partition storage can be performed. Figure 2 The example in Figure 1 shows three partitions (first partition, second partition, and third partition) of the message server. The message server can store messages according to topics. For example, a type of business message will be classified into a topic and stored using associated partitions to achieve isolation between businesses. Figure 2 In the example, the three partitions shown can be used to store messages of one topic. In the case of storing messages of other topics, other partitions (not shown) of the message server can be used.
[0032] Message queues belonging to the same topic can be stored in three partitions. Each of the three partitions corresponds to a message consumption unit. Figure 2 Three message consumption units (message consumption unit 1, message consumption unit 2 and message consumption unit 3) are shown. Message consumption unit 1, message consumption unit 2 and message consumption unit 3 constitute a consumption unit group. The three message consumption units of the consumption unit group can consume messages of the same topic stored in the first partition to the third partition. In the present disclosure, each partition corresponds to a message consumption unit. Figure 2 It shows that the first partition corresponds to message consumption unit 1, the second partition corresponds to message consumption unit 2, and the third partition corresponds to message consumption unit 3. That is to say, message consumption unit 1 is assigned to the first partition and receives messages from the first partition for consumption, message consumption unit 2 is assigned to the second partition and receives messages from the second partition for consumption, and message consumption unit 3 is assigned to the third partition and receives messages from the third partition for consumption. In the present application, the way in which the message unit receives the partition message can be that the message server pushes the partition message to the message consumption unit, or the message consumption unit can pull the partition message for consumption.
[0033] After the message consumption unit 1, the message consumption unit 2 and the message consumption unit 3 are allocated to the corresponding partitions of the message server, the message information of the message consumption unit 1, the message consumption unit 2 and the message consumption unit 3 are stored in a cache storage manner. For example, the cache storage manner may be Redis storage, which can achieve faster access speed and facilitate the consumption of messages between the message consumption units.
[0034] In this application, after the message consumption unit is assigned to the partition corresponding to the message server, the messages stored in each partition can be stored in the Redis database by caching. Figure 2 As shown, for messages of the same topic, the message queues stored in each partition can be stored in the Redis database, so that in the process of the message consumption unit receiving the message, the message stored in the Redis database can be received for consumption. In the present application, after the message consumption unit is assigned to the corresponding partition, the messages stored in each partition can be directly stored in the Redis database. After storing the message in the Redis database, each message consumption unit consumes the message of the corresponding partition stored in the Redis database. For example, message consumption unit 1 consumes the message of the original first partition in the Redis database, message consumption unit 2 consumes the message of the original second partition in the Redis database, and message consumption unit 3 consumes the message of the original third partition in the Redis database.
[0035] In the process of the message consumption unit consuming the message of the Redis database, the Redis database records and stores the message queue information and offset information of each message consumption unit. For example, the message queue information may include the message queue (pulledMessageQueue) received from the partition corresponding to the message server and the message queue (consumedQueue) of successful consumption. The offset information may include, for example, the message storage offset information stored in the partition (such as the minimum offset minOffset and the maximum offset maxOffset).
[0036] exist Figure 2 In the example, the message consumption unit 3 is used for explanation. In the process of message consumption, the message consumption unit 3 obtains the corresponding message from the Redis database for consumption. In the process of message consumption, the Redis database records the corresponding information of message consumption, such as Figure 2 The message queue information and offset information.
[0037] In addition, a monitoring thread can be started to determine whether the message consumption unit 3 is in a busy state (message accumulation state) based on the message queue information and offset information corresponding to the message consumption unit 3. When the message consumption unit 3 is not in a busy state (idle state, message non-accumulation state), check whether the message consumption unit 1 and the message consumption unit 2 are in a busy state. In the present application, for the same topic in multiple different topics, more than two message consumption units can be used to consume messages of the same topic. If the message consumption unit 3 is called the current message consumption unit, if the current message consumption unit is in an idle state, check whether other message consumption units corresponding to the same topic are in a busy state. If there are busy message consumption units in other message consumption units, the other busy message consumption units are set as the focus consumption units of the current message consumption unit. As a specific example, other busy message consumption units can be added to the focus list of the current message consumption unit. Figure 2 As shown, if both message consumption unit 1 and message consumption unit 2 are in a busy state, message consumption unit 1 and message consumption unit 2 are added to the watch list of message consumption unit 3. In addition, if only message consumption unit 1 is in a busy state, only message consumption unit 1 is added to the watch list of message consumption unit 3. Among them, the watch list can be stored in a Redis database. If message consumption unit 3 is in a busy state, the watch list of message consumption unit 3 can be cleared. In the present application, the monitoring thread can perform real-time monitoring and dynamically modify the watch list of each message consumption unit. In addition, the same method can be used for message consumption unit 1 and message consumption unit 2, which will not be repeated here.
[0038] As an example, the message server monitors the consumption status of each message consumption unit. The message server determines whether each message consumption unit is busy based on the message storage offset information of each message consumption unit and the length of the message queue received from the partition. When the message server determines that the consumption status of one of the message consumption units is busy (there are messages accumulated), the follower list of the message consumption unit is cleared or not added to the follower list. The message server determines whether the consumption status of other message consumption units belonging to the same topic is busy. When the message consumption unit is idle (no messages are accumulated), the busy message consumption unit is included as a follower consumption unit in the follower list of the idle message consumption unit.
[0039] In the process of each message consumption unit consuming messages, the messages stored in the partitions can be stored in the Redis database in real time or periodically. For example, the messages corresponding to each message consumption unit can be stored in the message queue of the pulledMessageQueue of each message consumption unit, where the message queue is stored in the Redis database. Then each message consumption unit obtains messages from the message queue of the pulledMessageQueue of the Redis database for consumption. For example, the message allocated to the first partition corresponding to the message consumption unit 1 can be stored in the message queue of the pulledMessageQueue of the message consumption unit 1 stored in the Redis database. Message consumption unit 1 obtains messages from the message queue of the pulledMessageQueue for consumption.
[0040] After the message consumption is successful, the corresponding consumption information of each message consumption unit will be stored in the message queue of consumedQueue in the Redis database, so that the consumption status of each message consumption unit can be recorded. In addition, the consumption status of each message consumption unit can also be synchronized to the message server.
[0041] For each message consumption unit, a follow list can be set, and through the above conditions, for the idle message consumption unit, the follow list records the consumer units that it follows. After the idle message consumption unit consumes its own messages (messages in the pulledMessageQueue), the idle message consumption unit traverses its follower list at a fixed frequency. If there are other busy message consumption units, the message of one of the other message consumption units can be consumed. In addition, if there is no message accumulation in the message consumption unit, the idle message consumption unit can continue to consume another message of other message consumption units. Taking the above-mentioned message consumption unit as an example, if the idle message consumption unit consumes the message of the message consumption unit and the consumption is successful, the message is stored in the relevant information of the message consumption unit, for example, the message is stored in the message queue of the consumedQueue of the message consumption unit. In addition, the consumption status of each message consumption unit can be synchronized to the message server in real time or periodically. For example, the idle message consumption unit is Figure 2The message consumption unit 3 shown, when the message consumption unit 2 is in a busy state, the message consumption unit 3 obtains messages from the message queue of the pulledMessageQueue of the message consumption unit 2 for message consumption, and after the consumption is successful, the successfully consumed message is stored in the message queue of the consumedQueue of the message consumption unit 2. In the present application, when there is no message accumulation in a certain message consumption unit, its concerned consumption unit can be set in advance. That is to say, after the certain message consumption unit has processed its own messages, it can process the messages of the concerned message consumption unit (in the message accumulation state). In this way, for the message consumption unit in the message accumulation state, one or more message consumption units can assist in processing the accumulated messages. That is, the message consumption unit that assists in processing processes the accumulated messages together with the message processing unit in the message accumulation state.
[0042] Figure 3 A schematic diagram of a message processing method according to an embodiment of the present disclosure is shown.
[0043] In step S301, the message production unit generates a message. In step S302, the generated message is sent to the message server in the form of a message queue. In step S303, the message server stores the message queue. As described above, the message server can partition the message queue in the process of storing messages. For example, for each message of the same topic, more than two partitions can be set to store messages. Then, the messages of the same topic are consumed by the message consumption units corresponding to each partition. These message consumption units constitute a consumer unit group of the same topic message. In step S304, the storage method of the messages stored in each partition is changed, for example, the messages of each partition can be stored in a Redis database. In step S305, the message is stored in the Redis database. In step S306, the message consumption unit can receive messages from the Redis database. In step S307, the message consumption unit consumes the message. After the Redis database stores the message, the message information can be stored in the Redis database. For example, the message information may include message queue information (the message queue pulledMessageQueue obtained by the message consumption unit, the message queue consumedQueue of successful consumption) and message storage offset information (minimum offset minOffset and maximum offset maxOffset, such as offset information corresponding to partition storage) for Redis storage. In the present application, the message information of message consumption units of the same topic exists under the same topic. The message information corresponding to each message consumption unit is stored in the Redis database. In the present application, the message information may also be referred to as consumption unit information, that is, the information corresponding to each message consumption unit. As shown in step S308, the Redis server can store the message information in real time or periodically during the process of message consumption units consuming messages.
[0044] After the message consumption unit consumes its own message, it can obtain the information of other message consumption units for consumption in step S309. For the sake of convenience, the message consumption unit that consumes its own message is called the first message consumption unit. Before the first message consumption unit obtains the message of other message consumption units for consumption, it can monitor the message accumulation of each message consumption unit in the message consumption unit group of the same topic through the monitoring thread. If the first message consumption unit is in a state of no message accumulation, it is necessary to find out whether other message consumption units in the message consumption unit group are in a state of message accumulation. If there is a state of message accumulation in other message consumption units, the other message consumption units in the state of message accumulation are regarded as the concerned message consumption units of the first message consumption unit, for example, they can be added to the concerned list of the first message consumption unit. In addition, if the first message consumption unit is in a state of message accumulation, it is not added to its concerned list or its concerned list can be cleared.
[0045] When the first message consumption unit obtains messages from other message consumption units, it needs to complete its own message consumption. After completion, the first message consumption unit can select a message consumption unit from the corresponding other message consumption units according to its attention list to consume its messages. Specifically, the first message consumption unit can obtain messages from the message queue of the message consumption unit stored in the Redis database for consumption. After consumption is completed, the message successfully consumed by the first message consumption unit is stored in the message queue of the successful consumption of the message consumption unit.
[0046] In addition, in step S311, the message information stored in the Redis database may be synchronized to the message server. The synchronization step may be performed in real time or periodically. For example, after the Redis database stores the message from the partition, it may be performed in real time or periodically.
[0047] In this application, by determining the message accumulation of each message consumption unit in the message consumption unit group and enabling them to consume messages from each other, the imbalance of message processing can be well solved. Moreover, there is no need to modify the architecture of message consumption, and no development and maintenance work is required.
[0048] According to a further embodiment of the present disclosure, a message processing system is provided, which includes a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the message processing system executes the following message processing method.
[0049] Figure 4 A flow chart of a message processing method according to an embodiment of the present disclosure is shown. Figure 4The following contents are included. In the present application, the message information of each message consumption unit includes the message queue that needs to be consumed and the message queue that is successfully consumed, and may also include message storage offset information.
[0050] In step S410, the message information of N message consumption units is stored in a cache manner, where N ≥ 2. The message information of the N message consumption units can be stored in a Redis database. In the present application, N message consumption units can be a group of message consumption units that consume messages of the same topic. During the implementation of this step, the messages stored in the partition are obtained for cache storage, and during the processing of the message consumption unit, the message information of each message consumption unit is recorded and stored.
[0051] In step S420, it is determined whether the i-th message consumer unit among the N message consumer units has message accumulation. In the process of determination, the determination can be made based on the length of the message queue to be processed by the i-th message consumer unit and the offset information of the message storage. In this step, the monitoring thread can be used to monitor whether each message consumer unit of the N message consumer units has message accumulation.
[0052] When the i-th message consumption unit among the N message consumption units is in a state of no message accumulation, in step S430, it is determined whether other message consumption units except the i-th message consumption unit among the N message consumption units are in a state of message accumulation, where 1≤i≤N.
[0053] In step S440, other message consumption units in the message accumulation state are used as the focused consumption units of the i-th message consumption unit. And when all the messages of the i-th message consumption unit are consumed, in step S450, the i-th message consumption unit obtains the messages of the focused consumption unit for consumption.
[0054] According to a further embodiment of the present disclosure, a message processing method is further provided. Figure 5 The flowchart of the message processing method is shown. In the present application, N message consumption units belong to a message consumption unit group corresponding to messages of the same topic, and are used to process messages of the same topic.
[0055] In step S510, a message queue from a message production unit is obtained, and the message queue partitions are stored in N partitions, where the N partitions correspond one to one to the N message consumption units. In step S520, the message information of the N message consumption units is stored in a cache manner, where N≥2. For example, the message information can be stored in a Redis server. In step S530, the N message consumption units consume their own messages respectively. During the consumption process, each of the N message consumption units obtains messages from their respective message queues that need to be consumed and stored in the Redis server for consumption. In step S540, the message accumulation state of the N message consumption units is monitored. In step S550, when the i-th message consumption unit is in a state of no message accumulation, it is determined whether there are other message consumption units other than the i-th message consumption unit in the N message consumption units in the message accumulation state. If so, the other message consumption units in the message accumulation state are used as the concerned consumption units of the i-th message consumption unit. The process of taking other message consumption units in a message accumulation state as focus consumption units of the i-th message consumption unit includes: monitoring whether N message consumption units are in a message accumulation state; and taking other message consumption units in a message accumulation state as focus consumption units when the i-th message consumption unit is not in a message accumulation state.
[0056] In step S560, determine whether the i-th message consumption unit's own message has been consumed. If the consumption is completed, then in step S570, the i-th message consumption unit obtains the message from a message consumption unit in the concerned consumption unit for consumption. In step S580, the message successfully consumed by the i-th message consumption unit (the message that should have been consumed by this message consumption unit) is stored in the successfully consumed message queue of this message consumption unit. In the process of the i-th message consumption unit obtaining the message of the concerned consumption unit for consumption, the i-th message consumption unit obtains the message from the message queue that needs to be consumed by the concerned consumption unit for consumption, and stores the successfully consumed message in the successfully consumed message queue of the concerned consumption unit.
[0057] In addition, the message information of each message consumption unit can also be synchronized to the message server.
[0058] In an optional implementation of the present disclosure, the i-th message consumption unit consuming the messages of the message consumption units in the follower list may include: sorting the message consumption units in an ascending order based on the amount of messages of the message consumption units in the follower list; and the i-th message consumption unit consuming the messages of the message consumption units in the follower list in an ascending order.
[0059] In addition, it should be noted that the method steps of the present application do not need to be executed in the order described in this article, and can be executed simultaneously or in a different order. The order described in this article is only for the convenience of description and is not used to limit the present invention.
[0060] The present disclosure also provides a readable storage medium, in which execution instructions are stored, and when the execution instructions are executed by a processor, they are used to implement the above method. "Readable storage medium" can be any device that can contain, store, communicate, propagate or transmit programs for use in an instruction execution system, device or equipment or in combination with these instruction execution systems, devices or equipment. More specific examples of readable storage media include the following: an electrical connection portion (electronic device) with one or more wirings, a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), an optical fiber device, and a portable read-only memory (CDROM), etc.
[0061] The present disclosure also provides a computer program product, and the method of the present disclosure can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed, the process or function of the present disclosure is executed in whole or in part. A computer-readable storage medium can be used as an implementation of a computer program product, that is, the present disclosure also provides a computer-readable storage medium, which includes a computer program, and when the computer program is executed by a processor, any of the above methods is implemented.
[0062] The computer program or instructions may be stored in a readable storage medium or transmitted from one readable storage medium to another readable storage medium, for example, the computer program or instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means. The readable storage medium may be any available medium that can be accessed or a data storage device such as a server, data center, etc. that integrates one or more available media. The available medium may be a magnetic medium, such as a floppy disk, a hard disk, or a magnetic tape; it may also be an optical medium, such as a digital video disk; it may also be a semiconductor medium, such as a solid state drive. The computer readable storage medium may be a volatile or non-volatile storage medium, or may include both volatile and non-volatile types of storage media.
[0063] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0064] The present disclosure is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented 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 device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0065] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0066] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0067] In the description of this specification, the description with reference to the terms "one embodiment / method", "some embodiments / methods", "example", "specific example", or "some examples" etc. means that the specific features, structures, or characteristics described in conjunction with the embodiment / method or example are included in at least one embodiment / method or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment / method or example. Moreover, the specific features, structures, or characteristics described may be combined in any one or more embodiments / methods or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments / methods or examples described in this specification and features of different embodiments / methods or examples, unless they are contradictory.
[0068] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, "plurality" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0069] Those skilled in the art should understand that the above embodiments are only for the purpose of clearly illustrating the present disclosure, and are not intended to limit the scope of the present disclosure. For those skilled in the art, other changes or modifications may be made based on the above disclosure, and these changes or modifications are still within the scope of the present disclosure.
Claims
1. A message processing system, characterized in that: The message processing system comprises a processor and a memory, wherein the memory stores a computer program. When the computer program is executed by the processor, the message processing system performs the following process: The cache method stores the message information of N message consumption units, where N ≥ 2; In the case where the i-th message consumption unit among the N message consumption units is in a state of no message accumulation, determining whether other message consumption units other than the i-th message consumption unit among the N message consumption units are in a state of message accumulation based on the message information, where 1≤i≤N; Other message consumption units in a message accumulation state are used as concerned consumption units of the i-th message consumption unit; as well as In the case that all the messages of the i-th message consumption unit are consumed, the i-th message consumption unit is enabled to obtain the messages of the concerned consumption unit for consumption.
2. The message processing system according to claim 1, characterized in that: The message information of each message consumption unit includes the message queue that needs to be consumed and the message queue that is successfully consumed.
3. The message processing system according to claim 2, characterized in that: Storing the message information of the N message consumption units includes: obtaining a message queue from a message production unit, and partitioning the message queue into N partitions, wherein the N partitions correspond one-to-one to the N message consumption units.
4. The message processing system according to claim 2, characterized in that: In the process of the i-th message consumption unit obtaining the message of the concerned consumption unit for consumption, the i-th message consumption unit obtains the message from the message queue of the concerned consumption unit that needs to be consumed for consumption, and stores the successfully consumed message in the successfully consumed message queue of the concerned consumption unit.
5. The message processing system according to claim 2, characterized in that: The process of taking other message consumption units in a message accumulation state as the focused consumption units of the i-th message consumption unit includes: Monitoring whether the N message consumption units are in a message accumulation state; and When the i-th message consumption unit is not in a message accumulation state, other message consumption units in a message accumulation state are used as the focused consumption units.
6. The message processing system according to claim 5, characterized in that: After the i-th message consumption unit successfully consumes the message of the concerned consumption unit, the successfully consumed message is stored in the successfully consumed message queue of the concerned consumption unit.
7. The message processing system according to any one of claims 1 to 6, characterized in that: The N message consumption units belong to a message consumption unit group corresponding to messages of the same topic, and are used to process messages of the same topic.
8. A message processing method, characterized in that: include: The cache method stores the message information of N message consumption units, where N ≥ 2; In the case where the i-th message consumption unit among the N message consumption units is in a state of no message accumulation, determining whether other message consumption units other than the i-th message consumption unit among the N message consumption units are in a state of message accumulation based on the message information, where 1≤i≤N; Other message consumption units in a message accumulation state are used as concerned consumption units of the i-th message consumption unit; as well as In the case that all the messages of the i-th message consumption unit are consumed, the i-th message consumption unit is enabled to obtain the messages of the concerned consumption unit for consumption.
9. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, it is used to implement the message processing method according to claim 8.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program is at least used to implement the message processing method according to claim 8.
