Message processing system and method, storage medium and computer program product

By introducing the second type of consumption unit in the message processing system, dynamically expanding the capacity to handle message accumulation, the problem of response delay and low processing efficiency caused by message accumulation in the message queue is solved, achieving fast and timely consumption of accumulated messages, and reducing the development workload. .

CN118740741APending Publication Date: 2024-10-01KE COM (BEIJING) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410781544.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-17
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

In the message queue, when messages accumulate in the message server or its partition, the existing technology requires suspending the consumer's current consumption action and creating a new topic and consumer to process the accumulated messages, resulting in a heavy development workload and low processing efficiency.

Method used

By introducing a second type of consumption unit into the message processing system, the capacity is dynamically expanded to handle the accumulation of messages. The second type of consumption unit is connected to the auxiliary processor to assist the first type of consumption unit in processing the accumulation of messages, avoiding the suspension of the original consumption process.

Benefits of technology

It improves the efficiency and capability of message accumulation processing, reduces the development workload, enables rapid and timely consumption of accumulated messages, and improves the response delay and availability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118740741A_ABST
    Figure CN118740741A_ABST
Patent Text Reader

Abstract

The invention provides a message processing system and method, a storage medium and a computer program product. The message processing system comprises one or more processors and one or more memories, computer programs are stored in the memories, and when the computer programs are executed by the processors, the message processing system executes the following processes: a message processor of a message server establishes a connection with a first type of consumption unit; the messages in the first message set of the message server are consumed by the first type of consumption unit; under the condition that message accumulation occurs in the first message set, an auxiliary processor corresponding to the message processor establishes connection with a second type of consumption unit; and the second message in the first message set is consumed by the second type of consumption unit, wherein the second message is a part of the message in the first message set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and more particularly to a message processing system, method, storage medium and 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. In the process of using message queues, 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. In order to solve this problem, the current consumption action of the consumer is usually suspended, a new topic and consumer are created, and the messages corresponding to the newly created topic are consumed by the newly created consumer. After the accumulated messages are processed, the original message consumption architecture is restored.

[0003] However, the above method requires temporary development work every time messages accumulate, which results in a large amount of development work, and the accumulated messages cannot be consumed quickly and in a timely manner, resulting in low efficiency in processing accumulated messages. Summary of the invention

[0004] In order to solve one of the above technical problems, the present disclosure provides a message processing system, method, storage medium and computer program product.

[0005] 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: a message processor of a message server establishes a connection with a first type of consumer unit; messages in a first message set of the message server are consumed by the first type of consumer unit; in the event of message accumulation in the first message set, an auxiliary processor corresponding to the message processor establishes a connection with a second type of consumer unit; a second message in the first message set is consumed by the second type of consumer unit, the second message being a part of the accumulated messages in the first message set.

[0006] In an optional embodiment of the present disclosure, the number of the first type consumer units is N, where N≥1, the N first type consumer units are respectively connected to one of the N partitions, and the N partitions are used to partition and store messages of the same topic.

[0007] In an optional embodiment of the present disclosure, the number of the second type consumer units is M, where M≥1, and one of the M second type consumer units can be connected to an auxiliary processor corresponding to one of the N first type consumer units.

[0008] In an optional implementation of the present disclosure, after the first type of consumer unit is allocated to the corresponding message server, the storage mode of the first message is modified to cache storage.

[0009] In an optional embodiment of the present disclosure, it is monitored whether there is message accumulation in a first type consumer unit corresponding to a second message consumed by the second type consumer unit. If there is no message accumulation, the second type consumer unit is connected to an auxiliary processor of another first type consumer unit with message accumulation and message consumption is performed.

[0010] In an optional implementation of the present disclosure, it further includes: a message production unit generates messages and stores the messages in N partitions, and each partition is allocated a first type consumption unit.

