Workflow exception handling method, device, computer equipment and storage medium
Through aspect-oriented programming and integrated tools to capture workflow exceptions, build and process exception messages, the problem of lack of global monitoring in existing technologies is solved, and the stability and robustness of workflows are improved.
Patent Information
- Application Number
- CN202411365756.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2044-09-27
AI Technical Summary
Existing workflow exception handling methods mainly rely on synchronization mechanisms, lack the ability to monitor the global workflow process, and cannot achieve global exception monitoring and handling.
Aspect-oriented programming technology is used to capture exceptions when the workflow starts, and integrated tools are used to capture exceptions in each node of the workflow, build exception messages, integrate and send them to the designated channel, and handle them using the exception handling system and strategy.
It realizes global exception monitoring and processing of workflow, improves the stability and robustness of workflow, avoids interruptions caused by exceptions, and ensures the smooth progress of business processes.
Smart Images

Figure CN119226086B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the fields of data processing technology and financial technology, and in particular to a method, apparatus, computer equipment, and storage medium for handling workflow exceptions. Background Art
[0002] With the increasing complexity of business and the accelerated pace of digital transformation within the operational management systems of financial enterprises, workflow management systems have become a key tool for improving operational efficiency and ensuring the automation and standardization of business processes. By defining a series of ordered tasks, decision points, and rules, these systems automatically execute or guide the execution of complex business processes such as order processing, project management, and financial approvals, significantly improving the efficiency and accuracy of business processing.
[0003] However, workflow management systems face numerous challenges during deployment and operation, with the effectiveness of exception handling mechanisms being particularly critical. Traditional exception handling methods primarily rely on synchronization mechanisms. When a workflow node encounters an exception during execution, exceptions are typically captured and handled for a specific node or service. This approach lacks the ability to monitor the overall workflow process, making it impossible to fully understand the impact of exceptions on the overall workflow progress, and preventing global exception monitoring and handling. Summary of the Invention
[0004] The purpose of the embodiments of the present application is to propose a workflow exception handling method, device, computer equipment and storage medium to solve the technical problem that the existing workflow exception handling method mainly relies on the synchronization mechanism, lacks the ability to monitor the global process of the workflow, and cannot achieve global exception monitoring and exception handling of the workflow.
[0005] In order to solve the above technical problems, the present application provides a workflow exception handling method, which adopts the following technical solutions:
[0006] When the target workflow is started, the first exception thrown by the target workflow entry method is captured through the target notification predefined in aspect-oriented programming; wherein the target workflow entry method is the workflow entry method corresponding to the target workflow;
[0007] Constructing a corresponding first exception message based on the first exception;
[0008] During the working process of the target workflow, capturing a second exception thrown by a node within the target workflow based on a preset target exception handling statement;
[0009] Constructing a corresponding second exception message based on the second exception;
[0010] Integrating the first exception message and the second exception message to obtain a target exception message corresponding to a target exception; wherein the target exception includes the first exception and the second exception;
[0011] For each target exception, calling a target exception handling system corresponding to the target exception;
[0012] Sending the target exception message to a designated message channel based on a preset integration tool;
[0013] When the target exception handling system receives the target exception message from the message channel, it processes the target exception accordingly based on the target exception message and a preset exception handling strategy.
[0014] Furthermore, the step of constructing a corresponding second exception message based on the second exception specifically includes:
[0015] Get the preset exception message format;
[0016] Acquire specified context information corresponding to the second exception based on the exception message format;
[0017] Encapsulating the specified context information to obtain corresponding encapsulation information;
[0018] The encapsulation information is used as the second abnormal message.
[0019] Furthermore, for each target exception, the step of calling a target exception handling system corresponding to the target exception specifically includes:
[0020] For each target exception, obtain a specified exception type of the target exception;
[0021] Call the preset exception handling library;
[0022] Filtering out a designated exception handling system corresponding to the designated exception type from the exception handling library;
[0023] The designated exception handling system is used as the target exception handling system.
[0024] Furthermore, the step of processing the target exception accordingly based on the target exception message and a preset exception handling strategy specifically includes:
[0025] Obtaining a target exception code of the target exception from the target exception message;
[0026] Call the preset strategy mapping table;
[0027] Find the target exception handling policy corresponding to the target exception code from the policy mapping table;
[0028] The target exception handling system executes processing logic corresponding to the target exception handling strategy to perform corresponding processing on the target exception.
[0029] Furthermore, after the step of processing the target exception accordingly based on the target exception message and the preset exception handling strategy, the method further includes:
[0030] Call the preset logging framework;
[0031] Performing log recording on the target workflow based on the log framework to obtain corresponding log data;
[0032] Call the preset log storage system;
[0033] The log data is stored in the log storage system.
[0034] Furthermore, the step of storing the log data in the log storage system specifically includes:
[0035] Call the preset level setting strategy;
[0036] Performing log level setting processing on the log data based on the level setting policy to obtain corresponding first log data;
[0037] Performing log level adjustment processing on the first log data to obtain corresponding second log data;
[0038] The second log data is stored in the log storage system.
[0039] Furthermore, the workflow exception handling method further includes:
[0040] Determining a performance indicator type corresponding to the target workflow;
[0041] Call the preset monitoring tool;
[0042] Based on the performance indicator type, using the monitoring tool to collect specified performance indicator data corresponding to the target workflow;
[0043] Performing data analysis on the specified performance indicator data based on preset alarm rules to determine whether there is abnormal indicator data in the specified performance indicator data;
[0044] If so, filtering out the abnormal indicator data from the specified performance indicator data, and generating a corresponding abnormal alarm notification based on the abnormal indicator data;
[0045] The abnormal alarm notification is sent to the corresponding operation and maintenance personnel.
[0046] In order to solve the above technical problems, the embodiment of the present application further provides a workflow exception handling device, which adopts the following technical solution:
[0047] A first capture module is configured to capture, when a target workflow is started, a first exception thrown by a target workflow entry method through a target notification predefined in aspect-oriented programming; wherein the target workflow entry method is a workflow entry method corresponding to the target workflow;
[0048] A first construction module, configured to construct a corresponding first exception message based on the first exception;
[0049] A second capturing module is configured to capture, during the working process of the target workflow, a second exception thrown by a node within the target workflow based on a preset target exception handling statement;
[0050] A second building module, configured to build a corresponding second exception message based on the second exception;
[0051] an integration module, configured to integrate the first exception message and the second exception message to obtain a target exception message corresponding to a target exception; wherein the target exception includes the first exception and the second exception;
[0052] A first calling module is configured to call a target exception handling system corresponding to each target exception for each target exception;
[0053] A first sending module is used to send the target exception message to a designated message channel based on a preset integration tool;
[0054] The processing module is used to process the target exception based on the target exception message and a preset exception processing strategy when the target exception processing system receives the target exception message from the message channel.
[0055] In order to solve the above technical problems, the embodiment of the present application further provides a computer device, which adopts the following technical solution:
[0056] When the target workflow is started, the first exception thrown by the target workflow entry method is captured through the target notification predefined in aspect-oriented programming; wherein the target workflow entry method is the workflow entry method corresponding to the target workflow;
[0057] Constructing a corresponding first exception message based on the first exception;
[0058] During the working process of the target workflow, capturing a second exception thrown by a node within the target workflow based on a preset target exception handling statement;
[0059] Constructing a corresponding second exception message based on the second exception;
[0060] Integrating the first exception message and the second exception message to obtain a target exception message corresponding to a target exception; wherein the target exception includes the first exception and the second exception;
[0061] For each target exception, calling a target exception handling system corresponding to the target exception;
[0062] Sending the target exception message to a designated message channel based on a preset integration tool;
[0063] When the target exception handling system receives the target exception message from the message channel, it processes the target exception accordingly based on the target exception message and a preset exception handling strategy.
[0064] In order to solve the above technical problems, the embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solution:
[0065] When the target workflow is started, the first exception thrown by the target workflow entry method is captured through the target notification predefined in aspect-oriented programming; wherein the target workflow entry method is the workflow entry method corresponding to the target workflow;
[0066] Constructing a corresponding first exception message based on the first exception;
[0067] During the working process of the target workflow, capturing a second exception thrown by a node within the target workflow based on a preset target exception handling statement;
[0068] Constructing a corresponding second exception message based on the second exception;
[0069] Integrating the first exception message and the second exception message to obtain a target exception message corresponding to a target exception; wherein the target exception includes the first exception and the second exception;
[0070] For each target exception, calling a target exception handling system corresponding to the target exception;
[0071] Sending the target exception message to a designated message channel based on a preset integration tool;
[0072] When the target exception handling system receives the target exception message from the message channel, it processes the target exception accordingly based on the target exception message and a preset exception handling strategy.
[0073] Compared with the prior art, the embodiments of the present application have the following beneficial effects:
[0074] This application first captures the first exception thrown by the target workflow entry method through the target notification predefined in aspect-oriented programming when the target workflow is started; and constructs a corresponding first exception message based on the first exception; during the working process of the target workflow, captures the second exception thrown by the node inside the target workflow based on the preset target exception handling statement; constructs a corresponding second exception message based on the second exception; and integrates the first exception message and the second exception message to obtain a target exception message corresponding to the target exception; wherein, the target exception includes the first exception and the second exception; then for each of the target exceptions, call the target exception handling system corresponding to the target exception; then send the target exception message to the specified message channel based on the preset integration tool; subsequently, when the target exception handling system receives the target exception message from the message channel, it handles the target exception accordingly based on the target exception message and the preset exception handling strategy. This application uses aspect-oriented programming to cut into the workflow entry method to capture the first exception thrown during the workflow operation, and uses integrated tools to capture the corresponding second exception in each node of the workflow, and then handles all exceptions based on the use of the target exception handling system and exception handling strategy, thereby achieving global monitoring and effective handling of exceptions in the workflow, improving the stability and robustness of the workflow, and effectively avoiding workflow interruption due to exceptions, thereby ensuring the smooth progress of the business process. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] In order to more clearly illustrate the solutions in this application, a brief introduction will be given below to the drawings required for use in the description of the embodiments of this application. Obviously, the drawings described below are some embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0076] Figure 1 is an exemplary system architecture diagram to which the present application may be applied;
[0077] Figure 2 A flowchart of an embodiment of a method for handling workflow exceptions according to the present application;
[0078] Figure 3This is a structural diagram of an embodiment of a workflow exception handling device according to the present application;
[0079] Figure 4 It is a structural diagram of an embodiment of a computer device according to the present application. DETAILED DESCRIPTION
[0080] Unless otherwise defined, all technical and scientific terms used herein have the same meanings as commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of the application are for the purpose of describing specific embodiments only and are not intended to limit this application. The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of this application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0081] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0082] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0083] like Figure 1 As shown, system architecture 100 may include a terminal device 101, a network 102, and a server 103. Terminal device 101 may be a laptop computer 1011, a tablet computer 1012, or a mobile phone 1013. Network 102 is a medium for providing a communication link between terminal device 101 and server 103. Network 102 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0084] The user can use the terminal device 101 to interact with the server 103 via the network 102 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0085] The terminal device 101 can be various electronic devices with a display screen and supporting web browsing. In addition to the laptop computer 1011, tablet computer 1012 or mobile phone 1013, the terminal device 101 can also be an e-book reader, an MP3 player (Moving Picture Experts Group Audio Layer III), an MP4 (Moving Picture Experts Group Audio Layer IV) player, a laptop computer and a desktop computer, etc.
[0086] The server 103 may be a server that provides various services, such as a background server that provides support for web pages displayed on the terminal device 101 .
[0087] It should be noted that the workflow exception handling method provided in the embodiment of the present application is generally executed by a server / terminal device, and accordingly, the workflow exception handling device is generally set in the server / terminal device.
[0088] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0089] Continue to refer Figure 2 , shows a flowchart of an embodiment of the workflow exception handling method according to the present application. According to different needs, the order of the steps in the flowchart can be changed, and some steps can be omitted. The workflow exception handling method provided in the embodiment of the present application can be applied to any scenario that requires exception handling, and the workflow exception handling method can be applied to products in these scenarios, for example, workflow exception handling in the financial and insurance fields. The workflow exception handling method includes the following steps:
[0090] Step S201, when the target workflow is started, the first exception thrown by the target workflow entry method is captured through the target notification predefined in aspect-oriented programming; wherein the target workflow entry method is the workflow entry method corresponding to the target workflow.
[0091] In this embodiment, the workflow exception handling method is executed on the electronic device (eg Figure 1The server / terminal device shown) can obtain the first exception thrown by the target workflow entry method through a wired connection or a wireless connection. It should be noted that the above-mentioned wireless connection method may include but is not limited to 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or developed in the future. The execution entity of this application may specifically be a workflow management system, or simply referred to as a system. Workflow refers to the automation of part or all of a business process in a computer application environment, which is manifested as the automatic process of transferring documents, information or tasks between multiple participants according to certain predefined rules, thereby achieving a certain expected business goal or promoting the realization of this goal. In short, a workflow is a series of interconnected and automatically performed business activities or tasks. Among them, the above-mentioned target workflow can be any one or more workflows. By using aspect-oriented programming (AOP) technology, it is possible to cut into the workflow entry method of the target workflow, capture unknown exceptions thrown by the target workflow during operation, and subsequently handle these exceptions to avoid interruption of the target workflow. Aspect-Oriented Programming (AOP) is a programming paradigm that uses precompilation and runtime dynamic proxies to achieve unified maintenance of program functionality. The primary purpose of AOP is to separate cross-cutting concerns from business logic to improve code modularity and reusability.
[0092] Specifically, the AOP entry process for workflow entry methods includes: 1. Define entry points: Determine the common characteristics of workflow entry methods, such as whether they all use a specific annotation (such as @WorkflowEntry) or whether their names follow a certain pattern (such as start*). Use AspectJ's expression language (Pointcut Expression) to define entry points, for example: @annotation(com.example.WorkflowEntry) or execution(*com.example.workflow.*.*(..)). 2. Write an Aspect class: Create a Java class and mark it with the @Aspect annotation. Define one or more advices in the class. For example, use @AfterThrowing to capture and handle exceptions. In the @AfterThrowing advice, obtain exception information and context information through the JoinPoint or Throwable parameters. 3. Exception capture and handling: In the method body of the @AfterThrowing advice, write logic to check the exception type or exception information. Based on the exception type or custom logic, decide whether to log, send an alert, or call other exception handling logic.
[0093] Step S202: construct a corresponding first exception message based on the first exception.
[0094] In this embodiment, the process of constructing the corresponding first exception message based on the first exception can refer to the processing process of constructing the corresponding second exception message based on the second exception, and will not be elaborated on here.
[0095] Step S203 : During the working process of the target workflow, a second exception thrown by a node inside the target workflow is captured based on a preset target exception handling statement.
[0096] In this embodiment, Spring Integration, an integration tool, is pre-integrated into the target workflow. Spring Integration is a module of the Spring Framework that provides a rich set of components and templates for building enterprise integration solutions. Spring Integration abstracts messaging specifications and, based on these specifications, provides integration support for a variety of enterprise-level middleware, such as AMQP-based message queues, MQTT, and RMI. The target exception handling statement can specifically use a try-catch block.
[0097] Step S204: construct a corresponding second exception message based on the second exception.
[0098] In this embodiment, the specific implementation process of constructing the corresponding second exception message based on the second exception will be further described in detail in subsequent specific embodiments of the present application and will not be elaborated on here.
[0099] Step S205: Integrate the first exception message and the second exception message to obtain a target exception message corresponding to a target exception; wherein the target exception includes the first exception and the second exception.
[0100] In this embodiment, the target exception message includes the first exception message and the second exception message.
[0101] Step S206: For each target exception, call the target exception handling system corresponding to the target exception.
[0102] In this embodiment, the specific implementation process of calling the target exception handling system corresponding to the target exception for each target exception will be further described in detail in subsequent specific embodiments of the present application and will not be elaborated on here.
[0103] Step S207: Send the target exception message to a designated message channel based on a preset integration tool.
[0104] In this embodiment, the above-mentioned integration tool refers to Spring Integration. Spring Integration uses messages as the carrier of information, and realizes communication and integration between systems by subscribing to and publishing messages. And Spring Integration uses channels to transmit messages, and filters to operate and route messages. By combining them, a complete message flow and processing flow can be constructed. Among them, message channels corresponding to different exception types are pre-built. The message channel is a pipe or medium for transmitting messages (including normal messages and exception messages) in the system. It allows different components or systems to communicate in an asynchronous manner, thereby achieving decoupling and scalability. In frameworks such as Spring Integration, the message channel is the core component of messaging, responsible for transmitting data between workflow nodes, services or applications.
[0105] Specifically, the designated message channel can be obtained by obtaining the designated exception type of the target exception and then filtering out the designated message channel corresponding to the designated exception type from all message channels. Then, the target exception message can be sent to the designated message channel based on the integration tool.
[0106] Step S208: When the target exception handling system receives the target exception message from the message channel, it processes the target exception accordingly based on the target exception message and a preset exception handling strategy.
[0107] In this embodiment, the exception handling system is responsible for receiving, analyzing, and processing exception messages from various nodes in the system. It typically includes a series of exception handling strategies and processes for targeted handling of different types of exceptions. The exception handling system receives exception messages by monitoring specific message channels. Once a message is received, it performs subsequent processing based on the contextual information contained in the message. The exception handling system may include multiple processing stages, such as exception classification, logging, and notifying relevant personnel, all of which rely on the exception messages transmitted through the message channels. Exception handling strategies are a series of rules and procedures within the exception handling system that guide how to handle specific exception types. These strategies may include retry mechanisms, alarm notifications, manual intervention, and other methods.
[0108] Among them, the specific implementation process of the above-mentioned corresponding processing of the target exception based on the target exception message and the preset exception handling strategy will be further described in detail in the subsequent specific embodiments of this application, and will not be elaborated on here.
[0109] This application uses aspect-oriented programming to cut into the workflow entry method to capture the first exception thrown during the workflow operation, and uses integrated tools to capture the corresponding second exception in each node of the workflow, and then handles all exceptions based on the use of the target exception handling system and exception handling strategy, thereby achieving global monitoring and effective handling of exceptions in the workflow, improving the stability and robustness of the workflow, and effectively avoiding workflow interruption due to exceptions, thereby ensuring the smooth progress of the business process.
[0110] In some optional implementations, step S204 includes the following steps:
[0111] Get the preset exception message format.
[0112] In this embodiment, the above-mentioned exception message format is a format for determining what information should be included in the exception message. Specifically, the content of the exception message format may include at least a node ID, an operation type, an exception code, an exception description, and a timestamp. Among them, the node ID refers to: an identifier of a specific part or component of the workflow where the exception occurs. The operation type refers to: the specific operation or action that triggers the exception. The exception code refers to: a code used to uniquely identify the exception type. The exception description refers to: a detailed description of the exception. The timestamp refers to: the time when the exception occurred.
[0113] Specified context information corresponding to the second exception is acquired based on the exception message format.
[0114] In this embodiment, corresponding information of the above-mentioned second exception can be obtained according to the above-mentioned exception message format to obtain the corresponding node ID, operation type, exception code, exception description, timestamp and other information, and all the obtained information can be integrated to obtain the specified context information corresponding to the second exception.
[0115] The specified context information is encapsulated to obtain corresponding encapsulation information.
[0116] In this embodiment, in Spring Integration, Message objects are typically used to transmit information. In this embodiment, a custom Payload class can be created to encapsulate the above-specified context information. Alternatively, a Map can be used as the Payload.
[0117] The encapsulation information is used as the second abnormal message.
[0118] The present application obtains a preset exception message format; then obtains specified context information corresponding to the second exception based on the exception message format; then encapsulates the specified context information to obtain corresponding encapsulated information; and subsequently uses the encapsulated information as the second exception message. The present application obtains specified context information corresponding to the second exception based on a preset exception message format, and then encapsulates the specified context information, thereby enabling rapid and accurate construction of a second exception message corresponding to the second exception, improving the construction efficiency of the second exception message and ensuring the data accuracy of the obtained second exception message.
[0119] In some optional implementations of this embodiment, step S206 includes the following steps:
[0120] For each target exception, obtain the specified exception type of the target exception.
[0121] In this embodiment, the target exception code corresponding to the target exception can be obtained from the target exception message. Since the target exception code is a code for uniquely identifying the exception type of the target exception, the target exception code can be analyzed to obtain the specified exception type of the target exception.
[0122] Call the preset exception handling library.
[0123] In this embodiment, the exception handling library is a pre-built database that stores multiple exception types and exception handling systems corresponding to each exception type.
[0124] A designated exception handling system corresponding to the designated exception type is selected from the exception handling library.
[0125] In this embodiment, the above-mentioned exception handling library can be queried using the above-mentioned specified exception type to first determine the target exception type that matches the specified exception type, and then call out an exception handling system that matches the target exception type from the above-mentioned exception handling library and use it as the above-mentioned target exception handling system.
[0126] The designated exception handling system is used as the target exception handling system.
[0127] For each target exception, this application obtains the specified exception type of the target exception, and then, based on the use of the exception handling library, screens out the specified exception handling system corresponding to the specified exception type and uses it as the corresponding target exception handling system, ensuring the accuracy of calling the target exception handling system. This allows the target exception handling system that matches the exception type of the target exception to be used to handle the target exception, improving the standardization and intelligence of exception handling, ensuring the stability of exception handling, and thus helping to improve the stability and robustness of the workflow.
[0128] In some optional implementations, step S208 includes the following steps:
[0129] A target exception code of the target exception is obtained from the target exception message.
[0130] In this embodiment, information extraction may be performed on the target exception message to obtain a target exception code corresponding to the target exception.
[0131] Call the preset policy mapping table.
[0132] In this embodiment, based on actual exception handling requirements, a policy mapping table is predefined, which maps exception codes to exception handling strategies. This table is used to determine the exception handling strategy to be adopted based on the captured exception code. Specifically, the exception handling strategies in the policy mapping table include, but are not limited to, retry mechanisms, alert notifications, rollback operations, and manual intervention. The retry mechanism includes automatic retry logic for recoverable exceptions that may be caused by temporary network fluctuations, database lock contention, and other factors. During retries, parameters such as the number of retries and the retry interval can be set to avoid system resource exhaustion caused by infinite retries. Alert notifications include the need to immediately notify relevant personnel for handling serious exceptions, such as internal system errors or unavailable external services. This can be achieved through email, SMS, Slack messages, and other methods. Alert notifications should contain sufficient information so that the recipient can quickly understand the problem and respond. Rollback operations include: If an operation in a workflow fails and the operation has an impact on the system state (such as modifying the database or calling an external service), a rollback operation may be required to restore the system to its pre-operation state. This typically involves transaction management to ensure data consistency and integrity. Manual intervention involves marking complex or unautomatically handled exceptions as requiring human intervention and assigning them to appropriate personnel through a workflow management system or task scheduling system. The personnel are then required to analyze and address the exception information and provide feedback on the results.
[0133] A target exception handling policy corresponding to the target exception code is found from the policy mapping table.
[0134] In this embodiment, the above-mentioned policy mapping table can be queried using the above-mentioned target exception code to first determine the specific exception code that matches the target exception code, and then find an exception handling policy that matches the specific exception code from the above-mentioned policy mapping table and use it as the above-mentioned target exception handling policy.
[0135] The target exception handling system executes processing logic corresponding to the target exception handling strategy to perform corresponding processing on the target exception.
[0136] In this embodiment, after the corresponding target exception handling policy is found from the policy mapping table according to the target exception code, the target exception handling system executes the processing logic corresponding to the target exception handling policy to perform corresponding processing for the target exception.
[0137] The present application obtains the target exception code of the target exception from the target exception message, and then finds the target exception handling strategy corresponding to the target exception code based on the use of the strategy mapping table, and then executes the processing logic corresponding to the target exception handling strategy through the target exception handling system to perform corresponding processing for the target exception, thereby realizing automatic and intelligent effective processing of exceptions in the target workflow, improving the stability and robustness of the workflow, and effectively avoiding the interruption of the workflow due to exceptions, thereby ensuring the smooth progress of the business process.
[0138] In some optional implementations, after step S208, the electronic device may further perform the following steps:
[0139] Call the default logging framework.
[0140] In this embodiment, the above-mentioned log framework can specifically adopt a framework such as SLF4J, Logback, etc. The above-mentioned log framework can be used to record relevant log data at key locations of the workflow entry, node processing, and exception handling of the target workflow.
[0141] The target workflow is logged based on the log framework to obtain corresponding log data.
[0142] In this embodiment, the logging framework is used to record detailed log data during workflow entry, node processing, and exception handling in the target workflow. This log data can include key information such as the exception stack trace, occurrence time, operator, and request parameters. This information is crucial for subsequent troubleshooting and performance monitoring.
[0143] Call the preset log storage system.
[0144] In this embodiment, the log storage system is a pre-built system for storing logs of the target workflow. Specifically, the log storage system can be a general-purpose storage system. Specifically, the storage system can be installed according to the relevant official documentation and configured with the storage system's indexing policy, data retention policy, and other settings to ensure that the logging framework can successfully send log data to the storage system.
[0145] The log data is stored in the log storage system.
[0146] In this embodiment, the specific implementation process of storing the log data in the log storage system will be further described in detail in subsequent specific embodiments of the present application and will not be elaborated on here.
[0147] The present application calls a preset log framework; then logs the target workflow based on the log framework to obtain corresponding log data; then calls a preset log storage system; and subsequently stores the log data in the log storage system. During the operation of the target workflow, the present application also intelligently logs the target workflow based on the use of the log framework to obtain log data, which helps to perform subsequent problem troubleshooting and performance monitoring based on the obtained log data. In addition, the log data will also be stored based on the use of the log storage system, thereby ensuring the data security of the log data.
[0148] In some optional implementations of this embodiment, storing the log data in the log storage system includes the following steps:
[0149] Invokes a preset level setting strategy.
[0150] In this embodiment, a log level setting strategy is formulated in advance based on processing requirements and actual conditions. Specifically, the policy content of the level setting strategy may include: in a development environment, in order to facilitate debugging, the log level is set to DEBUG or INFO so as to capture as much program running information as possible. In a test environment, the log level is adjusted according to the purpose and scope of the test. For example, when performing performance testing, you may only need to pay attention to logs at the ERROR and WARN levels; when performing functional testing, you may need to set the log level to INFO or lower. In a production environment, in order to reduce the impact on system performance and avoid exposing sensitive information, the log level is set to WARN or ERROR. In this way, logs are only recorded when serious problems occur in the program, making it easier for operation and maintenance personnel to quickly locate the problem.
[0151] Perform log level setting processing on the log data based on the level setting policy to obtain corresponding first log data.
[0152] In this embodiment, the log data is processed for log level setting based on the policy content of the aforementioned level setting policy. Different log levels (e.g., DEBUG, INFO, WARN, and ERROR) are set according to the importance of the log, enabling quick troubleshooting and identification of the problem. DEBUG is used to record detailed debugging information during program execution, typically including detailed information such as variable values and method calls. This information is very useful for developers debugging programs during development, but may generate a large amount of unnecessary logs in a production environment. INFO records important information during program execution, such as the execution of business logic and calls to external systems. This information is helpful for understanding the program's operating status and business processes. WARN records problems or potential risks that may arise during program execution, but these problems generally do not cause the program to cease operation immediately. Warning messages are used to alert developers or operations and maintenance personnel that measures may need to be taken to prevent more serious problems. ERROR records errors and exceptions that occur during program execution. This information is crucial for quickly locating and resolving program problems.
[0153] Perform log level adjustment processing on the first log data to obtain corresponding second log data.
[0154] In the present embodiment, after configuring the log level of the log data and obtaining the first log data, by running the program and observing the log output, it is verified whether the setting of the log level meets expectations. Specifically, by simulating different scenarios (such as normal operation, abnormal operation, etc.) to check whether the log output meets the requirements. And then according to the inspection results and demand changes, continuously optimize and adjust the setting of the log level of the first log data to obtain the corresponding second log data. Exemplary, when it is found that some log levels are set too high and the log volume is too large, the log level can be appropriately lowered; when it is found that some key information is not recorded, the log level of the relevant component or class can be increased.
[0155] The second log data is stored in the log storage system.
[0156] In this embodiment, a log folder dedicated to storing log data of the target workflow may be generated in the log storage system, and then the second log data may be stored in the log folder in the log storage system.
[0157] This application calls a preset level setting strategy; then performs log level setting processing on the log data based on the level setting strategy to obtain corresponding first log data; then performs log level adjustment processing on the first log data to obtain corresponding second log data; and subsequently stores the second log data in the log storage system. After the target workflow is logged based on the log framework to obtain log data, this application will also intelligently set different log levels for the log data based on the use of the level setting strategy, so that the problem can be quickly located when troubleshooting, providing intelligence for log storage. In addition, the log data will be further processed for log level adjustment, so that it can effectively adapt to the actual needs of log storage.
[0158] In some optional implementations of this embodiment, the electronic device may further perform the following steps:
[0159] A performance indicator type corresponding to the target workflow is determined.
[0160] In this embodiment, there is no specific limitation on the selection of the above monitoring indicator types, which can be set according to actual monitoring needs. For example, they can include CPU usage indicators, memory usage indicators, workflow running time indicators, etc.
[0161] Call the preset monitoring tool.
[0162] In this embodiment, the monitoring tool can be a general-purpose monitoring tool. Install the monitoring tool based on the official documentation. Then, edit the monitoring tool's configuration file and add a capture configuration that uses the target workflow as the monitoring target. Then, start the monitoring tool's monitoring service to ensure it regularly captures and stores monitoring data.
[0163] Based on the performance indicator type, the monitoring tool is used to collect specified performance indicator data corresponding to the target workflow.
[0164] In this embodiment, the monitoring tool can be used to collect specified performance indicator data corresponding to the above performance indicator types during the operation of the target workflow, such as CPU usage, memory usage, workflow running time, etc.
[0165] The specified performance indicator data is analyzed based on preset alarm rules to determine whether there is abnormal indicator data in the specified performance indicator data.
[0166] In this embodiment, alarm conditions such as excessive CPU usage, insufficient memory, and excessive workflow runtime are defined by programming alarm rules in the monitoring tool. These alarm rules are then loaded into the monitoring tool to ensure that the monitoring tool can evaluate the monitored performance metrics according to these alarm rules and trigger alarms. The aforementioned abnormal metric data refers to abnormal data that meets the alarm conditions, such as CPU usage exceeding a CPU usage threshold, memory usage exceeding a memory usage threshold, and workflow runtime exceeding a workflow runtime threshold.
[0167] If so, the abnormal indicator data is filtered out from the specified performance indicator data, and a corresponding abnormal alarm notification is generated based on the abnormal indicator data.
[0168] In this embodiment, the above-mentioned abnormal indicator data can be filled into a preset abnormal alarm notification template to generate a corresponding abnormal alarm notification. The above-mentioned abnormal alarm notification template is an information template constructed based on the alarm notification requirements of the actual workflow when abnormal indicators exist. The content of the information template can be written according to actual needs.
[0169] The abnormal alarm notification is sent to the corresponding operation and maintenance personnel.
[0170] In this embodiment, an alarm receiver is configured in the monitoring tool, and the method and recipient for receiving alarms are set. This alarm receiver can be a general-purpose alarm receiver, and the receiving method can be email, SMS, or a user interface display. The recipient can be an operations and maintenance personnel. Furthermore, alarm processing is tested by simulating or triggering known conditions to ensure that alarms are correctly sent and notified to the relevant personnel.
[0171] The present application determines the performance indicator type corresponding to the target workflow; then calls a preset monitoring tool; then based on the performance indicator type, uses the monitoring tool to collect the specified performance indicator data corresponding to the target workflow; subsequently, based on the preset alarm rules, performs data analysis on the specified performance indicator data to determine whether there is abnormal indicator data in the specified performance indicator data; if so, filters out the abnormal indicator data from the specified performance indicator data, and generates a corresponding abnormal alarm notification based on the abnormal indicator data; finally, sends the abnormal alarm notification to the corresponding operation and maintenance personnel. The present application can achieve comprehensive monitoring and abnormal alarm of the behavior of the target workflow during the operation of the target workflow, and intelligently monitors the performance of the target workflow based on the use of monitoring tools, and when it is detected that there is abnormal indicator data in the specified performance indicator data of the collected target workflow, it will promptly and intelligently generate a corresponding abnormal alarm notification based on the abnormal indicator data and send it to the corresponding operation and maintenance personnel, so that the operation and maintenance personnel can promptly deal with the current problems of the target workflow by checking the abnormal alarm notification, thereby helping to ensure the stable operation of the target workflow.
[0172] In some optional implementations, the user information obtained is obtained with the user's consent and complies with relevant laws and policies.
[0173] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0174] It should be emphasized that in order to further ensure the privacy and security of the above-mentioned target exception message, the above-mentioned target exception message can also be stored in a node of a blockchain.
[0175] The blockchain referred to in this application is a new application model for computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Blockchain is essentially a decentralized database, a series of data blocks generated using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of this information (to prevent counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, the platform product service layer, and the application service layer.
[0176] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.
[0177] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware via computer-readable instructions. The computer-readable instructions can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes in the above-described method embodiments. The aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
[0178] It should be understood that although the steps in the flowcharts of the accompanying drawings are shown in sequence as indicated by the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some of the steps in the flowcharts of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0179] Further references Figure 3 , as a response to the above Figure 2 The present application provides an embodiment of a workflow exception handling device, which is similar to the embodiment of the present invention. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0180] like Figure 3 As shown, the workflow exception handling device 300 of this embodiment includes: a first capture module 301, a first construction module 302, a second capture module 303, a second construction module 304, an integration module 305, a first calling module 306, a first sending module 307 and a processing module 308. Among them:
[0181] A first capture module 301 is configured to capture, when a target workflow is started, a first exception thrown by a target workflow entry method through a target notification predefined in aspect-oriented programming; wherein the target workflow entry method is a workflow entry method corresponding to the target workflow;
[0182] A first constructing module 302 is configured to construct a corresponding first exception message based on the first exception;
[0183] A second capturing module 303 is configured to capture a second exception thrown by a node within the target workflow based on a preset target exception handling statement during the working process of the target workflow;
[0184] A second constructing module 304 is configured to construct a corresponding second exception message based on the second exception;
[0185] An integration module 305 is configured to integrate the first exception message and the second exception message to obtain a target exception message corresponding to a target exception; wherein the target exception includes the first exception and the second exception;
[0186] A first calling module 306 is configured to call a target exception handling system corresponding to each target exception for each target exception;
[0187] A first sending module 307 is configured to send the target exception message to a designated message channel based on a preset integration tool;
[0188] The processing module 308 is configured to process the target exception based on the target exception message and a preset exception handling strategy when the target exception handling system receives the target exception message from the message channel.
[0189] In some optional implementations of this embodiment, the second building module 304 includes:
[0190] The first acquisition submodule is used to obtain a preset exception message format;
[0191] A second acquisition submodule, configured to acquire specified context information corresponding to the second exception based on the exception message format;
[0192] The encapsulation submodule is used to encapsulate the specified context information to obtain corresponding encapsulation information;
[0193] The first determining submodule is configured to use the encapsulation information as the second abnormal message.
[0194] In some optional implementations of this embodiment, the first calling module 306 includes:
[0195] A third acquisition submodule is configured to acquire, for each target exception, a specified exception type of the target exception;
[0196] The first calling submodule is used to call a preset exception handling library;
[0197] A screening submodule, configured to screen out a specified exception handling system corresponding to the specified exception type from the exception handling library;
[0198] The second determining submodule is configured to use the designated exception handling system as the target exception handling system.
[0199] In some optional implementations of this embodiment, the processing module 308 includes:
[0200] A fourth acquisition submodule, configured to acquire a target exception code of the target exception from the target exception message;
[0201] The second calling submodule is used to call the preset strategy mapping table;
[0202] A search submodule, configured to search a target exception handling policy corresponding to the target exception code from a policy mapping table;
[0203] The execution submodule is used to execute the processing logic corresponding to the target exception handling strategy through the target exception handling system to perform corresponding processing for the target exception.
[0204] In some optional implementations of this embodiment, the workflow exception handling device further includes:
[0205] The second calling module is used to call the preset log framework;
[0206] A logging module, configured to log the target workflow based on the logging framework to obtain corresponding log data;
[0207] The third calling module is used to call the preset log storage system;
[0208] The storage module is used to store the log data in the log storage system.
[0209] In some optional implementations of this embodiment, the storage module includes:
[0210] The second calling submodule is used to call the preset level setting strategy;
[0211] A setting submodule, configured to perform log level setting processing on the log data based on the level setting strategy to obtain corresponding first log data;
[0212] an adjustment submodule, configured to perform log level adjustment processing on the first log data to obtain corresponding second log data;
[0213] The storage submodule is used to store the second log data in the log storage system.
[0214] In some optional implementations of this embodiment, the workflow exception handling device further includes:
[0215] A determination module, configured to determine a performance indicator type corresponding to the target workflow;
[0216] The fourth calling module is used to call the preset monitoring tool;
[0217] A collection module, configured to use the monitoring tool to collect specified performance indicator data corresponding to the target workflow based on the performance indicator type;
[0218] An analysis module is used to analyze the specified performance indicator data based on preset alarm rules to determine whether there is abnormal indicator data in the specified performance indicator data;
[0219] a screening module, configured to, if yes, screen out the abnormal indicator data from the specified performance indicator data, and generate a corresponding abnormal alarm notification based on the abnormal indicator data;
[0220] The second sending module is used to send the abnormal alarm notification to the corresponding operation and maintenance personnel.
[0221] To solve the above technical problems, the present application also provides a computer device. Figure 4 , Figure 4 This is a basic structural block diagram of the computer device in this embodiment.
[0222] The computer device 4 includes a memory 41, a processor 42, and a network interface 43 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 4 with components 41-43, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits (ASICs), programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.
[0223] The computer device may be a desktop computer, notebook computer, PDA, cloud server, etc. The computer device may interact with the user via a keyboard, mouse, remote control, touchpad, or voice control device.
[0224] The memory 41 includes at least one type of readable storage medium, including flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic storage, a magnetic disk, an optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as the hard disk or memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 4. Of course, the memory 41 may also include both the internal storage unit of the computer device 4 and its external storage device. In this embodiment, the memory 41 is generally used to store the operating system and various application software installed on the computer device 4, such as computer-readable instructions for the workflow exception handling method. In addition, the memory 41 can also be used to temporarily store various types of data that have been output or are to be output.
[0225] In some embodiments, the processor 42 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to execute computer-readable instructions or process data stored in the memory 41, such as computer-readable instructions for executing the workflow exception handling method.
[0226] The network interface 43 may include a wireless network interface or a wired network interface. The network interface 43 is generally used to establish a communication connection between the computer device 4 and other electronic devices.
[0227] The present application also provides another embodiment, namely, providing a computer-readable storage medium, which stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to enable the at least one processor to perform the steps of the workflow exception handling method as described above.
[0228] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present application.
[0229] Obviously, the embodiments described above are only some of the embodiments of the present application, rather than all of the embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions described in the aforementioned specific embodiments, or to make equivalent replacements for some of the technical features therein. Any equivalent structure made using the contents of the present application specification and the accompanying drawings, directly or indirectly used in other related technical fields, is also within the scope of patent protection of the present application.
Claims
1. A workflow exception handling method, characterized in that: The steps include: When the target workflow is started, the first exception thrown by the target workflow entry method is captured through the target notification predefined in aspect-oriented programming; wherein the target workflow entry method is the workflow entry method corresponding to the target workflow; Constructing a corresponding first exception message based on the first exception; During the working process of the target workflow, capturing a second exception thrown by a node within the target workflow based on a preset target exception handling statement; Constructing a corresponding second exception message based on the second exception; Integrating the first exception message and the second exception message to obtain a target exception message corresponding to a target exception; wherein the target exception includes the first exception and the second exception; For each target exception, calling a target exception handling system corresponding to the target exception; Sending the target exception message to a designated message channel based on a preset integration tool; When the target exception handling system receives the target exception message from the message channel, it processes the target exception accordingly based on the target exception message and a preset exception handling strategy.
2. The workflow exception handling method according to claim 1, characterized in that: The step of constructing a corresponding second exception message based on the second exception specifically includes: Get the preset exception message format; Acquire specified context information corresponding to the second exception based on the exception message format; Encapsulating the specified context information to obtain corresponding encapsulation information; The encapsulation information is used as the second abnormal message.
3. The workflow exception handling method according to claim 1, characterized in that: The step of calling a target exception handling system corresponding to each target exception specifically includes: For each target exception, obtain a specified exception type of the target exception; Call the preset exception handling library; Filtering out a designated exception handling system corresponding to the designated exception type from the exception handling library; The designated exception handling system is used as the target exception handling system.
4. The workflow exception handling method according to claim 1, characterized in that: The step of processing the target exception accordingly based on the target exception message and the preset exception handling strategy specifically includes: Obtaining a target exception code of the target exception from the target exception message; Call the preset strategy mapping table; Find the target exception handling policy corresponding to the target exception code from the policy mapping table; The target exception handling system executes processing logic corresponding to the target exception handling strategy to perform corresponding processing on the target exception.
5. The workflow exception handling method according to claim 1, characterized in that: After the step of processing the target exception accordingly based on the target exception message and the preset exception handling strategy, the method further includes: Call the preset logging framework; Performing log recording on the target workflow based on the log framework to obtain corresponding log data; Call the preset log storage system; The log data is stored in the log storage system.
6. The workflow exception handling method according to claim 5, characterized in that: The step of storing the log data in the log storage system specifically includes: Call the preset level setting strategy; Performing log level setting processing on the log data based on the level setting policy to obtain corresponding first log data; Performing log level adjustment processing on the first log data to obtain corresponding second log data; The second log data is stored in the log storage system.
7. The workflow exception handling method according to claim 1, characterized in that: The workflow exception handling method further includes: Determining a performance indicator type corresponding to the target workflow; Call the preset monitoring tool; Based on the performance indicator type, using the monitoring tool to collect specified performance indicator data corresponding to the target workflow; Performing data analysis on the specified performance indicator data based on preset alarm rules to determine whether there is abnormal indicator data in the specified performance indicator data; If so, filtering out the abnormal indicator data from the specified performance indicator data, and generating a corresponding abnormal alarm notification based on the abnormal indicator data; The abnormal alarm notification is sent to the corresponding operation and maintenance personnel.
8. A workflow exception handling device, characterized in that: include: A first capture module is configured to capture, when a target workflow is started, a first exception thrown by a target workflow entry method through a target notification predefined in aspect-oriented programming; wherein the target workflow entry method is a workflow entry method corresponding to the target workflow; A first construction module, configured to construct a corresponding first exception message based on the first exception; A second capturing module is configured to capture, during the working process of the target workflow, a second exception thrown by a node within the target workflow based on a preset target exception handling statement; A second building module, configured to build a corresponding second exception message based on the second exception; an integration module, configured to integrate the first exception message and the second exception message to obtain a target exception message corresponding to a target exception; wherein the target exception includes the first exception and the second exception; A first calling module is configured to call a target exception handling system corresponding to each target exception for each target exception; A first sending module is used to send the target exception message to a designated message channel based on a preset integration tool; The processing module is used to process the target exception based on the target exception message and a preset exception processing strategy when the target exception processing system receives the target exception message from the message channel.
9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores computer-readable instructions, and the processor implements the steps of the workflow exception handling method according to any one of claims 1 to 7 when executing the computer-readable instructions.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the workflow exception handling method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Workflow exception handing method and system
CN102043682A
Business process monitoring methods, devices, computer equipment, and storage media
CN114936136A