Message processing method and device, electronic equipment and storage medium

By receiving and processing messages in a distributed system, generating and updating message processing events in the record table, and processing messages with thread pools, the problem of message queue middleware processing delay is solved, and efficient message processing and traffic control is achieved.

CN119226010APending Publication Date: 2024-12-31CHINA CONSTRUCTION BANK +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411418187.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

In a distributed system, when message processing is performed through message queue middleware, the client needs to be installed and maintained, resulting in delayed message processing.

Method used

By receiving pending messages, generating production records and storing them to the production record table, obtaining a preset message subscription collection in response to the message processing task trigger, generating message processing events, and matching threads from the thread pool to invoke database connections from the production record table Get the target message for processing, and finally generate a consumption record and update it to the message consumption record table.

Benefits of technology

The response speed and traffic control of message processing are realized, and delayed processing is avoided due to client installation and maintenance. The function of message queue is realized through the combination of data tables and thread pools.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119226010A_ABST
    Figure CN119226010A_ABST
Patent Text Reader

Abstract

The invention discloses a message processing method and device, electronic equipment and a storage medium, and relates to the technical field of computers. A specific embodiment of the method comprises the steps of receiving a to-be-processed message, generating a production record of the to-be-processed message, and storing the production record to a corresponding production record table; in response to the triggering of the message processing task, obtaining a preset message subscription set to extract the information of the to-be-processed message corresponding to each subscription record, and generating and triggering a corresponding message processing event; a corresponding thread is matched from the thread pool, the target message is acquired from the production record table through preset database connection, and a service processing program associated with the target message is inquired to execute processing of the target message; and generating a consumption record of the target message according to the processing result. According to the embodiment, the problem that when message processing is carried out through message queue middleware, a client needs to be installed and maintained in a corresponding system to carry out message subscription from a message queue, and consequently message processing is delayed can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a message processing method, device, electronic device and storage medium. Background Art

[0002] In scenarios such as distributed systems, message queues are an important type of middleware that can achieve timely control of message traffic and can be used to deliver messages between different components or systems. In related technologies, when using message queues, it is necessary to install and maintain clients in the corresponding systems to subscribe to messages from message queues through the clients, but this message processing method will cause delays in message processing. Summary of the invention

[0003] In view of this, an embodiment of the present invention provides a message processing method, device, electronic device and storage medium, which can solve the problem that when message processing is performed through a message queue middleware, it is necessary to install and maintain a client in the corresponding system to subscribe to messages from the message queue, resulting in delays in message processing.

[0004] To achieve the above objective, according to one aspect of an embodiment of the present invention, a message processing method is provided.

[0005] A message processing method of an embodiment of the present invention includes: receiving a message to be processed, obtaining production information of the message to be processed to generate a production record of the message to be processed, and storing it in a corresponding production record table; in response to a message processing task being triggered, obtaining a preset message subscription set to extract information of the message to be processed corresponding to each subscription record, generating a corresponding message processing event and triggering it; in response to the message processing event, matching a corresponding thread from a thread pool, calling the thread to obtain a target message from the production record table through a preset database connection, querying a business processing program associated with the target message to execute processing on the target message to obtain a processing result; generating a consumption record of the target message according to the processing result, and updating it to a message consumption record table.

[0006] In one embodiment, the method of obtaining a preset message subscription set to extract information of messages to be processed corresponding to each subscription record and generate a corresponding message processing event includes: obtaining a consumer identifier of the message processing task and extracting a corresponding message subscription set from a message subscription record table; for each subscription record in the message subscription set, extracting a subscription topic and a message identifier of the subscription record, calling a preset generation model to generate a thread identifier, and generating a message processing event according to the thread identifier and the subscription topic.

[0007] In another embodiment, the production information of the message to be processed is obtained to generate a production record of the message to be processed and store it in a corresponding production record table, including: obtaining the message description information of the message to be processed, identifying the corresponding message source, generation time and message subject, obtaining the label of the message source, generating a message identifier in combination with the message subject, generating a production record of the message to be processed according to the message subject and the message identifier; and inserting the production record of the message to be processed into the corresponding production record table according to the generation time.