[0011] In an optional embodiment of the present disclosure, when the first type consumer unit consumes a message in the first message set, the first type consumer unit records the message set successfully consumed received from the message server; the second type consumer unit stores the consumption result of successfully consuming the second message in the message set successfully consumed; and based on the message set successfully consumed, the first type consumer unit returns the consumption result of successfully consuming the second message by the second type consumer unit to the message server.

[0012] In an optional implementation of the present disclosure, it also includes: when the first type consumer unit consumes a message in the first message set, the first type consumer unit records the maximum offset and the minimum offset of the messages in the first message set stored by the message server; based on the minimum offset of the messages in the first message set stored by the message server, the initial position of the second type consumer unit consuming the second message is determined; based on the maximum offset of the messages in the first message set stored by the message server, the second type consumer unit is determined to complete the consumption of the second message.

[0013] In an optional implementation of the present disclosure, it also includes: when the first type consumer unit consumes a message in the first message set, the first type consumer unit records the maximum offset and the minimum offset of the messages in the first message set stored by the message server; based on the minimum offset of the messages in the first message set stored by the message server, the initial position of the second type consumer unit consuming the second message is determined; and based on the maximum offset of the messages in the first message set stored by the message server, it is determined that the second type consumer unit completes the consumption of the second message.

[0014] In an optional implementation of the present disclosure, the method further includes: comparing the messages accumulated in the first message set with a message threshold; when the messages accumulated in the first message set are greater than the message threshold, confirming that message accumulation occurs in the first message set.

[0015] 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 described above.

[0016] 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 described above. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] 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.

[0018] Figure 1 It is a schematic diagram of an application scenario of a message processing system according to an embodiment of the present disclosure.

[0019] Figure 2 It is an overall schematic diagram of a message processing method according to an embodiment of the present disclosure.

[0020] 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.

[0021] Figure 4 It is a flowchart of a message processing method according to an embodiment of the present disclosure. DETAILED DESCRIPTION

[0022] 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.

[0023] 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.

[0024] In the embodiment of the present disclosure, the message is produced by the message production unit and stored in the message server in the form of a message queue. The first type consumption unit and the second type consumption unit consume the message stored in the message server.

[0025] In the process of processing messages, uneven message sending may cause message accumulation in the message server or some partitions of the message server, resulting in that the messages cannot be consumed quickly. In view of this, the embodiments of the present disclosure provide the following solutions to solve the above technical problems.

[0026] Figure 1 1 shows an exemplary architecture of the message processing system 100 of the present disclosure. Figure 1 As shown, an exemplary architecture of the message processing system 100 may include a message production unit 101, a message server 102, a first type consumption unit 103, and a second type consumption unit 104. The message production unit 101 is used to produce messages, which may be multiple machines, multiple processes of a machine, or multiple production objects of a process. The first type consumption unit 103 and the second type consumption unit 104 are used to consume messages, which may be multiple machines, multiple processes of a machine, or multiple consumption objects of a process. Among them, the second type consumption unit 104 is a consumption unit that realizes consumption expansion in the event of message accumulation.

[0027] The message server 102 receives and stores messages produced by the message production unit 101, and receives and processes subscription requests from the first type consumer unit 103 and the second type consumer unit 104. For example, the first type consumer unit 103 and the second type consumer unit 104 can receive messages from the message server 102 storing the message queue or receive messages pushed by the message server 102 for consumption (processing). Figure 1 As shown, the message server 102 is configured with a main processor (Master) 1021 and an auxiliary processor (Slave) 1022, wherein the number of the main processor can be one, and the number of the auxiliary processors can be one or more than two. The message production unit 101, the first type consumption unit 103, and the second type consumption unit 104 interact with the message server 102 to realize the production, storage, and consumption of messages. In addition, a cache unit 1023 may also be provided in the message server 102, for example, it may be a database in a cache manner, such as a Redis database, etc. In the present application, for the convenience of description, the cache unit 1023 is represented as a part of the message server 102, and those skilled in the art should understand that it may also be a separate device that exists independently of the message server, such as a database, etc.

