Workflow abnormal rollback flow control processing method
By predefined business parameters and exception code rules in the workflow and configuring rollback nodes, the problem of unclear workflow exception handling in the existing technology is solved, and a clearer exception rollback relationship representation and control flow execution status is achieved.
Patent Information
- Application Number
- CN202411833968.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-03-21
AI Technical Summary
When handling workflow exceptions, the prior art lacks clear exception rollback relationship representation and control execution status, resulting in unclear relationship between process tasks and exception handling and uncertain input context.
By extracting identification rules for predefined business parameters and exception code, configure workflow and process nodes, set up rollback nodes, and determine whether rollback is needed based on the exception code when executing the workflow, and perform corresponding rollback operations.
The process control and exception identification compensation for rollback exception classes are realized, and the exception rollback relationship and workflow control execution status are clearly represented, ensuring that the pre-execution node of each rollback node is clear and the node input parameters are deterministic.
Smart Images

Figure CN119668789A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a workflow engine processing method, and in particular to a workflow abnormality rollback process control processing method. Background Art
[0002] In scenarios where the workflow engine processes task scheduling and business capability orchestration between distributed systems, when encountering factors such as parallel jobs and resource preemption, the process instance operation may be abnormal. Such abnormalities can be divided into the following categories: system or environment failures that can be retried and compensated, business failures that require rollback, and unknown abnormalities.
[0003] Currently, in the field of workflow, the main method for handling exceptions is to monitor the exception codes and arrange the compensation processes corresponding to each exception code after the exception occurs. This exception handling method makes the relationship between process tasks and exception handling unclear, has poor readability, and has uncertainty in the input context. Summary of the invention
[0004] The present invention provides a workflow exception rollback process control processing method, which solves the process control and exception identification compensation problems for rollback exception classes, and expresses the exception rollback relationship and workflow control execution status in a clearer way. The technical solution is as follows:
[0005] A workflow abnormal rollback process control processing method comprises the following steps:
[0006] S1: predefine business parameters that can be used for process node execution, and set abnormal code extraction and identification rules for execution results;
[0007] S2: Configure workflow and process nodes. The process nodes used by the workflow include sequence, branch, and loop types. For process nodes that can be rolled back, a rollback node is set.
[0008] S3: Execute the workflow. When an exception occurs in the execution of the process node, determine whether a rollback operation is required based on the exception code;
[0009] S4: The exception code is judged according to the preset rules that the system business cannot be completed, and the process node performs a rollback operation.
[0010] Furthermore, in step S1, setting the rules for the fault code includes the following steps:
[0011] S101: define the exception code of the system business execution result and set the value rule of the exception code return value;
[0012] S102: Marking a set of exception codes that cannot be achieved by system services, so as to identify whether a process rollback needs to be performed according to the exception codes.
[0013] The process nodes are divided into start nodes, end nodes, task nodes, branch nodes and rollback start nodes. The start node represents the initial node of the workflow; the end node represents the termination node of the workflow; the task node represents the node that triggers the system business action executed sequentially from the start node to the end node; the branch node represents the execution condition of the successor node; the rollback start node is associated with the task node by a red dotted line, indicating the start node of the rollback compensation sub-process for the side effects of the task node.
[0014] Furthermore, in step S2, the workflow and process nodes are configured, the process nodes used by the workflow include sequence, branch, and loop types, and a rollback node is set for the process node that can be rolled back, including the following steps:
[0015] S201: Configure a workflow for executing system services, configure multiple process nodes that the workflow needs to use, the process nodes include sequence, branch, and loop types, add task nodes for executing system services one by one, and select predefined system tasks;
[0016] S202: If the current task node is a node T1 that can be abnormally rolled back, a rollback start node T1-R-1 may be added to the task node T1, wherein a red dotted line is used between the task node T1 and the rollback start node T1-R-1 to indicate that T1-R-1 is the rollback start node of T1;
[0017] S203: The rollback starting node T1-R-1 may select other predefined rollback processing tasks as needed. When the task node T1 needs to be rolled back, the rollback starting node T1-R-1 starts working and executes the rollback processing task.
[0018] S204: If the rollback start node T1-R-1 is not sufficient to rollback the result generated by the task node T1, a rollback node T1-R-2 may be added, wherein the rollback nodes are connected by red solid lines;
[0019] S205: If T1-R-2 still does not satisfy the rollback of T1, the same logic can be applied to continue adding new rollback nodes, that is, the rollback process of task node T1 can be a complex sub-process.
[0020] The method further includes step S206: for a branch or loop type task node, setting of its rollback node, and defining the rollback node of the task node according to the operation of step S203.
[0021] Furthermore, step S3 includes the following steps:
[0022] S301: Determine whether the exception is an unknown exception type. Except for system exceptions and exception codes that clearly indicate that system services cannot be fulfilled, other exception types are considered unknown exceptions.
[0023] S302: For unknown exceptions and non-rollback exceptions, the default execution process retry compensation strategy is implemented;
[0024] S303: During the process retry, determine whether there is an unknown exception. If so, terminate the process and wait for manual intervention;
[0025] S304: If a rollback exception is identified according to the exception code, a process rollback operation is triggered.
[0026] Furthermore, in step S4, the generated exception is an exception that needs to be rolled back when the system service cannot be achieved, and the process node performs a rollback operation, including the following operations:
[0027] S401: For the normal nodes that have been executed, the rollback is performed according to the rollback start node associated with the red dotted line and the rollback node path;
[0028] S402: When there are multiple rollback paths for task nodes, the rollback sub-process is executed in reverse order according to the node execution order by default, and the previous rollback sub-process is executed after each rollback sub-process is executed;
[0029] S403: The execution order of the rollback sub-paths can also be arranged by setting a priority for the rollback start node;
[0030] S404: For abnormal execution of the rollback sub-process, the rollback task node is compensated by rollback retry by default, and the final failure to rollback is recorded as rollback failure and waits for manual intervention;
[0031] S405: For the task nodes that are executed cyclically, the rollback start node is triggered only once. It is expected that one compensation can roll back the results generated in this batch. If it cannot be completed in one go, a loop structure can also be added to the rollback sub-process.
[0032] The task nodes and rollback nodes for processing business should be idempotent to achieve the same effect of executing an operation once or multiple times.
[0033] The workflow abnormal rollback process control processing method realizes the workflow abnormal rollback representation method and control flow execution method. The workflow flowchart can more clearly represent the relationship between task nodes and abnormal rollbacks, and the preceding execution node of each rollback node is clear, and the node input parameters are deterministic. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1It is a flowchart of an embodiment of the workflow abnormal rollback process control processing method. DETAILED DESCRIPTION
[0035] The workflow abnormal rollback process control processing method comprises the following steps:
[0036] S1: predefine business parameters that can be used for process node execution, and set abnormal code extraction and identification rules for execution results;
[0037] The process nodes are divided into start nodes, end nodes, task nodes, branch nodes and rollback start nodes. The start node represents the initial node of the workflow; the end node represents the termination node of the workflow; the task node represents the node that triggers the system business action executed sequentially from the start node to the end node; the branch node represents the execution condition of the successor node; the rollback start node is associated with the task node by a red dotted line, indicating the start node of the rollback compensation sub-process for the side effects of the task node.
[0038] The execution parameters of the system business are the execution parameters list used by the task node when the system business is executed through the process task node. The parameter structure used to meet the business trigger is generated according to the parameter relationship configured in the parameter list. After the task node is executed, the returned parameter content will be parsed for exception code extraction and parameter source context of the subsequent node.
[0039] The rules for setting exception codes include the following steps:
[0040] S101: define the exception code of the system business execution result and set the value rule of the exception code return value;
[0041] The system business is executed through the process task node. When an error or failure occurs, it can be divided into the following categories according to the returned exception: system or environment failure can be retried and compensated, business cannot be completed and needs to be rolled back, and unknown exception class. These can be extracted based on task node exception handling or system business return value analysis to obtain exception codes.
[0042] S102: Marking a set of exception codes that cannot be achieved by the system business, so as to identify whether a process rollback needs to be performed according to the exception code;
[0043] According to the exception code extracted from the task node exception handling of the system business or the system business return value analysis, it is determined from the corresponding code set whether a rollback is required. If the system business is a business failure and cannot be completed type exception, a rollback is performed. If the system business is completed, no rollback is performed.
[0044] S2: Configure workflow and process nodes. The process nodes used by the workflow include sequence, branch, and loop types. For process nodes that can be rolled back, a rollback node is set.
[0045] Specifically, the following steps are included:
[0046] S201: Configure a workflow for executing system services, configure multiple process nodes that the workflow needs to use, the process nodes include sequence, branch, and loop types, add task nodes for executing system services one by one, and select predefined system tasks;
[0047] S202: If the current task node is a node T1 that can be abnormally rolled back, a rollback start node T1-R-1 may be added to the task node T1, wherein a red dotted line is used between the task node T1 and the rollback start node T1-R-1 to indicate that T1-R-1 is the rollback start node of T1;
[0048] S203: The rollback starting node T1-R-1 may select other predefined rollback processing tasks as needed. When the task node T1 needs to be rolled back, the rollback starting node T1-R-1 starts working and executes the rollback processing task.
[0049] S204: If the rollback start node T1-R-1 is not sufficient to rollback the result generated by the task node T1, a rollback node T1-R-2 may be added, wherein the rollback nodes are connected by red solid lines;
[0050] S205: If T1-R-2 still does not satisfy the rollback of T1, the same procedure can be followed to continue adding new rollback nodes, that is, the rollback process of task node T1 can be a complex sub-process;
[0051] S206: For a branch or loop type task node, the rollback node is set by defining the rollback node of the task node according to the operation of step S203.
[0052] S3: Execute the workflow. When the process node encounters an exception, determine whether a rollback operation is required. Specifically, the following steps are included:
[0053] S301: Determine whether the exception is an unknown exception type. Except for system exceptions and exception codes that clearly indicate that system services cannot be fulfilled, other exception types are considered unknown exceptions.
[0054] S302: For unknown exceptions and non-rollback exceptions, the default execution process retry compensation strategy is implemented;
[0055] S303: During the process retry, determine whether there is an unknown exception. If so, terminate the process and wait for manual intervention;
[0056] S304: If a rollback exception is identified according to the exception code, a process rollback operation is triggered.
[0057] S4: The generated exception is an exception that needs to be rolled back when the system business cannot be achieved. The process node performs a rollback operation, including the following operation methods:
[0058] S401: For the normal nodes that have been executed, the rollback is performed according to the rollback start node associated with the red dotted line and the rollback node path;
[0059] S402: When there are multiple rollback paths for task nodes, the rollback sub-process is executed in reverse order according to the node execution order by default, and the previous rollback sub-process is executed after each rollback sub-process is executed;
[0060] S403: The execution order of the rollback sub-paths can also be arranged by setting a priority for the rollback start node;
[0061] S404: For abnormal execution of the rollback sub-process, the rollback task node is compensated by rollback retry by default, and the final failure to rollback is recorded as rollback failure and waits for manual intervention;
[0062] S405: For the task nodes that are executed cyclically, the rollback start node is triggered only once. It is expected that one compensation can roll back the results generated in this batch. If it cannot be completed in one go, a loop structure can also be added to the rollback sub-process.
[0063] Furthermore, in order to meet the requirements of retryable compensation, both task nodes and abnormal rollback nodes should be idempotent, so that the effect of executing an operation once or multiple times is the same.
[0064] like Figure 1 In the embodiment shown, the process of workflow execution is as follows:
[0065] S501: receiving a scheduling signal from the system and starting to run the workflow process;
[0066] S502: Task node T1 is executed successfully, task node T1 has a rollback start node T1-R-1, and rollback start node T1-R-1 has a next-level rollback node T1-R-2;
[0067] S503: Execute branch 1, execute task node T2, task node T2 has a rollback start node T2-R-1; execute task node T5, task node T5 has no rollback node;
[0068] S504: Execute branch 2. Task node T3 is abnormal and needs to be rolled back. The rollback start node T3-R-1 of task node T3 is executed to roll back task node T3.
[0069] S507: Execute the rollback start node T2-R-1 of task node T2, execute the rollback start node T1-R-1 of task node T1, and continue to execute the rollback node T1-R-2 to roll back the result of node T1.
[0070] It can be seen that the relationship of the rollback state is realized by setting the rollback node.
[0071] The workflow abnormal rollback process control processing method realizes the workflow abnormal rollback representation method and the control flow execution method. The workflow flowchart can more clearly represent the relationship between the task node and the abnormal rollback, and the preceding execution node of each rollback node is clear, and the node input is deterministic.
Claims
1. A workflow abnormal rollback process control processing method, characterized in that: The following steps are involved: S1: predefine business parameters that can be used for process node execution, and set abnormal code extraction and identification rules for execution results; S2: Configure workflow and process nodes. The process nodes used by the workflow include sequence, branch, and loop types. For process nodes that can be rolled back, a rollback node is set. S3: Execute the workflow. When an exception occurs in the execution of the process node, determine whether a rollback operation is required based on the exception code; S4: The exception code is judged according to the preset rules that the system business cannot be completed, and the process node performs a rollback operation.
2. The workflow abnormal rollback process control processing method according to claim 1 is characterized by: In step S1, the rules for setting the fault code include the following steps: S101: define the exception code of the system business execution result and set the value rule of the exception code return value; S102: Marking a set of exception codes that cannot be achieved by system services, so as to identify whether a process rollback needs to be performed according to the exception codes.
3. The workflow abnormal rollback process control processing method according to claim 1 is characterized by: The process nodes are divided into start nodes, end nodes, task nodes, branch nodes and rollback start nodes. The start node represents the initial node of the workflow; the end node represents the termination node of the workflow; the task node represents the node that triggers the system business action executed sequentially from the start node to the end node; the branch node represents the execution condition of the successor node; the rollback start node is associated with the task node by a red dotted line, indicating the start node of the rollback compensation sub-process for the side effects of the task node.
4. The workflow abnormal rollback process control processing method according to claim 1 is characterized by: In step S2, the workflow and process nodes are configured. The process nodes used by the workflow include sequence, branch, and loop types. A rollback node is set for a process node that can be rolled back, including the following steps: S201: Configure a workflow for executing system services, configure multiple process nodes that the workflow needs to use, the process nodes include sequence, branch, and loop types, add task nodes for executing system services one by one, and select predefined system tasks; S202: If the current task node is a node T1 that can be abnormally rolled back, a rollback start node T1-R-1 may be added to the task node T1, wherein a red dotted line is used between the task node T1 and the rollback start node T1-R-1 to indicate that T1-R-1 is the rollback start node of T1; S203: The rollback starting node T1-R-1 may select other predefined rollback processing tasks as needed. When the task node T1 needs to be rolled back, the rollback starting node T1-R-1 starts working and executes the rollback processing task. S204: If the rollback start node T1-R-1 is not sufficient to rollback the result generated by the task node T1, a rollback node T1-R-2 may be added, wherein the rollback nodes are connected by red solid lines; S205: If T1-R-2 still does not satisfy the rollback of T1, the same logic can be applied to continue adding new rollback nodes, that is, the rollback process of task node T1 can be a complex sub-process.
5. The workflow abnormal rollback process control processing method according to claim 4 is characterized in that: The method further includes step S206: for a branch or loop type task node, setting of its rollback node, and defining the rollback node of the task node according to the operation of step S203.
6. The workflow abnormal rollback process control processing method according to claim 1 is characterized by: Step S3 includes the following steps: S301: Determine whether the exception is an unknown exception type. Except for system exceptions and exception codes that clearly indicate that system services cannot be fulfilled, other exception types are considered unknown exceptions. S302: For unknown exceptions and non-rollback exceptions, the default execution process retry compensation strategy is implemented; S303: During the process retry, determine whether there is an unknown exception. If so, terminate the process and wait for manual intervention; S304: If a rollback exception is identified according to the exception code, a process rollback operation is triggered.
7. The workflow abnormal rollback process control processing method according to claim 1 is characterized by: In step S4, the generated exception is an exception that needs to be rolled back when the system business cannot be achieved. The process node performs a rollback operation, including the following operations: S401: For the normal nodes that have been executed, the rollback is performed according to the rollback start node associated with the red dotted line and the rollback node path; S402: When there are multiple rollback paths for task nodes, the rollback sub-process is executed in reverse order according to the node execution order by default, and the previous rollback sub-process is executed after each rollback sub-process is executed; S403: The execution order of the rollback sub-paths can also be arranged by setting a priority for the rollback start node; S404: For abnormal execution of the rollback sub-process, the rollback task node is compensated by rollback retry by default, and the final failure to rollback is recorded as rollback failure and waits for manual intervention; S405: For the task nodes that are executed cyclically, the rollback start node is triggered only once. It is expected that one compensation can roll back the results generated in this batch. If it cannot be completed in one go, a loop structure can also be added to the rollback sub-process.
8. The workflow abnormal rollback process control processing method according to claim 1 is characterized by: The task nodes and rollback nodes for processing business should be idempotent to achieve the same effect of executing an operation once or multiple times.