[0008] In another embodiment, calling the thread to obtain the target message from the production record table through a preset database connection includes: calling the thread, obtaining the subscription topic and the message identifier according to the message processing event, reading the production record table through a preset database connection, and obtaining the target message according to the subscription topic and the message identifier.

[0009] In another embodiment, matching the corresponding thread from the thread pool includes: parsing the message processing event, obtaining the thread identifier, and matching the thread corresponding to the thread identifier from a preset thread pool; in response to a matching failure, obtaining current device operating parameters to determine the load status; if the load status meets preset conditions, creating a new thread; if the load status does not meet the preset conditions, obtaining the current thread set in the thread pool, and filtering the target thread from the current thread set according to the thread identifier.

[0010] In another embodiment, after executing the processing of the target message and obtaining the processing result, it also includes: in response to the processing result being successful, querying the production record table according to the message information, determining the to-be-processed message corresponding to the subscription record, and obtaining the corresponding message information to update the subscription record.

[0011] To achieve the above objective, according to another aspect of an embodiment of the present invention, a device for message processing is provided.

[0012] A message processing device according to an embodiment of the present invention includes: a receiving unit, which is used to receive a message to be processed, obtain production information of the message to be processed, so as to generate a production record of the message to be processed, and store it in a corresponding production record table; a generating unit, which is used to obtain a preset message subscription set in response to a message processing task being triggered, so as to extract information of the message to be processed corresponding to each subscription record, generate a corresponding message processing event and trigger it; a processing unit, which is used to match a corresponding thread from a thread pool in response to the message processing event, call the thread to obtain a target message from the production record table through a preset database connection, query a business processing program associated with the target message, so as to execute processing on the target message and obtain a processing result; and an updating unit, which is used to generate a consumption record of the target message according to the processing result, and update it to a message consumption record table.

[0013] In one embodiment, the generation unit is specifically used to: obtain the consumer identifier of the message processing task, and extract the corresponding message subscription set from the message subscription record table; for each subscription record in the message subscription set, extract the subscription subject and message identifier of the subscription record, call the preset generation model to generate a thread identifier, and generate a message processing event according to the thread identifier and the subscription subject.

[0014] In another embodiment, the receiving unit is specifically used to: obtain the message description information of the message to be processed, identify the corresponding message source, generation time and message subject, obtain the label of the message source, generate a message identifier in combination with the message subject, and generate a production record of the message to be processed according to the message subject and the message identifier; and insert the production record of the message to be processed into the corresponding production record table according to the generation time.

[0015] In another embodiment, the processing unit is specifically used to: call the thread, obtain the subscription topic and the message identifier according to the message processing event, read the production record table through a preset database connection, and obtain the target message according to the subscription topic and the message identifier.

[0016] In another embodiment, the processing unit is specifically used to: parse the message processing event, obtain the thread identifier, and match the thread corresponding to the thread identifier from a preset thread pool; in response to a matching failure, obtain the current device operating parameters to determine the load status; if the load status meets the preset conditions, create a new thread; if the load status does not meet the preset conditions, obtain the current thread set in the thread pool, and filter the target thread from the current thread set according to the thread identifier.

[0017] In another embodiment, the update unit is further used to: in response to the processing result being successful, query the production record table according to the message information, determine the pending message corresponding to the subscription record, obtain the corresponding message information, and update the subscription record.

[0018] To achieve the above objective, according to another aspect of an embodiment of the present invention, an electronic device is provided.

[0019] An electronic device according to an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the message processing method provided by the embodiment of the present invention.

[0020] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer readable medium is provided.

[0021] A computer-readable medium according to an embodiment of the present invention stores a computer program, and when the program is executed by a processor, the message processing method provided by the embodiment of the present invention is implemented.

[0022] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer program product is provided.