[0028] Figure 2 Schematic diagram of message processing disclosed in the present invention. Figure 2In the example, three partitions, three first-type consumer units and two second-type consumer units are shown. The message production unit produces messages and sends them to the message server in the form of message queues. The three partitions of the message server can store the message queues. In this application, Figure 2 The message queue shown in can be described as a first message set. The first message set can be a set of messages of the same topic (Topic) or a set of messages of different topics. For example, messages of the same topic can be stored in the first to third partitions, or messages of different topics can be stored in the first to third partitions respectively. In this application, the example of storing messages of the same topic in the first to third partitions is used for explanation. Figure 2 As shown, the first type consumer units 1-3 correspond to the same topic, that is, consume messages of the same topic. The first to third partitions correspond to their own main processors and auxiliary processors, that is, the three first type consumer units are connected to the corresponding main processors, and the main processors of the first type consumer units have corresponding auxiliary processors.

[0029] Each partition corresponds to a first type consumer unit, for example, the first partition corresponds to the first type consumer unit 1, the second partition corresponds to the first type consumer unit 2, and the third partition corresponds to the first type consumer unit 3. The first type consumer unit 1 is allocated to and receives messages from the first partition for consumption, the second type consumer unit 21 is allocated to receive messages from the second partition for consumption, and the first type consumer unit 31 is allocated to receive messages from the third partition for consumption.

[0030] The following is an example of the first type of consumer unit 1. The first type of consumer unit 1 can be assigned to the first partition and receive messages from the first partition for consumption. After the first type of consumer unit 1 is assigned to the first partition of the message server, the cache method can be modified according to the storage method of the message information to be processed by the first type of consumer unit 1. For example, the cache method can be Redis storage, which can achieve a faster access speed, so that the expanded consumer unit can obtain the corresponding message for consumption. In the present application, the message information may include the message queue pulledMessageQueue obtained from the message server, the message queue consumedQueue of successful consumption, the minimum offset minOffset and the maximum offset maxOffset of the partition message storage, and the auxiliary processor corresponding to the message processor of the first type of consumer unit 1 when the message is accumulated. In the present application, the message processor can be the main processor, and the auxiliary processor can be one or more processors set relative to the main processor. In the present application, the information of the consumer unit group of a topic is recorded under the same topic. The cache mentioned above can belong to the message server or to a separate database. In the present application, it is described as belonging to the message server.

[0031] In this example, for the convenience of description, the messages stored in the first partition corresponding to the first type consumer unit 1 are referred to as the first message set. It should be understood that if other first type consumer units are used as examples for description, the messages stored in the partitions corresponding to other first type consumer units are the first message set.

[0032] The first type of consumer unit 1 consumes messages in the first message set stored in the first partition. When messages are accumulated in the first partition, the auxiliary processor corresponding to the message processor of the first type of consumer unit 1 can establish a connection with the second type of consumer unit 4. After the auxiliary processor establishes a connection with the second type of consumer unit 4, the second message in the first message set corresponding to the first type of consumer unit 1 is consumed by the second type of consumer unit 4. In the present application, the first type of consumer unit is a consumer unit allocated to each partition, and the second type of consumer unit is a consumer unit used for dynamic expansion. Figure 2 As shown, when processing the accumulated messages of the first type consumer unit 1, the second type consumer unit 4 can be connected to the auxiliary processor, or the second type consumer unit 4 and the second type consumer unit 5 can be connected to the auxiliary processor corresponding to the above-mentioned message processor. Here, the number of auxiliary processors can be two, that is, the second type consumer unit 4 and the second type consumer unit 5 are respectively connected to an auxiliary processor.

