Message processing method and related device
By introducing an agent into the message processing system and managing message consumption objects based on intelligent routing and dependency relationships of scene information, the problem of the lack of unified management of the message consumption layer in the existing technology is solved, and the accuracy of message processing and system reliability are improved. .
Patent Information
- Application Number
- CN202410684266.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-09-17
AI Technical Summary
The existing event-driven message processing framework based on Spring Event lacks unified management at the message consumption layer, resulting in confusing message structure, complex maintenance, limited scalability, and uncertain execution order of message consumption objects, which may lead to data errors or processing failures.
Introduce a proxy to intelligently route messages to the corresponding target message consumption object through scene information, and determine the order of consumption operations based on dependencies to ensure that only consumption objects that support the corresponding scene process messages, achieving unified management and correct order execution of messages.
It improves the accuracy of message processing and system reliability, reduces the risk of errors, enhances system adaptability and user experience, and reduces the need for manual intervention.
Smart Images

Figure CN118656185A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a message processing method and related devices. Background Art
[0002] Event-based message processing usually means that the execution flow of the system is driven by the occurrence of events and the response of the corresponding event processor. Among them, events refer to the state changes or signals of interest in the system, and event processors are responsible for processing these events.
[0003] Spring Framework provides an event-based message processing framework, the core component of which is Spring Event. This framework can help developers implement loosely coupled, distributed, and asynchronous message processing in Spring applications.
[0004] The event-driven message processing framework based on Spring Event usually includes a three-layer structure: one layer is the message production object responsible for producing messages, one layer is the Spring Event listener responsible for listening to the messages produced by the production object, and one layer is the message consumption object that performs consumption operations. Summary of the invention
[0005] The present disclosure provides a message processing method, a message processing device, an agent, a computer-readable storage medium, and a computer program product.
[0006] In a first aspect, the present disclosure provides a message processing method, which is applied to an agent for managing messages in a message processing system, wherein the message processing system also includes a monitoring device and multiple message consumption objects, and the method includes: receiving a message sent by the monitoring device, wherein the message includes scenario information for indicating a scenario; determining multiple target message consumption objects from the multiple message consumption objects, and the scenario supported by each target message consumption object matches the scenario indicated by the scenario information; calling the multiple target message consumption objects in sequence and executing consumption operations of the multiple target message consumption objects, wherein the sequence is determined based on the dependency relationship between the multiple target message consumption objects.
[0007] In a second aspect, the present disclosure provides a message processing device, which is applied to an agent for managing messages in a message processing system, wherein the message processing system further includes a monitoring device and a plurality of message consumption objects, and the device includes:
[0008] a receiving unit, configured to receive a message sent by the monitoring device, the monitoring device being configured to monitor a message from a message production object and provide the detected message to the agent, the message including scenario information for indicating a scenario;
[0009] A determination unit, configured to determine a plurality of target message consumption objects from the plurality of message consumption objects, wherein a scenario supported by each target message consumption object matches a scenario indicated by the scenario information;
[0010] The calling unit is used to call the multiple target message consumption objects in sequence and execute consumption operations of the multiple target message consumption objects, wherein the sequence is determined based on the dependency relationship between the multiple target message consumption objects.
[0011] In a third aspect, the present disclosure provides an agent, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores one or more computer programs executable by the at least one processor, and one or more of the computer programs are executed by the at least one processor so that the at least one processor can execute the above-mentioned message processing method.
[0012] In a fourth aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the above-mentioned message processing method when executed by a processor / processing core.
[0013] In a fifth aspect, the present disclosure provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying a computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above-mentioned message processing method.
[0014] It can be seen that in the embodiment of the present application, an agent is introduced to uniformly manage the processing of messages. The agent realizes intelligent routing of messages by determining multiple target message consumer objects whose supported scenarios match the scenarios indicated by the messages, ensuring that only consumer message objects that support the corresponding scenarios will process the messages, thereby improving the accuracy and efficiency of processing. In addition, the agent sequentially executes the consumption operations of the determined multiple target message consumer objects based on the dependencies between the multiple target message consumer objects, which can ensure that the message consumer objects are executed in the correct order, preventing data errors or processing failures caused by improper execution order. As a result, the system is allowed to better adapt to different business scenarios, improve the accuracy of message processing and the reliability of the system, and reduce the risk of errors.
[0015] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the present disclosure and do not constitute a limitation of the present disclosure. The above and other features and advantages will become more apparent to those skilled in the art by describing detailed example embodiments with reference to the accompanying drawings, in which:
[0017] Figure 1 It is an operation flow chart of a three-layer message processing system of the related technology;
[0018] Figure 2 An application scenario diagram of the message processing system and method provided by the embodiments of the present disclosure;
[0019] Figure 3 An operation flow chart of a message processing system provided by an embodiment of the present disclosure;
[0020] Figure 4 A flowchart of a message processing method provided by an embodiment of the present disclosure;
[0021] Figure 5 An example of the workflow of the message processing system provided in the embodiment of the present disclosure;
[0022] Figure 6 An example of a message body structure of a message provided for an embodiment of the present disclosure;
[0023] Figure 7 An example of the basic structure of a message consumption object provided in an embodiment of the present disclosure;
[0024] Figure 8 A block diagram of a message processing device provided by an embodiment of the present disclosure;
[0025] Fig. 9 A block diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, those of ordinary skill in the art should recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0027] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.
[0028] As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0029] The terms used herein are only used to describe specific embodiments and are not intended to limit the present disclosure. As used herein, the singular forms "a" and "the" are also intended to include plural forms, unless the context clearly indicates otherwise. It will also be understood that when the terms "including" and / or "made of" are used in this specification, the presence of the features, wholes, steps, operations, elements and / or components is specified, but the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof is not excluded. "Connected" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect.
[0030] Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by those of ordinary skill in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted as having an idealized or overly formal meaning unless explicitly defined as such herein.
[0031] Figure 1 FIG. 1 is an operation flow chart of a three-layer message processing system of the related art. Figure 1 As shown, the message processing system includes a message production layer, a monitoring layer (e.g., Spring Event), and a message consumption layer. The message production layer produces multiple messages, for example, message A, message B, and message C. The monitoring layer includes multiple monitoring devices. Each message corresponds to a monitoring device. For example, the multiple monitoring devices include a first monitoring device for detecting message A, a second monitoring device for detecting message B, and a third monitoring device for detecting message C. The message consumption layer includes multiple message consumption objects. After each monitoring device receives a message, it directly lets the message consumption object perform a consumption operation.
[0032] The three-layer message processing system of the related technology has the following problems: first, the consumer structure of the message is not uniformly planned, which may make the structure and content of the message confusing and difficult to understand, increase the difficulty of maintenance, and limit the scalability of the system; second, at the monitoring layer, each structure of the message needs to be configured with a monitoring device, which makes the maintenance of the monitoring device complicated; third, at the message consumption layer, the message consumption objects do not have a unified structure, and each executes and manages consumption operations, and unified management cannot be achieved.
[0033] Figure 2 An application scenario diagram of the message processing system and method provided in an embodiment of the present disclosure.
[0034] like Figure 2 As shown, the application scenario of the embodiment of the present disclosure may include a terminal device 101, a network 103 and a server 102. The network 103 is used to provide a medium for a communication link between the terminal device 101 and the server 102. The network 103 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0035] The user can use the terminal device 101 to interact with the server 102 through the network 103 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).
[0036] The terminal device 101 may be any electronic device having a display screen and supporting web browsing, including but not limited to a smart phone, a tablet computer, a laptop computer, a desktop computer, and the like.
[0037] The server 102 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the terminal device 101. The background management server may analyze and process received data such as user requests, and feed back processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0038] It should be noted that the message processing system and method provided in the embodiment of the present disclosure can be executed by the server 102. Accordingly, the message processing system and method provided in the embodiment of the present disclosure can be set in the server 102. The message processing system and method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 102 and can communicate with the terminal device 101 and / or the server 102. Accordingly, the message processing system and method provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 102 and can communicate with the terminal device 101 and / or the server 102.
[0039] It should be understood that Figure 2 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.
[0040] Figure 3 The following is an operation flow chart of a message processing system provided by an embodiment of the present disclosure. Figure 3As shown, the message processing system includes: a message production layer, a monitoring layer, a proxy layer and a message consumption layer. The message production layer includes one or more message production objects configured to produce messages. The monitoring layer includes a monitoring device configured to detect messages from the message production objects and provide the detected messages to the proxy layer. The proxy layer includes an agent configured to determine a target message consumption object corresponding to the detected message from multiple message consumption objects in the message consumption layer, call the determined target message consumption object to perform the consumption operation of the target message consumption object, and manage and control the consumption operation of the target message consumption object.
[0041] All or part of the above message production objects, monitoring devices, agents, and message consumption objects are implemented by software, hardware, and their combination. The above components can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the above modules. The above monitoring layer can be implemented by Spring Event.
[0042] Figure 4 A flowchart of a message processing method provided by an embodiment of the present disclosure. Figure 4 The method is applied to an agent for managing messages in a message processing system. The method includes steps S101 to S103.
[0043] Step S101: receiving a message sent by a monitoring device, wherein the message includes scene information indicating a scene.
[0044] In the present disclosure, "scenario" can be seen as a classification of messages, which aims to group together messages that need to perform the same consumption operations. For example, in the case of an e-commerce website, the system can define multiple scenarios, such as "add user" to indicate the registration of a new user, "delete user" to indicate the logout of a user, as well as "user login", "user changes password", "user binds mobile phone number", "user searches for products", "user collects products", "user purchases", "user completes payment", etc. For example, in a human resources management system used within an enterprise, scenarios may include employee onboarding, employee regularization, employee transfer, and employee resignation. The introduction of scenarios can reduce unnecessary message transmission, improve the efficiency of the system, and help project maintainers gain a global perspective or global understanding of the entire system.
[0045] Step S102: determining a plurality of target message consumption objects from the plurality of message consumption objects, wherein the scenario supported by each target message consumption object matches the scenario indicated by the scenario information.
[0046] In some embodiments, the agent parses the scenario from the scenario information of the message, and determines the target message consumer object corresponding to the message from a plurality of message consumer objects according to the scenario.
[0047] In addition, the message processing system also includes a registration center, which stores information about the scenarios supported by the message consumer objects. For example, the registration center can adopt a map structure, in which the key is the scenario and the value is the message consumer object.
[0048] In the initial state, the scenarios supported by the message consumer object will be automatically registered to the registration center. After receiving the message, the agent parses the scenario in the message body structure and accesses the registration center to find the corresponding message consumer object according to the scenario. The setting of the registration center can help the system quickly find the corresponding message consumer object.
[0049] Step S103: calling the multiple target message consumption objects in sequence and executing consumption operations of the multiple target message consumption objects. The sequence is determined based on the dependency relationship between the multiple target message consumption objects.
[0050] In an embodiment of the present disclosure, a scenario may correspond to multiple target message consumption objects. The agent may determine multiple target message consumption objects from the multiple message consumption objects of the message consumption layer according to the scenario, and call the multiple target message consumption objects in sequence to perform consumption operations of the multiple target message consumption objects. The scenario supported by each target message consumption object matches the scenario indicated by the scenario information. In some embodiments, the calling order may be determined based on the dependency relationship between the message consumption objects in the initial state.
[0051] The embodiments of the present disclosure introduce an agent of the proxy layer to uniformly manage the processing of messages. The agent implements intelligent routing of messages by determining multiple target message consumer objects whose supported scenarios match the scenarios indicated by the messages, ensuring that only consumer message objects that support the corresponding scenarios will process the messages, thereby improving the accuracy and efficiency of processing. In addition, the processor sequentially executes the consumption operations of the determined multiple target message consumer objects based on the dependencies between the multiple target message consumer objects, which can ensure that the message consumer objects are executed in the correct order, preventing data errors or processing failures caused by improper execution order. As a result, the system is allowed to better adapt to different business scenarios, improve the accuracy of message processing and the reliability of the system, and reduce the risk of errors.
[0052] In some embodiments, the agent is configured to perform at least one of the following: counting consumption operation results, including consumption operation duration, whether the consumption operation is successful, the number of consumption operation failures, feedback messages in response to the consumption operation, etc.; controlling compensation operations after consumption failure; recording compensation operation results; controlling retry logic after consumption failure. Specifically, the agent can be configured to: count consumption operation results; determine compensation operations after consumption failure based on the counted consumption operation results; count compensation operation results. The present disclosure does not limit the specific content executed by the agent.
[0053] In the embodiments of the present disclosure, the statistical consumption operation duration can be used as a reference for technical strategies, for example, to determine whether the consumption time is too long due to technical strategies; on the other hand, it can be used as a reference for business logic, for example, to determine whether the consumption time is long due to too complex logic, so as to consider the simplification of logic. The consumption duration can be used to compare the quantitative values before and after optimization. The statistical consumption results can be used for intuitive display.
[0054] In some embodiments, the message processing method according to the embodiment of the present disclosure also includes: in the event of a failure in executing a consumption operation of a target message consumer object, the agent determines compensation processing according to the consumption processing result of the target message consumer object, and executes the compensation processing. In this way, it is ensured that the message processing system can still maintain efficient and stable operation in the face of a consumption operation failure. The introduction of this mechanism significantly improves the reliability of the system, reduces the need for manual intervention, and can quickly respond and recover when problems arise, thereby improving the user experience and work efficiency of the entire system.
[0055] In some embodiments, determining the compensation processing according to the consumption processing result of the target message consumption object includes: determining the cause type of failure according to the consumption processing result of the target message consumption object; and determining the compensation processing according to the cause type.
[0056] For example, multiple types of reasons for consumption operation failure can be set, such as consumption operation timeout, failure frequency exceeding limit, and external reasons, etc. The present disclosure does not limit the specific classification method and classification data of the reason type.
[0057] In some embodiments, if the consumption operation of the target message consumption object fails, the type of cause of failure can be determined according to the consumption processing result of the target message consumption object; and then the compensation processing corresponding to the cause type can be determined according to the cause type. For example, after the user registers, a welcome SMS needs to be sent to the user. Sending a welcome SMS to the user can correspond to a consumption operation. If the result of the consumption operation shows that the number of failures of the SMS provider's SMS sending interface exceeds a threshold within a period of time, the type of cause of failure can be determined as a failure frequency exceeding the limit, and a compensation processing corresponding to the failure frequency exceeding the limit is performed, such as changing the SMS provider.
[0058] In this way, when a problem occurs, rapid response and recovery can be performed based on the type of failure cause, thereby improving the user experience and work efficiency of the entire system.
[0059] In some embodiments, the determining the type of cause of failure according to the consumption processing result of the target message consumption object includes:
[0060] If the consumption operation duration is greater than or equal to a first threshold, determining the cause type as consumption operation timeout;
[0061] If the number of consumption operation failures is greater than or equal to a second threshold, determining the cause type as failure frequency exceeding a limit;
[0062] If the feedback message in response to the consumption operation is received from a device located outside the message processing system, the reason type is determined to be an external reason.
[0063] For example, during the execution of the consumption operation by the message consumption object, the parameters corresponding to the consumption operation can be obtained, including the start time and end time of the consumption operation, the content of the consumption operation, the duration of the consumption operation (corresponding to the time of executing the consumption operation), the number of consumption operation failures within a unit time (such as 10 minutes, 1 hour, 1 day, etc.), the feedback message received by the system from the external device, etc. The present disclosure does not limit the type and number of parameters corresponding to the consumption operation.
[0064] In some embodiments, if the consumption operation of executing the target message consumption object fails, the type of cause of the failure may be determined based on the consumption processing result of the target message consumption object and the parameters corresponding to the consumption operation.
[0065] In the example, if the time to execute the consumption operation (consumption operation duration) exceeds the preset first threshold, it can be considered that the reason type for the processing failure is the consumption operation timeout. This means that the processing takes too long, which may be due to excessive system load or other performance issues, and then a compensation process corresponding to the consumption operation timeout can be performed. Among them, the first threshold can be set to 2 minutes, 5 minutes, etc., and the present disclosure does not limit the specific value of the first threshold.
[0066] In the example, if the number of consumption operation failures of the message consumer object in a unit time exceeds the preset second threshold, it can be considered that the reason type of the processing failure is the failure frequency exceeding the limit. This indicates that there is a stability problem in the consumption operation of the message consumer object, resulting in frequent failures to perform consumption operations, and then compensation processing corresponding to the failure frequency exceeding the limit can be performed. Among them, the second threshold can be set to 5 times, 10 times, etc., and this disclosure does not limit the specific value of the second threshold
[0067] In the example, if the parameters corresponding to the consumption operation include a feedback message received by the agent from an external device in response to the consumption operation, it indicates that the processing failure is caused by external factors. The cause type of the processing failure can be considered to be an external cause, and compensation processing corresponding to the external cause is performed.
[0068] In this way, the process of determining the type of cause of the failure of the consumption operation can be implemented so as to carry out corresponding compensation processing in a targeted manner, thereby improving the recovery efficiency of the consumption service.
[0069] In some embodiments, determining the compensation process according to the cause type includes:
[0070] If the reason type is consumption operation timeout, determining the compensation process as re-executing the consumption operation of the target message consumption object;
[0071] If the cause type is failure frequency exceeding the limit, determining the compensation process is to issue an alarm and execute a predetermined fault handling process;
[0072] If the cause type is an external cause, a prompt indicating the external cause is issued without performing compensation processing.
[0073] For example, the agent can take corresponding compensatory measures according to the different reasons for the failure of the consumption operation to ensure that the system can effectively handle the error and restore normal operation when possible.
[0074] In some embodiments, if the cause type is consumption operation timeout, the compensation process is determined to be re-execution of the consumption operation of the target message consumption object. In this case, the target message consumption object can be called again to execute the consumption operation of the target message consumption object according to the corresponding scenario.
[0075] In some embodiments, if the cause type is failure frequency exceeding the limit, the compensation process is determined to be to issue an alarm and execute a predetermined fault handling process. In this case, a corresponding alarm message can be sent to a terminal (such as a smart phone) of a relevant person (such as a system operation and maintenance person) to remind the relevant person to handle the process; and a preset fault handling process is executed, such as establishing a fault handling work order, or inputting a preset fault analysis model for fault analysis, etc. The present disclosure does not limit the specific method of the alarm and the specific fault handling process.
[0076] In some embodiments, if the cause type is an external cause, a prompt indicating the external cause is issued without performing compensation processing. A corresponding prompt may be sent to a terminal of a relevant person (eg, a system operation and maintenance person) to remind the relevant person to perform further processing.
[0077] In some embodiments, when determining the cause type of the failure of the consumption operation, one or more cause types may be determined at the same time. If only one cause type is determined, the corresponding compensation processing can be directly executed. If multiple cause types are determined, the compensation processing corresponding to each cause type can be executed separately; the compensation processing corresponding to each cause type can also be executed in sequence based on a preset priority; or only the compensation processing corresponding to the cause type with the highest priority is executed. The present disclosure does not limit the specific compensation processing method.
[0078] In some embodiments, not every consumption operation fails and a compensation operation is performed. For example, when sending a text message to a user, if the result of the consumption operation indicates that the account balance is insufficient, there is no need to retry the consumption operation because retrying will not solve the problem; if the result of the consumption operation indicates that the network has timed out, the consumption operation can be retried. The user experience can be improved based on the retry mechanism after failure.
[0079] In this way, corresponding compensation processing can be carried out in a targeted manner according to the type of cause of the consumption operation failure, thereby improving the recovery efficiency of the consumption service and improving the reliability of the system.
[0080] In an embodiment of the present disclosure, each of the multiple message consumer objects has a unified structure based on a strategy pattern. To facilitate the unified management of the proxy layer, the design of each message consumer object in the message consumer layer can adopt a strategy pattern, and this strategy pattern is a unified and consistent structure in the implementation of the entire message consumer object. Specifically, the strategy pattern is a behavioral design pattern, in which a series of algorithms are defined, and each algorithm is encapsulated into an independent class so that they can have different implementations for the same behavior. In the context of message consumer objects, these algorithms generally refer to specific behaviors of message consumption. Designing message consumer objects as a unified structure based on the strategy pattern makes the hierarchical relationship of the code more intuitive and easier to expand.
[0081] In some embodiments, the messages have the same message body structure, and the message processing system includes only one monitoring device. Since the messages have the same message body structure, other components of the system can more easily understand and process the messages, while reducing the debugging and maintenance difficulty for developers. In addition, since the message body structure is unified, the monitoring layer only needs to provide one monitoring device to detect different messages, thereby further reducing the maintenance difficulty and the possibility of errors.
[0082] Figure 5 This is an example of the workflow of the message processing system provided by the embodiment of the present disclosure. Figure 5 As shown, first, the message production object publishes an asynchronous event message carrying scene information. The message body structure is as follows Figure 6 As shown, scene represents a scene. It can be understood that the message also includes other information. Figure 6 In the message, the user's mailbox, message sending time, message identifier and other information are also included. After the Spring Event listening device receives the asynchronous event message, it passes the asynchronous event message to the agent. After the agent receives the message, it first verifies the message (for example, whether the message body meets the standards, the required parameters, etc.) and parses the scenario, then finds the corresponding message consumer object according to the scenario in the registration center and calls the corresponding message consumer object to perform the consumption operation. At the same time, the agent manages and controls the consumption operation, for example, counting the results of the consumption operation, counting the number of consumption failures, controlling the compensation operation after the consumption failure, recording the results of the compensation operation, and controlling the retry logic after the consumption failure. The message consumer object performs the consumption operation and is designed into a unified structure based on the strategy pattern. Figure 7 This is an example of the basic structure of a message consumer object, where support() indicates which scenario the current message consumer object supports, consume(T t) indicates the core consumption logic (consumption operation) of the message consumer object, parameter t indicates the message body content, and sortNumber() indicates the execution order of multiple message consumer objects when a scenario corresponds to multiple message consumer objects. The execution order of multiple message consumer objects can be based on the dependency relationship between the message consumer objects.
[0083] In addition, the present disclosure also provides a message processing device, an agent, a computer-readable storage medium, and a computer program product, all of which can be used to implement any message processing method provided by the present disclosure. The corresponding technical solutions and descriptions are referred to the corresponding records in the method part and will not be repeated here.
[0084] Figure 8 A block diagram of a message processing device provided by an embodiment of the present disclosure. Figure 8As shown, the embodiment of the present disclosure also provides a message processing device, which is applied to an agent for managing messages in a message processing system. The message processing system also includes a monitoring device and multiple message consumption objects. The device includes:
[0085] A receiving unit 81, configured to receive a message sent by the monitoring device, wherein the monitoring device is configured to monitor a message from a message production object and provide the detected message to the agent, wherein the message includes scene information for indicating a scene;
[0086] A determining unit 82, configured to determine a plurality of target message consumption objects from the plurality of message consumption objects, wherein the scenario supported by each target message consumption object matches the scenario indicated by the scenario information;
[0087] The calling unit 83 is used to call the multiple target message consumption objects in sequence and perform consumption operations on the multiple target message consumption objects, wherein the sequence is determined based on the dependency relationship between the multiple target message consumption objects.
[0088] It can be understood that the above-mentioned various method embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, the present disclosure will not repeat them. It can be understood by those skilled in the art that in the above-mentioned method of the specific implementation method, the specific execution order of each step should be determined according to its function and possible internal logic.
[0089] Fig. 9 A block diagram of an agent provided in an embodiment of the present disclosure.
[0090] Reference Fig. 9 , an embodiment of the present disclosure provides an agent, which includes: at least one processor 801; at least one memory 802, and one or more I / O interfaces 803, connected between the processor 801 and the memory 802; wherein the memory 802 stores one or more computer programs that can be executed by at least one processor 801, and the one or more computer programs are executed by at least one processor 801 to enable at least one processor 801 to execute the above-mentioned message processing method. An embodiment of the present disclosure also provides a computer-readable storage medium, on which a computer program is stored, wherein the computer program implements the above-mentioned message processing method when executed by the processor / processing core. The computer-readable storage medium can be a volatile or non-volatile computer-readable storage medium.
[0091] The embodiment of the present disclosure also provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above-mentioned message processing method.
[0092] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable storage medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium).
[0093] As is known to those of ordinary skill in the art, the term computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable program instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), static random access memory (SRAM), flash memory or other memory technology, portable compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. In addition, it is known to those of ordinary skill in the art that communication media typically contain computer-readable program instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and may include any information delivery medium.
[0094] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.
[0095] The computer program instructions for performing the operation of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages, such as Smalltalk, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. Computer-readable program instructions may be executed completely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be customized by utilizing the state information of the computer-readable program instructions, and the electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0096] The computer program product described herein may be implemented in hardware, software, or a combination thereof. In one optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (SDK), etc.
[0097] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.
[0098] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0099] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operating steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.
[0100] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the specified logical function. In some alternative implementations, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs the specified function or action, or can be implemented with a combination of special hardware and computer instructions.
[0101] Example embodiments have been disclosed herein, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for limiting purposes. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly noted, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, those skilled in the art will appreciate that various changes in form and detail may be made without departing from the scope of the present disclosure as set forth in the appended claims.
Claims
1. A message processing method, It is characterized in that An agent for managing messages applied to a message processing system, wherein the message processing system further comprises a monitoring device and a plurality of message consumption objects, and the method comprises: receiving a message sent by the monitoring device, wherein the message includes scene information for indicating a scene; Determining a plurality of target message consumption objects from the plurality of message consumption objects, wherein a scenario supported by each target message consumption object matches a scenario indicated by the scenario information; The multiple target message consumption objects are called in sequence and in turn to execute consumption operations of the multiple target message consumption objects, wherein the sequence is determined based on the dependency relationship between the multiple target message consumption objects.
2. The method according to claim 1, It is characterized in that The method further comprises: In the case where the consumption operation of the target message consumption object fails, determining the compensation processing according to the consumption processing result of the target message consumption object; The compensation process is performed.
3. The method according to claim 2, It is characterized in that The determining of the compensation processing according to the consumption processing result of the target message consumption object includes: Determine the type of failure reason according to the consumption processing result of the target message consumption object; The compensation process is determined according to the cause type.
4. The method according to claim 3, It is characterized in that The consumption processing result includes the consumption operation duration, the number of consumption operation failures, and the feedback message in response to the consumption operation; the type of failure reason determined according to the consumption processing result of the target message consumption object includes: If the consumption operation duration is greater than or equal to a first threshold, determining the cause type as consumption operation timeout; If the number of consumption operation failures is greater than or equal to a second threshold, determining the cause type as failure frequency exceeding a limit; If the feedback message in response to the consumption operation is received from a device located outside the message processing system, the reason type is determined to be an external reason.
5. The method according to claim 4, It is characterized in that The determining of compensation processing according to the cause type includes: If the reason type is consumption operation timeout, determining the compensation process as re-executing the consumption operation of the target message consumption object; If the cause type is failure frequency exceeding the limit, determining the compensation process is to issue an alarm and execute a predetermined fault handling process; If the cause type is an external cause, a prompt indicating the external cause is issued without performing compensation processing.
6. The message processing method according to any one of claims 1 to 5, It is characterized in that Each of the multiple message consumption objects has a unified structure designed based on a strategy pattern.
7. A message processing device, It is characterized in that An agent for managing messages applied to a message processing system, wherein the message processing system further comprises a monitoring device and a plurality of message consumption objects, wherein the device comprises: a receiving unit, configured to receive a message sent by the monitoring device, the monitoring device being configured to monitor a message from a message production object and provide the detected message to the agent, the message including scenario information for indicating a scenario; A determination unit, configured to determine a plurality of target message consumption objects from the plurality of message consumption objects, wherein a scenario supported by each target message consumption object matches a scenario indicated by the scenario information; The calling unit is used to call the multiple target message consumption objects in sequence and execute consumption operations of the multiple target message consumption objects, wherein the sequence is determined based on the dependency relationship between the multiple target message consumption objects.
8. A proxy, It is characterized in that include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores one or more computer programs that can be executed by the at least one processor, and the one or more computer programs are executed by the at least one processor to enable the at least one processor to perform the message processing method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the computer program implements the message processing method according to any one of claims 1 to 6.
10. A computer program product, It is characterized in that The method comprises a computer-readable code or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the message processing method as described in any one of claims 1 to 6.