[0023] A computer program product according to an embodiment of the present invention includes a computer program, and when the program is executed by a processor, the message processing method provided by the embodiment of the present invention is implemented.

[0024] An embodiment of the above invention has the following advantages or beneficial effects: In the embodiment of the present invention, for the message to be processed, a corresponding production record can be generated and stored in the production record table to realize the storage of the message to be processed; after the message processing task is triggered, the information of the subscription record corresponding to the message to be processed can be determined according to the pre-stored subscription information, that is, the information of the message to be processed this time, and then the corresponding message processing event is generated and triggered; after the message processing event is triggered, the thread of the user processing the event can be matched from the thread pool, that is, the target message is obtained from the production record table through the preset database connection, and the corresponding business processing program is executed on it to obtain the processing result, and the consumption record of the target message is generated according to the processing result, and updated to the message consumption record table. In the embodiment of the present invention, the message to be processed is stored in the production record table, and when the message processing task is triggered, the corresponding message processing event is generated according to the subscription information, so that the corresponding thread in the thread pool obtains the message to be processed from the production record table for processing, and the processing result is stored in the message consumption record table, so that the function of the message queue is realized through each data table in the embodiment of the present invention, and the thread pool is combined to process the message to be processed, ensuring the response speed and flow control of the message processing, without the need to install and maintain the client, avoiding the delayed processing of the message.

[0025] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention. Figure 1 is a schematic diagram of a main process of a message processing method according to an embodiment of the present invention; Figure 2 is a schematic diagram of another main process of the message processing method according to an embodiment of the present invention; Figure 3 is a schematic diagram of another main process of the message processing method according to an embodiment of the present invention; Figure 4 is a schematic diagram of main units of a message processing apparatus according to an embodiment of the present invention; Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied; Figure 6 It is a schematic diagram of the structure of a computer system suitable for implementing the embodiment of the present invention. DETAILED DESCRIPTION

[0027] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0028] It should be pointed out that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict. The acquisition, transmission, storage, use, and processing of data in the technical solution of this application are in compliance with the relevant provisions of national laws and regulations. In the embodiments of this application, some existing solutions in the industry such as certain software, components, and models may be mentioned, which should be considered as exemplary. Their purpose is only to illustrate the feasibility of the implementation of the technical solution of this application, but it does not mean that the applicant has or will necessarily use the solution.

[0029] An embodiment of the present invention provides a message processing system, which can be used in a scenario of processing messages, and specifically can be used in a scenario of processing messages in a database.

[0030] The embodiment of the present invention provides a message processing method, which can be executed by a message processing system. Figure 1 As shown, the method includes the following steps.

[0031] S101: receiving a message to be processed, obtaining production information of the message to be processed, generating a production record of the message to be processed, and storing the record in a corresponding production record table.

[0032] Among them, the pending message can be sent by an external system or generated by a message processing system. The pending message can carry message description information and can include various attribute parameters of the message. The production record table is pre-set and can be used to record and store pending messages. The production information of the pending message can be set based on demand, for example, it can be a message identifier, a message subject corresponding to the message, a message type, a message source, a generation time, etc. As shown in Table 1, it is an explanation of the fields included in the production record table, and then a production record of the pending message can be generated based on the production information to be stored in the production record table.

[0033] Specifically, the step of generating and storing production records in this step can be specifically executed as follows: obtaining the message description information of the message to be processed, identifying the corresponding message source, generation time and message subject, obtaining the label of the message source, generating a message identifier in combination with the message subject, and generating a production record of the message to be processed according to the message subject and the message identifier; according to the generation time, inserting the production record of the message to be processed into the corresponding production record table.

[0034] The message description information of the message to be processed can be text information or field information. In the embodiment of the present invention, a recognition model such as a machine learning model can be preset for recognition. The source of the message can be specifically a local system, an external system, an external system identifier, etc. A corresponding label can be set for each source to combine the label of the message source and the message subject to generate a message identifier, and the message identifier can uniquely identify the message to be processed. In the embodiment of the present invention, the production record may include a message subject and a message identifier for subsequent message processing, so the production information is generated based on the message subject and the message identifier and stored in the production record table. Table 2 shows a production record table.