[0033] When the first type consumer unit 1 consumes the message in the first message set, the first type consumer unit records the message information, wherein the message information may include the message queue pulledMessageQueue obtained from the message server, the message queue consumedQueue of successful consumption, the minimum offset minOffset and the maximum offset maxOffset of the partition message storage, etc. And the message information is stored in a cache manner. When it is determined according to the message information that the first type consumer unit 1 has message accumulation, the second type consumer unit assists the first type consumer unit 1 in message consumption. That is, the second type consumer unit and the first type consumer unit 1 consume the messages in the first message set at the same time. The second type consumer unit pulls the message from the message queue pulledMessageQueue obtained by the first type consumer unit 1 for processing. In this application, in order to distinguish, the message in the first message set processed by the second type consumer unit is referred to as the second message. In this way, when the first type consumer unit 1 has message accumulation, the accumulated messages can be consumed by the first type consumer unit 1 and the expanded second type consumer unit at the same time, thereby achieving the effect of dynamic and fast consumption of accumulated messages. In this application, the second message processed by the second type consumer unit can be a message from the cache form.

[0034] The second type consumer unit stores the successfully consumed message in the successfully consumed message queue consumedQueue, so as to return the consumption result to the message server. When there is no message accumulation in the first type consumer unit 1, the connection between the auxiliary processor and the second type consumer unit is cancelled.

[0035] In the present application, when there is message accumulation, the consumption unit can be dynamically expanded, that is, dynamic expansion is achieved through the second type of consumption unit. In addition, the first type of consumption unit and the second type of consumption unit are divided only according to the state they are in. The first type of consumption unit is a consumption unit that has been allocated to the corresponding partition, and the second type of consumption unit is a consumption unit that has not been allocated to the corresponding partition, that is, a consumption unit that can be expanded.

[0036] The message accumulation state of the first type consumer unit can be determined based on the message information stored in the form of memory, that is, which first type consumer unit or units have message accumulation. When message accumulation occurs, the second type consumer unit that performs the expansion function can be registered to the auxiliary processor corresponding to the message processor of the first type consumer unit with message accumulation. And pull the message from the pulledMessageQueue of the message queue of the first type consumer unit for consumption. In addition, the message processing result of the second type consumer unit is returned to the message server, for example, it is also stored in a cache manner.

[0037] During the message processing, a monitoring thread can be started. For example, when the first type consumer unit 1 is not in a message accumulation state, it is determined whether other first type consumer units still have message accumulation. If so, the second type consumer unit is used to consume the message of the first type consumer unit with message accumulation. Finally, if all the first type consumer units have no message accumulation, the capacity is reduced, that is, the second type consumer unit is disconnected from the auxiliary processors of all the first type consumer units.

[0038] Similarly, the method for expanding the message consumption of the first message set stored in the second partition and the third partition may be the same as the method for expanding the message consumption of the first message set stored in the first partition.

[0039] Figure 3 It is a timing diagram of the interaction between various units (such as the message production unit 101, the first type consumption unit 103, the message server 102 and the second type consumption unit 104) in one implementation of the message processing system according to the present disclosure.

[0040] In step S301, the message producing unit produces a message.

[0041] In step S302, the message is sent from the message production unit to the message server in the form of a message queue. The message server receives the message queue.

[0042] In step S303, the message server stores the message queue. For example, partition storage can be performed, and messages from the message production unit can be partitioned and stored according to the topic. That is, messages of the same topic can be stored in different partitions. For example, a type of business message will be classified into one topic to achieve isolation between businesses. For example, Figure 2 As shown, the message server can be divided into three partitions (a first partition, a second partition, and a third partition), and the messages of the three partitions belong to the same type of business, so the messages of the three partitions are classified into the same topic to store the messages. Messages of different topics can be stored in different partitions, and messages of the same topic can be stored in the same partition. In addition, in the present application, messages of the same topic can also be stored in different partitions. The messages produced by the message production unit are classified, stored, and managed according to the topic. The message production unit sends the message to the partition of a specific topic, and the message consumption unit (the first type consumption unit and / or the second type consumption unit in the present disclosure) consumes the message according to the topic subscription message. In the present disclosure, the first message set can be a set formed by messages stored in a partition. The first message set formed by messages in a partition will be described below.

[0043] In step S304, the message server converts the storage mode of the message information of the messages in the first message set into a cache mode. After the first type of consumer unit is allocated to the partition of the corresponding message server, the storage of the message information of the messages in the first message set is modified to Redis database storage.

[0044] In step S305, the first type consumer unit receives a message from the message server. In the process of receiving the message from the message server, the first type consumer unit may receive the message in a FIFO manner and process it. For example, the first type consumer unit may connect to a message processor to receive and consume the message.

[0045] In step S306, the first type of consumer unit consumes the received message and records the message information, which may include: the message queue pulledMessageQueue obtained from the message server, the message queue consumedQueue of successful consumption, the minimum offset minOffset and maximum offset maxOffset of message storage, and the auxiliary processor of the message processor when the message is accumulated. The initial position of the second type of consumer unit consuming the second message during subsequent expansion is determined based on the minimum offset. The second type of consumer unit is determined to have completed the consumption of the second message based on the maximum offset.

[0046] When the first type consumer unit consumes the messages in the first message set, the first type consumer unit records the message queue of successful consumption.

[0047] In step S307, the accumulation of messages in the first message set is monitored. If messages in the first message set are accumulated, in step S308, the second type consumer unit establishes a connection with the auxiliary processor corresponding to the message processor of the first type consumer unit.

[0048] In step S309, the second type consumer unit receives the second message of the first message set. In step S310, the second type consumer unit may consume the second message of the first message set. In the present application, the second message is a part of the accumulated messages. In the present application, in the case of message accumulation, the second type consumer unit participates in the consumption of the messages in the first message set, and the first type consumer unit also consumes the messages in the first message set.

[0049] After determining in step S311 that there is no accumulation of messages in the first message set, the second type consumer unit may be scaled down in step S312, ie, the second type consumer unit may be disconnected from the auxiliary processor to reduce memory usage of the message processing system.

[0050] It should be noted that, in the message processing system provided by the embodiment of the present disclosure, when there is a backlog of messages in the first message set to be processed by the first type of consumer unit (the consumption described in the present disclosure), when the second message in the first message set to be processed is processed by the second type of consumer unit, the first type of consumer unit does not stop processing the messages in the first message set, that is, the first type of consumer unit and the second type of consumer unit can process the messages in the first message set at the same time. The above method can improve the processing efficiency of the messages in the first message set.

[0051] Furthermore, the present disclosure provides a message processing system, including a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the message processor of the message server establishes a connection with a first type of consumer unit. Messages in a first message set of the message server are consumed by the first type of consumer unit. In the case where messages are accumulated in the first message set, an auxiliary processor corresponding to the message processor establishes a connection with a second type of consumer unit. The second message in the first message set is consumed by the second type of consumer unit, and the second message is part of the accumulated messages in the first message set.

[0052] In the embodiment of the present disclosure, when there is message accumulation in the first message set to be processed by the first type of consumer unit, a second type of consumer unit is used to consume the second message in the first message set. At this time, there is no need to suspend the message processing of the first type of consumer unit or do temporary development work, and the accumulated messages can be processed, thereby improving the processing capability and effect of the accumulated messages and promptly solving the problem of message accumulation caused by uneven distribution of topic partitions.

[0053] In an optional implementation of the present disclosure, the number of first-type consumer units is N, where N≥1, and the N first-type consumer units are respectively connected to a message server, and each first-type consumer unit consumes the first message of the corresponding message server partition. The message server described here can be a message server for each partition, for example, it can be understood that the first-type consumer units are respectively connected to a partition.

[0054] For example, Figure 2 As shown, the number of first type consumer units can be 3, namely first type consumer unit 1, first type consumer unit 2 and first type consumer unit 3. First type consumer unit 1 consumes messages in the first message set of the first partition of the message server, first type consumer unit 2 consumes messages in the first message set of the second partition of the message server, and first type consumer unit 3 consumes messages in the first message set of the third partition of the message server.