[0035] It should be noted that the production record table can be a database table for storing messages to be processed. The production record of each message can also include the message status (for example, pending, processing, processed, etc.), message priority, etc. to meet the needs of message processing.

[0036] S102: In response to the message processing task being triggered, a preset message subscription set is obtained to extract information of the to-be-processed message corresponding to each subscription record, and a corresponding message processing event is generated and triggered.

[0037] Among them, the message processing task is pre-set, and the message processing task represents the processing of the message to be processed, which can be implemented by a thread with a timer task function. The message subscription set can include a message subscription record, which can record the information of the message subscription to generate a message processing event. The message processing event represents the time when the message needs to be processed, which can include the information of the message to be processed, and represents the event of processing the message.

[0038] Specifically, the generation of a message processing event in this step can be executed as follows: obtaining the consumer identifier of the message processing task, extracting the corresponding message subscription set from the message subscription record table; for each subscription record in the message subscription set, extracting the subscription topic and message identifier of the subscription record, calling the preset generation model to generate a thread identifier, and generating a message processing event based on the thread identifier and the subscription topic.

[0039] The message processing task may include a consumer identifier, indicating which consumer's subscribed message is processed. The message subscription record table is pre-established, in which the subscription details of each message consumer, such as the subscription topic, can be recorded. In order to facilitate the determination of the message to be processed, the message subscription record table may also include the identifier of the message that has been processed and the identifier of the next message to be processed, as shown in Table 3, which is a schematic diagram of the fields included in the message subscription record table. The message subscription set may include one or more subscription records. As shown in Table 4, the message subscription record table records two subscription records of the paying consumer No. 1, so the message subscription set may include two subscription records. For each subscription record, the subscription topic and message identifier of the subscription record can be extracted, and then a thread identifier can be generated. The generation model can be pre-set. In order to process the messages of the same message consumer in the same thread, the thread identifier can be generated according to the subscription topic and the consumer identifier, and the generation algorithm can be set according to the requirements. After the thread identifier is generated, a message processing event can be generated according to the thread identifier and the subscription topic. Specifically, in this step, a generation template for the message processing event can be preset, and then the corresponding message processing event can be generated according to the preset template.

[0040] It should be noted that, in the embodiment of the present invention, a thread pool, such as a Java thread pool, may be pre-established, wherein multiple parallel threads may be established as required to process the messages to be processed.

[0041] S103: In response to the message processing event, the corresponding thread is matched from the thread pool, the calling thread obtains the target message from the production record table through the preset database connection, and the business processing program associated with the target message is queried to execute the processing on the target message to obtain the processing result.

[0042] Among them, after the message processing event is triggered, the thread for processing the pending message can be matched from the thread pool, that is, the thread for processing the pending message, so the thread can be called to execute the processing of the pending message. The database connection is pre-established and used to connect to the production record table to obtain the target message from it. Since the message processing event can include the subscription topic and message identifier, the target message can be obtained from the production record table based on this. After obtaining the target message, the business processing program for processing it can be determined according to its specific information, and then the target message is processed according to the business processing program through the thread to obtain the processing result.

[0043] Specifically, obtaining the target message in this step can be performed as follows: calling a thread, obtaining a subscription topic and a message identifier according to a message processing event, reading a production record table through a preset database connection, and obtaining the target message according to the subscription topic and the message identifier.

[0044] It should be noted that the parameters included in the message processing event may not be limited. Usually, the target message can be determined from the production record table based on the message identifier. At this time, the target message can be verified using the subscription topic to verify the accuracy of the target message.