[0055] In an optional embodiment of the present disclosure, the number of second type consumer units is M, where M≥1, and one of the M second type consumer units can be connected to an auxiliary processor corresponding to one of the N first type consumer units.

[0056] like Figure 2 As shown, the number of the second type consumer units can be two, namely the second type consumer unit 4 and the second type consumer unit 5. The second type consumer unit 4 and / or the second type consumer unit 5 can be connected to the auxiliary processor corresponding to the first type consumer unit 1, the first type consumer unit 2 or the first type consumer unit 3.

[0057] In an optional implementation of the present disclosure, after the first type of consumer unit is allocated to the corresponding message server partition, the storage of the message information in the first message set is modified to a cache mode such as Redi storage.

[0058] The storage method of the message information in the first message set is changed to a cache method. When message accumulation occurs, the auxiliary processor corresponding to the message processor connected to the first type of consumer unit can be connected to the second type of consumer unit, and then the second message (part of the accumulated messages in the first message set) can be consumed by the second type of consumer unit, thereby improving the message processing efficiency.

[0059] For example, see Figure 2 When messages are accumulated in the first type consumer unit 1, the auxiliary processor corresponding to the message processor connected to the first type consumer unit 1 can be connected to the second type consumer unit 4, and then the second message is consumed by the second type consumer unit 4, thereby improving the processing efficiency of the accumulated messages.

[0060] Monitor whether there is still message accumulation in the first type consumer unit corresponding to the second message consumed by the second type consumer unit. If there is no message accumulation, connect the second type consumer unit to the auxiliary processor of another first type consumer unit with message accumulation and perform message consumption.

[0061] The present disclosure does not need to stop the first type consumer unit from consuming the messages in the first message set. The dynamically set second type consumer unit can realize dynamic processing of accumulated second messages when messages in the first message set are accumulated, thereby improving message processing efficiency.

[0062] The steps executed by the message processing system also include: the message production unit generates messages and stores the messages in N partitions, and each partition is allocated a first type consumer unit.

[0063] In an optional implementation of the present disclosure, when a first type consumer unit is assigned to a partition of messages in a first message set corresponding to a topic, the first type consumer unit records an auxiliary processor of a message server to which a connection is established.

[0064] When the first type of consumer unit has accumulated messages, a connection with the first type of consumer unit can be established through the auxiliary processor of the corresponding recorded message server. In this way, when the first type of consumer unit has accumulated messages, the second type of consumer unit can be quickly connected to the auxiliary processor of the message server connected to the first type of consumer unit, and then the second type of consumer unit consumes the second message, thereby improving the processing efficiency of the messages in the first message set.

[0065] In an optional embodiment of the present disclosure, the message processing system of the present disclosure further performs the following steps: when the first type consumer unit consumes a message in the first message set, the first type consumer unit records the maximum offset and the minimum offset of the message in the first message set stored by the message server. Based on the minimum offset of the message in the first message set stored by the message server, the initial position of the second type consumer unit consuming the second message is determined. Based on the maximum offset of the message in the first message set stored by the message server, the second type consumer unit completes the consumption of the second message.

[0066] In an optional embodiment of the present disclosure, the message processing system of the present disclosure further performs the following steps: when the first type consumer unit consumes a message in the first message set, the first type consumer unit records the message set of successful consumption received from the message server. The second type consumer unit stores the consumption result of successfully consuming the second message in the message set of successful consumption. Based on the message set of successful consumption, the consumption result of the second type consumer unit successfully consuming the second message is returned to the message server.

[0067] The maximum offset (maxOffset) refers to the offset of the latest message in a message queue that has been stored in a partition of a message queue. The maximum offset reflects the current position of the latest message in the message queue. As new messages are continuously written to the message queue, the maximum offset will continue to increase. The minimum offset (minOffset) refers to the offset of the earliest undeleted message in a partition of a message queue.