[0045] In another embodiment, the method of determining a thread in the embodiment of the present invention can be performed as follows: parsing a message processing event, obtaining a thread identifier, matching a thread corresponding to the thread identifier from a preset thread pool; in response to a successful match, determining the successfully matched thread as a target thread; in response to a failed match, obtaining current device operating parameters to determine a load state; if the load state meets a preset condition, creating a new thread; if the load state does not meet the preset condition, obtaining a current thread set in the thread pool, and filtering a target thread from the current thread set according to the thread identifier. The target message can then be processed according to the determined target thread.

[0046] If the match is successful, it means that there is currently a thread corresponding to the thread identifier in the thread pool, so it can be called directly; if the match is unsuccessful, it means that there is currently no thread corresponding to the thread identifier in the thread pool. At this time, a new thread corresponding to the thread identifier can be created or a thread can be determined from the existing threads as the target thread. The current device operation parameters can be set according to the needs, usually including parameters indicating the load status of the device operation, such as CPU usage parameters, memory usage parameters, the number of currently running threads, etc., to determine the current load status of the device. The load status can include normal and overload. The load status is normal, indicating that a new thread can be created for message processing; the load status is overloaded, indicating that a new thread can be created for message processing, which will bring a burden to the device, so one of the currently running threads can be selected as the target thread, that is, the current thread set in the thread pool is obtained, and the target thread can be selected from the current thread set according to the thread identifier. The method of selecting the target thread can be unlimited, such as random selection, or selection based on thread identifier calculation or selection based on attribute information such as the business type and subscription topic of the message.

[0047] It should be noted that the processing method of the target message in the embodiment of the present invention can be set according to the needs, for example, the integrity of the message can be verified, the processing status of the message can be updated, the message can be processed, and so on. Verifying the integrity of the message may include verification of the uniqueness of the message identifier, the integrity of the message content, etc. If the target message is incomplete or invalid after verification, the message may be rejected and marked as a "message error". The message status update of the target message can be updated according to the processing progress of the message, such as including pending status, processing status, processing completed status, etc. This step can be completed in a database transaction to ensure that the status update of the message is atomic in a concurrent environment. In the processing of the target message, corresponding operations can be performed according to the content of the message, such as calling other services, updating the database, etc.

[0048] S104: Generate a consumption record of the target message according to the processing result, and update it to the message consumption record table.

[0049] Among them, the consumption record can be used to record the consumption details of the message to be processed. Through it, the details of all consumer message consumption records can be obtained, and the consumers who have consumed the specified message can also be queried. The message consumption record table is used to store each consumption record. The parameters included in the consumption record can be set according to the requirements. Table 5 shows an example of the parameters included in a consumption record.

[0050] In the embodiment of the present invention, after the target message is consumed, if the processing result is successful, the message subscription table can be updated, that is, the current message identifier is updated to the identifier of the target message, and the next message identifier is updated to the identifier of the next message to be processed. Specifically, after the message is successfully processed, the production record table can be queried according to the message information to determine the pending message corresponding to the subscription record, and the corresponding message information can be obtained, such as the message identifier of the next pending message to be processed, so as to update the subscription record.

[0051] With the production record table as Table 2 and the message subscription record table as Table 4, after successfully processing the message with the next message identifier 1 in the public payment topic of payment consumer No. 1, the current message representation can be updated to 1. The next message identifier of the public payment topic in the production record table is 3, so the next message identifier in the message subscription record table is updated to 3. The updated message subscription record table is shown in Table 6.

[0052] In an embodiment of the present invention, pending messages are stored in a production record table. When a message processing task is triggered, a corresponding message processing event is generated according to subscription information, so that the corresponding thread in the thread pool obtains the pending message from the production record table for processing, and stores the processing result in the message consumption record table. In this way, in an embodiment of the present invention, the function of the message queue is realized through each data table, and the thread pool is combined to process the pending messages, thereby ensuring the response speed of message processing and flow control, without the need to install and maintain the client, thereby avoiding delayed processing of messages.

[0053] Combine the following Figure 1 The embodiment shown in the figure specifically describes the message processing method in the embodiment of the present invention. Figure 2 As shown, the method includes the following steps.

[0054] S201: Receive a message to be processed, obtain message description information of the message to be processed, identify the corresponding message source, generation time and message subject, obtain a tag of the message source, generate a message identifier based on the message subject, and generate a production record of the message to be processed according to the message subject and the message identifier.

[0055] S202: inserting the production record of the message to be processed into a corresponding production record table according to the generation time.

[0056] S203: In response to the message processing task being triggered, a preset message subscription set is obtained to extract information of the to-be-processed message corresponding to each subscription record, and a corresponding message processing event is generated and triggered.

[0057] S204: In response to the message processing event, matching a corresponding thread from the thread pool.

[0058] S205: calling a thread, obtaining a subscription topic and a message identifier according to a message processing event, reading a production record table through a preset database connection, and obtaining a target message according to the subscription topic and the message identifier.

[0059] S206: query the business processing program associated with the target message to execute processing on the target message and obtain a processing result.

[0060] S207: Generate a consumption record of the target message according to the processing result, and update it to the message consumption record table.

[0061] It should be noted that the data processing principle in the embodiment of the present invention is the same as Figure 1 The corresponding data processing principles in the illustrated embodiments are the same and will not be described in detail here.

[0062] Combine the following Figure 1 The embodiment shown in the figure specifically describes the message processing method in the embodiment of the present invention. Figure 3As shown, the method includes the following steps.

[0063] S301: receiving a message to be processed, obtaining production information of the message to be processed, generating a production record of the message to be processed, and storing the record in a corresponding production record table.

[0064] S302: In response to the message processing task being triggered, a preset message subscription set is obtained to extract information of the to-be-processed message corresponding to each subscription record, and a corresponding message processing event is generated and triggered.

[0065] S303: In response to the message processing event, the message processing event is parsed, a thread identifier is obtained, and a thread corresponding to the thread identifier is matched from a preset thread pool.

[0066] S304: In response to a match failure, obtain the current device operating parameters to determine the load status; if the load status meets the preset conditions, create a new thread; if the load status does not meet the preset conditions, obtain the current thread set in the thread pool, and filter the target thread from the current thread set according to the thread identifier.

[0067] S305: In response to successful matching, determining the successfully matched thread as a target thread.

[0068] S306: calling the target thread to obtain the target message from the production record table through the preset database connection, querying the business processing program associated with the target message to execute the processing on the target message and obtain the processing result.

[0069] S307: Generate a consumption record of the target message according to the processing result, and update it to the message consumption record table.

[0070] It should be noted that the data processing principle in the embodiment of the present invention is the same as Figure 1 The corresponding data processing principles in the illustrated embodiments are the same and will not be described in detail here.

[0071] In order to solve the problems existing in the prior art, an embodiment of the present invention provides a message processing device 400, such as Figure 4As shown, the device 400 includes: a receiving unit 401, which is used to receive a message to be processed, obtain the production information of the message to be processed, so as to generate a production record of the message to be processed, and store it in a corresponding production record table; a generating unit 402, which is used to obtain a preset message subscription set in response to the message processing task being triggered, so as to extract the information of the message to be processed corresponding to each subscription record, generate a corresponding message processing event and trigger it; a processing unit 403, which is used to match the corresponding thread from the thread pool in response to the message processing event, call the thread to obtain the target message from the production record table through a preset database connection, query the business processing program associated with the target message to execute the processing of the target message, and obtain the processing result; an updating unit 404, which is used to generate a consumption record of the target message according to the processing result, and update it to the message consumption record table.

[0072] It should be understood that the manner of implementing the embodiments of the present invention is different from the Figure 1 The method of the illustrated embodiment is the same and will not be described again here.

[0073] In one embodiment, the generation unit 402 is specifically used to: obtain the consumer identifier of the message processing task, and extract the corresponding message subscription set from the message subscription record table; for each subscription record in the message subscription set, extract the subscription subject and message identifier of the subscription record, call the preset generation model to generate a thread identifier, and generate a message processing event according to the thread identifier and the subscription subject.