[0068] In an optional implementation of the present disclosure, the steps performed by the message processing system provided by the present disclosure further include: comparing the messages accumulated in the first message set with a message threshold. When the messages accumulated in the first message set are greater than the message threshold, it is confirmed that the first message set has message accumulation.

[0069] When the number of accumulated messages in the first message set exceeds the message threshold, it indicates that message accumulation has occurred and the accumulated messages need to be processed in a timely manner. At this time, a connection is established between the auxiliary processor corresponding to the message processor connected to the first type of consumer unit and the second type of consumer unit according to the amount of accumulated messages, and the second message is consumed by the second type of consumer unit.

[0070] Exemplarily, when the total amount of messages in the first message set exceeds H times the total amount of messages that can be consumed by the first type consumer unit, H second type consumer units can be expanded. The total amount of messages that can be consumed by the first type consumer unit can be determined based on the messages in the first message set that have been successfully consumed by the first type consumer unit.

[0071] In an optional embodiment of the present disclosure, it is monitored whether there is a message accumulation in the first type consumer unit corresponding to the second message consumed by the second type consumer unit corresponding to the subject; when there is no message accumulation, the second type consumer unit is connected to the auxiliary processor of the first type consumer unit corresponding to another subject where there is a message accumulation and the message consumption is performed.

[0072] That is, after the messages in the first message set corresponding to this topic are processed, the accumulation of messages in the first message sets corresponding to other topics can be obtained. When the messages in the first message sets corresponding to other topics are accumulated, the second type of consumption unit is used to consume the second messages in the first message sets corresponding to other topics.

[0073] In another aspect of the present disclosure, see Figure 4 , and also provides a message processing method, wherein the message processing method can be Figure 3 and executed in the message processing system described above. Figure 4 The flowchart of the message processing method M400 is shown. In step S401, a message processor of a message server establishes a connection with a first type consumer unit.

[0074] In step S402, messages in a first message set of a message server are consumed by a first type of consumption unit.

[0075] In step S403, when message accumulation occurs in the first message set, the auxiliary processor corresponding to the message processor establishes a connection with the second type consumer unit.

[0076] In step S404, the second message in the first message set is consumed by the second type consumption unit, and the second message is a part of the accumulated messages in the first message set.

[0077] In an optional implementation of the present disclosure, the number of first type consumer units is N, where N≥1, and the N first type consumer units are respectively connected to a message server, and each first type consumer unit respectively consumes the first message of the corresponding partition.

[0078] In an optional embodiment of the present disclosure, the number of second type consumer units is M, where M≥1, and one of the M second type consumer units can be connected to an auxiliary processor corresponding to one of the N first type consumer units.

[0079] In an optional implementation of the present disclosure, after the first type of consumer unit is allocated to the corresponding message server, the storage of messages in the first message set is modified to Redis database storage.

[0080] In an optional embodiment of the present disclosure, it is monitored whether there is message accumulation in a first type consumer unit corresponding to a second message consumed by a second type consumer unit. If there is no message accumulation, the second type consumer unit is connected to an auxiliary processor of another first type consumer unit with message accumulation and message consumption is performed.

[0081] In an optional implementation of the present disclosure, it further includes: a message production unit generates messages and stores the messages in N partitions, and each partition is allocated a first type consumption unit.

[0082] In an optional implementation of the present disclosure, it also includes: when the first type consumer unit consumes a message in the first message set, the first type consumer unit records the maximum offset and the minimum offset of the message in the first message set stored by the message server. Based on the minimum offset of the message in the first message set stored by the message server, the initial position of the second type consumer unit consuming the second message is determined. Based on the maximum offset of the message in the first message set stored by the message server, it is determined that the second type consumer unit completes the consumption of the second message.

[0083] In an optional implementation of the present disclosure, it also includes: when a first type consumer unit consumes a message in a first message set, the first type consumer unit records the message set successfully consumed received from the message server; the second type consumer unit stores the consumption result of successfully consuming the second message in the successful consumption set of messages; and based on the successfully consumed message set, returns the consumption result of successfully consuming the second message by the second type consumer unit to the message server.

[0084] It should be noted that the description of the message processing method provided in the embodiment of the present disclosure can refer to the description of the message processing system of the present disclosure, and the present disclosure will not repeat it again.

[0085] In another aspect of the present disclosure, a readable storage medium is also provided, in which a computer program is stored, and when the computer program is executed by a processor, it is used to implement the message processing method of the present disclosure. "Readable storage medium" can be any device that can contain, store, communicate, propagate or transmit a program 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.

[0086] The present disclosure also provides a computer program product, and the message processing 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 message processing methods described above is implemented.

[0087] 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.

[0088] It will be appreciated by those skilled in the art that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may be provided in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present disclosure may be provided in 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.

[0089] The present disclosure is described with reference to the flowcharts and / or block diagrams of the message processing methods, devices (systems), and computer program products according to the present disclosure. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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 process in the flowchart. 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.

[0090] 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.

[0091] 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.

[0092] 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 the different embodiments / methods or examples described in this specification and the features of the different embodiments / methods or examples, unless they are contradictory.

[0093] 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.

[0094] 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 one or more processors and one or more memories, wherein the memories store a computer program. When the computer program is executed by the processor, the message processing system performs the following process: The message processor of the message server establishes a connection with the first type of consumer unit; The messages in the first message set of the message server are consumed by a first type of consumption unit; In the case where messages in the first message set are accumulated, the auxiliary processor corresponding to the message processor establishes a connection with a second type of consumer unit; as well as The second message in the first message set is consumed by the second type consumer unit, wherein the second message is a part of the accumulated messages in the first message set.

2. The message processing system according to claim 1, characterized in that: The number of the first type consumer units is N, where N≥1, the N first type consumer units are respectively connected to one of the N partitions, and the N partitions are used to partition and store messages of the same topic.

3. The message processing system according to claim 2, characterized in that: The number of the second type consumer units is M, where M≥1, and at least one of the M second type consumer units can be connected to an auxiliary processor corresponding to one of the N first type consumer units.

4. The message processing system according to claim 2, characterized in that: After the first type of consumer unit is allocated to the corresponding partition, the storage mode of the message information of the first message set is modified to cache storage.

5. The message processing system according to claim 2, characterized in that: Monitor whether there is message accumulation in the first type consumer unit corresponding to the second message consumed by the second type consumer unit. If there is no message accumulation, connect the second type consumer unit to the auxiliary processor of another first type consumer unit with message accumulation and perform message consumption.

6. The message processing system according to claim 2, characterized in that: Also includes: When the first type consumer unit consumes messages in the first message set, the first type consumer unit records the maximum offset and the minimum offset of the messages in the first message set stored in the message server; Determine the initial position of the second type consumer unit consuming the second message based on the minimum offset of the message of the first message set stored in the message server; as well as The second type consumer unit completes consumption of the second message based on a maximum offset of messages in the first message set stored in the message server.

7. The message processing system according to claim 6, characterized in that: Also includes: When the first type consumer unit consumes messages in the first message set, the first type consumer unit records the message set successfully consumed and received from the message server; The second type of consumption unit stores the result of successful consumption of the second message in the successfully consumed message set; as well as Based on the successfully consumed message set, a consumption result indicating that the second type consumer unit has successfully consumed the second message is returned to the message server.

8. A message processing method, characterized in that: include: The message processor of the message server establishes a connection with the first type of consumer unit; The messages in the first message set of the message server are consumed by a first type of consumption unit; In the case where messages in the first message set are accumulated, the auxiliary processor corresponding to the message processor establishes a connection with a second type of consumer unit; as well as The second message in the first message set is consumed by the second type consumer unit, wherein the second message is a part of the accumulated messages in the first message set.

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.