[0074] In another embodiment, the receiving unit 401 is specifically used to: obtain the message description information of the message to be processed, identify the corresponding message source, generation time and message subject, obtain the label of the message source, generate a message identifier in combination with the message subject, and generate a production record of the message to be processed according to the message subject and the message identifier; and insert the production record of the message to be processed into the corresponding production record table according to the generation time.

[0075] In another embodiment, the processing unit 403 is specifically used to: call the thread, obtain the subscription topic and the message identifier according to the message processing event, read the production record table through a preset database connection, and obtain the target message according to the subscription topic and the message identifier.

[0076] In another embodiment, the processing unit 403 is specifically used to: parse the message processing event, obtain the thread identifier, and match the thread corresponding to the thread identifier from a preset thread pool; in response to a matching failure, obtain the current device operating parameters to determine the load status; if the load status meets the preset conditions, create a new thread; if the load status does not meet the preset conditions, obtain the current thread set in the thread pool, and filter the target thread from the current thread set according to the thread identifier.

[0077] In another embodiment, the update unit 404 is further used to: in response to the processing result being successful, query the production record table according to the message information, determine the to-be-processed message corresponding to the subscription record, obtain the corresponding message information, and update the subscription record.

[0078] It should be understood that the manner of implementing the embodiments of the present invention is different from the Figure 1 , 2 , and 3 are the same as the embodiments shown in FIG. 3 and will not be described again here.

[0079] In an embodiment of the present invention, pending messages are stored in a production record table. When a message processing task is triggered, a corresponding message processing event is generated according to subscription information, so that the corresponding thread in the thread pool obtains the pending message from the production record table for processing, and stores the processing result in the message consumption record table. In this way, in an embodiment of the present invention, the function of the message queue is realized through each data table, and the thread pool is combined to process the pending messages, thereby ensuring the response speed of message processing and flow control, without the need to install and maintain the client, thereby avoiding delayed processing of messages.

[0080] According to an embodiment of the present invention, the embodiment of the present invention further provides an electronic device and a readable storage medium.

[0081] The electronic device of an embodiment of the present invention includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the message processing method provided by the embodiment of the present invention.

[0082] Figure 5 An exemplary system architecture 500 is shown to which the message processing method or message processing apparatus according to the embodiment of the present invention can be applied.

[0083] like Figure 5As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0084] The user can use the terminal devices 501, 502, 503 to interact with the server 505 through the network 504 to receive or send messages, etc. Various client applications can be installed on the terminal devices 501, 502, 503.

[0085] The terminal devices 501 , 502 , and 503 may be, but are not limited to, smart phones, tablet computers, laptop computers, and desktop computers, etc.

[0086] The server 505 may be a server that provides various services. The server may analyze and process the received data such as the product information query request, and feed back the processing result (such as product information - just an example) to the terminal device.

[0087] It should be noted that the message processing method provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the message processing device is generally set in the server 505 .

[0088] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0089] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 suitable for implementing an embodiment of the present invention. Figure 6 The computer system shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0090] like Figure 6 As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0091] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.

[0092] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.

[0093] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0094] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a unit, a program segment, or a part of a code, and the above-mentioned unit, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0095] The units involved in the embodiments of the present invention may be implemented by software or hardware. The units described may also be set in a processor, for example, it may be described as: a processor includes a receiving unit, a generating unit, a processing unit, and an updating unit. The names of these units do not constitute a limitation on the units themselves in some cases, for example, the receiving unit may also be described as a "unit of receiving function".

[0096] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device executes the message processing method provided by the present invention.

[0097] As another aspect, the present invention further provides a computer program product, including a computer program, which, when executed by a processor, implements the message processing method provided by an embodiment of the present invention.

[0098] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A message processing method, characterized in that: include: Receive a message to be processed, obtain production information of the message to be processed, generate a production record of the message to be processed, and store it in a corresponding production record table; In response to the message processing task being triggered, a preset message subscription set is obtained to extract information of the to-be-processed message corresponding to each subscription record, and a corresponding message processing event is generated and triggered; In response to the message processing event, a corresponding thread is matched from a thread pool, the thread is called to obtain a target message from the production record table through a preset database connection, and a business processing program associated with the target message is queried to execute processing on the target message to obtain a processing result; A consumption record of the target message is generated according to the processing result and updated to a message consumption record table.

2. The method according to claim 1, characterized in that The obtaining of a preset message subscription set to extract information of the to-be-processed message corresponding to each subscription record and to generate a corresponding message processing event includes: Obtaining the consumer identifier of the message processing task, and extracting the corresponding message subscription set from the message subscription record table; For each subscription record in the message subscription set, the subscription subject and message identifier of the subscription record are extracted, a preset generation model is called to generate a thread identifier, and a message processing event is generated according to the thread identifier and the subscription subject.

3. The method according to claim 1, characterized in that Obtaining the production information of the message to be processed to generate a production record of the message to be processed and storing it in a corresponding production record table, including: Obtain message description information of the message to be processed, identify the corresponding message source, generation time and message subject, obtain the tag of the message source, generate a message identifier in combination with the message subject, and generate a production record of the message to be processed according to the message subject and the message identifier; According to the generation time, the production record of the message to be processed is inserted into the corresponding production record table.

4. The method according to claim 3, characterized in that Calling the thread to obtain a target message from the production record table through a preset database connection includes: The thread is called, a subscription topic and a message identifier are obtained according to the message processing event, the production record table is read through a preset database connection, and a target message is obtained according to the subscription topic and the message identifier.

5. The method according to claim 1, characterized in that The matching of the corresponding thread from the thread pool includes: Parse the message processing event, obtain the thread identifier, and match the thread corresponding to the thread identifier from a preset thread pool; In response to a matching failure, the current device operating parameters are obtained to determine the load state; if the load state meets the preset conditions, a new thread is created; if the load state does not meet the preset conditions, the current thread set in the thread pool is obtained, and a target thread is filtered from the current thread set according to the thread identifier.

6. The method according to claim 1, characterized in that After the target message is processed and a processing result is obtained, the process further includes: In response to the processing result being successful, the production record table is queried according to the message information to determine the to-be-processed message corresponding to the subscription record, and the corresponding message information is obtained to update the subscription record.

7. A message processing device, characterized in that: include: A receiving unit, used to receive a message to be processed, obtain production information of the message to be processed, generate a production record of the message to be processed, and store it in a corresponding production record table; A generating unit, configured to obtain a preset message subscription set in response to a message processing task being triggered, to extract information of the to-be-processed message corresponding to each subscription record, to generate a corresponding message processing event and to trigger it; A processing unit, configured to respond to the message processing event, match a corresponding thread from a thread pool, call the thread to obtain a target message from the production record table through a preset database connection, query a business processing program associated with the target message, execute processing on the target message, and obtain a processing result; An updating unit is used to generate a consumption record of the target message according to the processing result, and update the consumption record table to the message.

8. The device according to claim 7, characterized in that The generating unit is specifically used for: Obtaining the consumer identifier of the message processing task, and extracting the corresponding message subscription set from the message subscription record table; For each subscription record in the message subscription set, the subscription subject and message identifier of the subscription record are extracted, a preset generation model is called to generate a thread identifier, and a message processing event is generated according to the thread identifier and the subscription subject.

9. The device according to claim 7, characterized in that The receiving unit is specifically used for: Obtain message description information of the message to be processed, identify the corresponding message source, generation time and message subject, obtain the tag of the message source, generate a message identifier in combination with the message subject, and generate a production record of the message to be processed according to the message subject and the message identifier; According to the generation time, the production record of the message to be processed is inserted into the corresponding production record table.

10. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

11. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

12. A computer program product, comprising a computer program, characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.