Workflow execution method, device and equipment based on edge driving and computer program
By creating node instance and edge instance tables in the workflow engine database, the problem of difficult workflow path tracing in existing technologies is solved, achieving stronger workflow path tracing and more flexible workflow progress management.
Patent Information
- Application Number
- CN202511793438.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-01
- Publication Date
- 2026-02-03
AI Technical Summary
Existing workflow engines struggle to accurately track workflow paths when dealing with workflows with complex topologies, especially in cases of complex branches, parallel convergence, conditional transitions, and manual rollbacks.
The workflow execution method is based on edge-driven approach. By creating node instance and edge instance tables in the workflow engine database, the workflow flow information is recorded, providing stronger workflow tracking capabilities.
It improves the ability to track workflow paths, reduces the learning cost and usage threshold for users, supports more flexible workflow progress transfer conditions, and enhances the practicality of workflows.
Smart Images

Figure CN121458014A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the software technical field, and particularly relates to a work flow execution method and device based on edge driving, computer equipment and computer program product. BACKGROUND
[0002] A work flow is an abstract and general description of a business rule between a work flow and each operation step. For example, an e-commerce refund business involves three roles of a user, an e-commerce platform and a store, and may also involve roles of a customer service and a finance in the platform. Such a complex process is difficult to describe clearly by using words. However, by means of business pipelining, a complex processing logic can be well described as a work flow which is divided into several steps.
[0003] With the improvement of the degree of business digitization, it is necessary to make electronic devices better cooperate with business personnel to design and implement a work flow. In order to adapt to the changing actual business needs, a work flow engine emerges as the times require. The work flow engine can accept structured work flow data input and convert it into a work business process running on an electronic device.
[0004] However, the current design of the work flow engine is based on a node as the core, that is, the next step is determined according to the state change of the current node in the work flow. Specifically, the existing work flow engine maintains a work flow instance for each work flow, and identifies which step the work flow has reached by constantly modifying the current node field and the state field of the instance. Whenever the work flow progresses, the node definition needs to be queried to determine the next activated node. This processing mechanism is somewhat inadequate when facing a complex work flow topology, and it is difficult to achieve accurate tracking of the work flow transfer path.
[0005] In summary, there is an urgent need for a new work flow engine to improve the tracking ability of the work flow transfer path. SUMMARY
[0006] The present application provides a work flow execution method, device, equipment and computer program based on edge driving, which creates corresponding node instances and edge instances for the work flow in the execution process of the work flow, saves more transfer information of the work flow, and provides stronger work flow tracking ability.
[0007] In order to achieve the above purpose, the main technical scheme adopted by the present application includes: In a first aspect, the present application provides a work flow execution method based on edge driving, which has at least one node in the work flow, and the method includes: For a current node in the at least one node, current node information corresponding to the current node is obtained from preset node definition data; create a current node instance of the current node in a node instance table in a workflow engine database according to the current node information, the workflow engine database comprising the node instance table and an edge instance table; when a work task corresponding to the current node instance is completed, obtain current node out-edge information corresponding to an edge having a first association relationship with the current node from preset edge definition data, the first association relationship referring to an edge taking the current node as a starting point; create a current edge instance having the first association relationship with the current node in the edge instance table according to the current node out-edge information.
[0008] In a second aspect, an embodiment of the present application provides a workflow execution device based on edge driving, the workflow having at least one node, and the device comprising: a node information obtaining module configured to obtain current node information corresponding to a current node from preset node definition data for the current node in the at least one node; a node instance creating module configured to create a current node instance of the current node in a node instance table in a workflow engine database according to the current node information, the workflow engine database comprising the node instance table and an edge instance table; an edge information obtaining module configured to, when a work task corresponding to the current node instance is completed, obtain current node out-edge information corresponding to an edge having a first association relationship with the current node from preset edge definition data, the first association relationship referring to an edge taking the current node as a starting point; an edge instance creating module configured to create a current edge instance having the first association relationship with the current node in the edge instance table according to the current node out-edge information.
[0009] In a third aspect, an embodiment of the present application provides a computer device, comprising: a memory and a processor, which are communicatively connected with each other, and the memory stores computer instructions, and the processor executes the computer instructions to perform the workflow execution method based on edge driving according to the first aspect.
[0010] In a fourth aspect, an embodiment of the present application provides a computer program product comprising computer instructions for causing a computer to perform the workflow execution method based on edge driving according to the first aspect.
[0011] The edge driving based workflow execution method provided by the embodiments of the present application discards the node driving design idea in the existing workflow engine, and creatively proposes a workflow architecture with edges as the core to drive the workflow transition. The completed / ongoing nodes and related edges in the whole workflow are recorded in the node instance table and the edge instance table, which saves more workflow transition information than the form of only one record of the whole workflow, and provides stronger workflow tracking capability. BRIEF DESCRIPTION OF DRAWINGS
[0012] In order to more clearly illustrate the technical solutions in the specific embodiments or prior art of the present application, the drawings needed to be used in the specific embodiments or prior art description will be briefly introduced as follows. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.
[0013] Figure 1 A workflow example diagram provided by the embodiments of the present application; Figure 2 A step diagram of the edge driving based workflow execution method provided by the embodiments of the present application; Figure 3 Another workflow example diagram provided by the embodiments of the present application; Figure 4 A structure diagram of the edge driving based workflow execution device provided by the embodiments of the present application; Figure 5 A structure diagram of a computer device provided by the embodiments of the present application. DETAILED DESCRIPTION
[0014] In order to make the purpose, technical solutions and advantages of the embodiments of the present application more clear, the technical solutions in the embodiments of the present application will be described clearly and completely in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the protection scope of the present application.
[0015] A workflow is an abstract and general description of a business rule between a work process and each operation step. It describes the process of a task from start to completion, sequentially flows through each processing link in a predetermined order, standardizes "who, at what link, does what", and automatically pushes the task like a production line. For example, a simple approval workflow can be as shown in Figure 1 Figure 1 The nodes are defined as follows: • Node A: submit an application; • Node B: Department manager approval; • Node C: Financial approval; The judgment condition at Node B is as follows: • If the department manager approval passes → the process continues to financial approval; • If it does not pass → back to the submission Node A.
[0016] In the early days, business processes were often directly "hard-coded" in the code: which node is approved by whom, and where the next step goes, are all directly defined in the code through if / else or switch. For such a design, once the process needs to be adjusted - such as adding a level of approval, or adjusting the approval order, it is obviously very inconvenient to contact the developer to refactor the code, repackage and test before deploying online. Therefore, the workflow engine came into being. Process designers can extract the "process" from the code and make it a configurable rules file, and the workflow engine will generate the corresponding workflow according to the input rules file.
[0017] Currently, mainstream workflow engines (such as BPMN, Activiti, Flowable, etc.) generally use "node-driven" or "state machine-driven" design to transfer tasks. Based on this design, the state change of a node will directly determine the activation of the successor node and the generation of the task. Still taking Figure 1 as an example, when the workflow is executed, its working logic is as follows: 1. Node A is completed → "submission completed" event is issued → triggers the approval event of Node B; 2. Node B is completed → "approval passed / failed" event is issued → triggers Node C or back to Node A.
[0018] In actual application, as shown in Table 1, taking the Flowable workflow engine as an example, process execution requires the following three core tables: Table 1: Core tables of Flowable workflow engine database Among them, the most core table is ACT_RU_EXECUTION. Whenever a process is actually executed, a corresponding process instance will be created in this table. When the process progresses, the relevant fields of the process instance will be updated in this table, and corresponding data insertion or deletion operations will be performed in the ACT_RU_TASK and ACT_RU_VARIABLE tables.
[0019] In summary, the design mode has the characteristics of node and event coupling, and the triggering logic of the event is included in each node. When the workflow progresses, the node definition needs to be queried to determine the next activated node. In practical applications, a process instance is maintained by the workflow engine, and information such as the current node is recorded in the process instance. This design mode performs well when facing a simple workflow as shown in Figure 1 However, when facing a complex workflow in topological structure, it is difficult to accurately track the flow of the workflow only by a process instance record. Moreover, this design mode also has some problems in processing complex branches, parallel convergence, conditional flow, and manual rollback.
[0020] The first embodiment of the present application provides a workflow execution method based on edge driving, which is used to solve the above problems. Wherein, at least one node is provided in the workflow, as shown in Figure 2 The method can include the following steps: Step 210, for the current node in the at least one node, obtaining the current node information corresponding to the current node from the preset node definition data.
[0021] The current node in the at least one node refers to the node corresponding to the current execution progress of the workflow. For example, if the application has been submitted through the A node and the B node has not been approved, the current node is the B node. Figure 1
[0022] Only after the design of a workflow is completed, the workflow can be executed. In this embodiment, the preset node definition data is obtained according to the design data of the workflow. Specifically, if the design data of the workflow is already in the form of structured literal data such as xml or json, the definition of the node related can be extracted as the preset node definition data. If the design data of the workflow is a common process design diagram such as vsdx, bpm, etc., the node definition data in the process design diagram can be extracted by parsing the process design diagram.
[0023] The preset node definition data includes the definition data of all nodes in the workflow. For example, if Figure 1 the preset node definition data includes the node definition of the A, B and C nodes, when the B node is the current node, the node definition corresponding to the B node needs to be obtained from the preset node definition data as the current node information.
[0024] Step 220, according to the current node information, creating a current node instance of the current node in the node instance table in the workflow engine database, and the workflow engine database includes the node instance table and the edge instance table.
[0025] In step 230, when the working task corresponding to the current node instance is completed, the current node out-edge information corresponding to the edge having a first association relationship with the current node is obtained from the preset edge definition data, and the first association relationship refers to that the edge takes the current node as a starting point.
[0026] The embodiment defines a workflow engine database including a node instance table and an edge instance table. A workflow is no longer only corresponding to one workflow instance in the database, but is decomposed into node instances and edge instances and stored in the node instance table and the edge instance table.
[0027] Similar to the preset node definition data, the preset edge definition data in the embodiment is also obtained according to the design data of the workflow. For example, it is extracted from structured literal data in xml format or json format.
[0028] As shown in Table 2 and Table 3, Table 2 is a definition example of a node instance table provided in the embodiment, and Table 3 is a definition example of an edge instance table provided in the embodiment. The meanings of the fields in the two instance tables can be referred to the column of “Explanation” in the table.
[0029] It should be noted that in actual application, fields can be added or deleted in the node instance table and the edge instance table provided in Table 2 and Table 3 according to specific needs, and the embodiment does not limit this. For example, a field named max_duration, Chinese name is maximum execution time field, data type is INT, and the field allowing null value is added in the node instance table, which is used to record the maximum duration of the execution of the corresponding working task allowed by the node.
[0030] Table 2 Structure example of node instance table Table 3 Structure of edge instance table Alternatively, the preset node definition data and the preset edge definition data can also be stored in the workflow engine database in the form of a node definition table and an edge definition table. For example, as shown in Table 4 and Table 5, Table 4 is a definition example of a node definition table provided in the embodiment, and Table 5 is a definition example of an edge definition table provided in the embodiment. The meanings of the fields in the two definition tables can be referred to the column of “Explanation” in the table. Similarly, in actual application, fields can be added or deleted in the node definition table and the edge definition table provided in Table 4 and Table 5 according to specific needs, and the embodiment does not limit this.
[0031] Table 4 Structure example of node definition table Table 5 Structure example of edge definition table When the current node information is acquired, a current node instance of the current node is created in the node instance table in the workflow engine database. Figure 1 For example, when execution is performed to the B node, a node instance corresponding to the B node is created in the node instance table as the current node instance.
[0032] A directed acyclic graph is the most common flowchart. In graph theory, "directed" means that an edge has a clear direction, for example Figure 1 In the example, the edge connecting the nodes A and B is edge ab, and the direction is from A to B. In this embodiment, an edge that points to other nodes from a certain node is referred to as an out-edge of the node, for example, edge ab is an out-edge of node A; an edge that points to a certain node from other nodes (also referred to as an edge that points to a certain node from other nodes and ends at the certain node) is referred to as an in-edge of the node, for example, edge ab is an in-edge of node B. In addition, in some complex flowcharts designed based on special requirements, there can be bidirectional edges and multiple edges connecting multiple nodes to form a loop.
[0033] In this embodiment, the first association relationship refers to an edge that takes the current node as the starting point, for example, edge ab is an out-edge of node A.
[0034] For example, when the work task corresponding to the current node instance is "submit an application" corresponding to the A node, after the application is submitted, the out-edge of the A node is obtained from the preconfigured edge definition data as edge ab, and the information of edge ab is taken as the current node out-edge information. Figure 1
[0035] It should be noted that some nodes can have more than one out-edge, for example, some nodes are designed with conditional branches, and different conditional branches point to different successor nodes, so that the conditional branch node has at least two out-edges. In this case, the edge having the first association relationship with the node is at least two edges, and the current node out-edge information also includes the definition information of at least two edges.
[0036] Step 240, creating a current edge instance having the first association relationship with the current node in the edge instance table according to the current node out-edge information.
[0037] In the example shown in Figure 1 , the current node out-edge information of node A records that node A has only one out-edge ab, and then a current edge instance corresponding to edge ab is created in the edge instance table to record the execution information of the workflow.
[0038] For the case where the current node out-edge information includes information of at least two edges, corresponding edge instances are created in the edge instance table for all edges in the current node out-edge information.
[0039] The edge driving based workflow execution method described in the embodiment stores the execution data of the workflow using the database structure of the node instance table and the edge instance table, and more flow transfer information of the workflow is saved compared with the way of storing a workflow as a database record in the existing workflow engine. Since the specific flow transfer logic is concentrated in the edge instance, the progress transfer of the workflow is triggered uniformly through the edge instance, and each flow transfer path can be naturally recorded, thereby providing stronger workflow tracking capability.
[0040] In addition, the embodiment mainly focuses on the improvement of the data storage and execution logic of the workflow, and the input format of the workflow definition data is basically consistent with the existing mainstream workflow engine, has high compatibility, can directly migrate the existing process definition, and reduces the learning cost and use threshold of the user.
[0041] The second embodiment of the present application further defines the edge driving based workflow execution method in the first embodiment in more detail and concretely, and part or all of the technical features in the second embodiment can be combined, replaced, etc. with the first embodiment, thereby obtaining more kinds of feasible edge driving based workflow execution methods.
[0042] The edge driving based workflow execution method in the second embodiment of the present application will be described in detail as follows: Optionally, before obtaining the current node information corresponding to the current node from the preset node definition data, the method further comprises: judging whether the current node instance of the current node is possessed in the node instance table, and judging whether all edge instances having the second association relationship with the current node are possessed in the edge instance table, the second association relationship being that the edge takes the current node as the terminal point; in the case that the current node instance of the current node is possessed in the node instance table or all edge instances having the second association relationship with the current node are not possessed in the edge instance table, the current node is re-determined in one or more nodes, and the current node information corresponding to the current node is obtained from the preset node definition data; in the case that the current node instance of the current node is not possessed in the node instance table and all edge instances having the second association relationship with the current node are possessed in the edge instance table, the current node information corresponding to the current node is obtained from the preset node definition data.
[0043] The embodiment further limits the specific way of obtaining the current node, so as to determine the next workflow node that should be started in the many workflow nodes, and further determine the execution direction of the workflow.
[0044] In the embodiment, the second association relationship refers to the edge as the incoming edge of the node, for example Figure 1 In the example shown in the figure, the node B has the second association relationship with the edge ab.
[0045] In this embodiment, it is determined whether the current node instance of the current node is present in the node instance table (hereinafter referred to as determination condition one) in order to avoid repeated execution of the same node; and it is determined whether all edge instances having a second association relationship with the current node are present in the edge instance table (hereinafter referred to as determination condition two) in order to determine whether all prerequisites for executing the node are satisfied.
[0046] For example, when the node A is executed, the edge instance corresponding to the edge ab is created, and then it is found that the current node A does not satisfy the determination condition one, and the current node needs to be determined again. It is found that the node B satisfies both the determination condition one and the determination condition two in all nodes of the workflow, and then the node B is taken as the current node, the information of the node B is obtained from the preset node definition data as the current node information, and the subsequent steps are continued. Figure 1
[0047] A special case is that when the workflow is started, a node needs to be specified as the current node as the starting point of the whole workflow. Specifically, the starting node of the workflow can be determined by finding the node with zero in-degree in the graph structure of the workflow, or the attribute of the starting node, such as the database ID, can be explicitly specified in the process definition stage, or the starting node can be explicitly specified in the configuration table or template parameter when the process instance is initialized, so as to realize the deterministic start of the process.
[0048] It should be noted that in some cases, for the repeatedly executed node, the node instance created by the last execution should be identified as the “last node instance” rather than the “current node instance of the current node”. For example, in the case of Figure 1 , the node B returns to the node A without passing the approval, and at this time, the node instance table already has a node instance of the node A, but this node instance is the “last node instance of the node A executed last time”, and the current node instance of the node A has not been created. In actual application, the node instance of the node executed last time can be distinguished by setting the node state field, the database primary key ID field, and the like.
[0049] In this embodiment, the node corresponding to the actual work task can be directly taken as the starting point, and for example, the node A can be directly taken as the starting point. Alternatively, in order to be compatible with the traditional workflow model, the start node and the end node can still be reserved in the design of the workflow, and the two nodes can be taken as the starting node and the ending node of the workflow. Figure 3
[0050] It should be noted that the execution of different processes in the same workflow in the embodiment is asynchronous. Specifically, when the topology of the workflow is relatively complex, there can be multiple current nodes at the same time. For example, the conference application proposed by A is sent to department B and department C at the same time, department B is responsible for conference material preparation, and department C is responsible for notifying participants. Since the edge is used as the driving core in the embodiment, each node only focuses on the execution of its own corresponding work task. That is, the material preparation node of department B is activated by the incoming edge from A, and the participant notification node of department C is also activated by the incoming edge from A, which activates two current nodes at the same time. The current node corresponding to the material preparation of department B focuses on conference material preparation, and the current node corresponding to the participant notification of department C focuses on notifying participants, so the execution between the two branch execution paths does not interfere with each other.
[0051] Optionally, the edge instance table includes an edge activation state field, the current node outgoing edge information includes a current edge activation condition of the edge having the first association relationship with the current node; and the creating, in the edge instance table, the current edge instance having the first association relationship with the current node includes: creating, in the edge instance table, the current edge instance having the first association relationship with the current node, the current edge instance including the edge activation state field set for the current edge instance according to the current edge activation condition; and after the judging whether all the edge instances having the second association relationship with the current node exist in the edge instance table, further including: judging whether the edge activation state field of the edge instance having the second association relationship with the current node is activated; and in the case that the edge activation state field of the edge instance having the second association relationship with the current node is not activated, re-determining the current node in one or more nodes.
[0052] Based on the above-described embodiments, although the basic framework of the edge-driven workflow has been established, the support for some common workflow structures is still not perfect, such as conditional branching. As shown in the example of Figure 3 If the above-described embodiments are used, after the approval of node B is completed, two edge instances of edge bc and edge bd will be generated in the edge instance table, and then node C and node D will find that all the edge instances pointing to themselves already exist, and the corresponding node instances are created. However, it is obvious that this workflow should actually be an "or" relationship - according to the work task execution result of node B, it is determined whether the next step of the workflow is node C or node D.
[0053] Therefore, the embodiment further limits the related information of the edge to better support the conditional branch and other structures in the workflow. Specifically, the embodiment proposes that the edge instance table includes an edge activation state field, which indicates whether the edge instance is activated. When applied to the conditional branch, the edge instance that meets the condition is set as activated, and the edge instance that does not meet the condition is set as a data item representing that the edge instance has not been activated. For example, Figure 3 In the example shown, when the node B is approved, the edge instance of the edge bc is created and set as activated, and the edge instance of the edge bd is created and set as not activated, so that the workflow can accurately flow to the financial approval C node.
[0054] The current node out-edge information needs to include the current edge activation condition of the edge having the first association relationship with the current node to set the edge activation state field. For example, Figure 1 For example, the activation condition of the edge bc can be described as "B node approval passes", and the activation condition of the edge bd can be described as "B node approval fails".
[0055] In general, since the current node out-edge information is obtained from the preset edge definition data, it can also be understood that the preset edge definition data has the edge activation condition of each edge. Of course, in actual application, the edge activation condition can also be obtained from other sources according to requirements, and the embodiment does not make specific limitations.
[0056] Based on the introduction of the edge activation state field, the way of determining the current node is also improved accordingly. Specifically, for the edge instances in the edge instance table having all the edges having the second association relationship with the current node, it is further determined whether the edge activation state fields of these edge instances are activated. When the edge activation state field is activated, no other operation is performed, and the method described in the above embodiment is continued to be executed. When the edge activation state field is not activated, it is considered that the activation condition of the node pointed to by the edge is not met, and the current node that meets the condition should be determined again in the node defined in the workflow.
[0057] Optionally, the edge instance type in the edge instance table includes an event edge instance and a conditional edge instance; the current edge instance having the first association relationship with the current node is created in the edge instance table, including: when the type of the current edge instance is an event edge instance, the event listening information of the corresponding system event and / or external event is obtained according to the current edge activation condition; the current edge instance having the first association relationship with the current node is created in the edge instance table, and the current edge instance includes the edge activation state field set for the current edge instance according to the current edge activation condition and the event listening information.
[0058] In the embodiment, "work task" is used to refer to the work in reality, for example Figure 1The "event" is used to refer to some situation occurring in the system work, for example, the system events in the work flow life cycle can include: process starting (a new work flow is started), task creation (a new work task corresponding to a node occurs), task completion (a work task corresponding to a node is completed), process ending (the whole work flow reaches the execution end point), and the like. External events can also occur, for example, a Bluetooth device is inserted, a door access system is started, and the like.
[0059] The embodiment further limits the type of the edge instance, and proposes that the edge instance can be an event edge instance and a conditional edge instance. The conditional edge instance has been described in the foregoing embodiment, that is, the edge instance can be activated only when some condition is met, and then transferred to the node pointed by the edge.
[0060] The event edge instance can be approximately understood as a more special conditional edge instance. The edge activation condition of the ordinary conditional edge instance is often related to the business of the previous node, for example Figure 1 In the example shown in the figure, the activation conditions of the two out-edges of the B node are "approval passed" and "approval not passed". The activation condition of the event edge instance is a system event and / or an external event, which is irrelevant to the business execution result. For example, the activation condition of the event edge can be "the door access system is normally running".
[0061] In actual application, according to the requirement, it can be set that the event listening information of the corresponding system event and / or external event is acquired only once when the edge instance is created, and the edge activation field is set accordingly; or it can be set that the event listening information is continuously acquired after the edge instance is created until the activation condition is met, which is not limited in the embodiment.
[0062] By introducing the event edge, the embodiment further improves the practicability of the work flow, so that the work flow can set more flexible work flow progress transfer conditions, for example, the starting condition of the door access system is set to avoid the problem that the work flow is stuck due to the failure of forcibly calling the door access record when the door access system is not running; or the execution condition of another work flow is set to activate the edge when the other work flow is executed.
[0063] The third embodiment of the application further limits the edge-driven work flow execution method in the first embodiment in a more detailed and specific manner. Some or all of the technical features in the third embodiment can be combined, replaced, and the like with the first embodiment or the second embodiment, so as to obtain more kinds of feasible edge-driven work flow execution methods.
[0064] The edge-driven work flow execution method in the third embodiment of the application is described in detail as follows: Optionally, the method further comprises: receiving a workflow progress transfer instruction, the workflow progress transfer instruction indicating that the progress of the workflow is to be transferred from a current node to a target node; in response to the workflow progress transfer instruction, creating a progress transfer edge instance having a third association relationship with the current node in the edge instance table, the third association relationship being that the edge takes the current node as a starting point and the target node as a terminal point; selecting the target node as the current node, and obtaining current node information corresponding to the current node from preset node definition data.
[0065] In a conventional workflow engine, how to solve the forced rollback (rollback to a work node that has already been executed) and forced jump (forced jump to a work node that has not yet been executed) of a workflow is a difficult problem. In actual applications, an administrator often uses these two operations. The essence is to directly move the progress of the workflow to another node without any judgment, and there is often no such flow path in the original topology structure of the workflow (if there is, it should be considered as normal execution of the workflow, and the administrator does not need to forcibly perform rollback and jump). Since the conventional workflow engine is responsible for the judgment of the flow direction of the workflow by the node, the above progress transfer operation will be identified as an illegal operation. To put it another way, even if the forced transfer of the progress is implemented, the database structure of the conventional workflow engine is difficult to clearly record what happened to the workflow, which brings difficulties to tracking and restoring the workflow.
[0066] Based on the foregoing problems and on the basis of the foregoing embodiments, the present embodiment proposes that when the progress of the workflow is located at a current node, a target node to which the progress of the workflow is to be transferred can be obtained, and then an edge instance that takes the current node as a starting point and points to the target node, i.e., a progress transfer edge instance having a fourth association relationship with the current node, is directly created. Then, the target node is taken as the current node, and the transfer of the progress of the workflow is realized.
[0067] In the present embodiment, the third association relationship is that when an edge is an outgoing edge of a current node and an incoming edge of a target node, the current node, the edge, and the target node have the third association relationship.
[0068] The above operation can be understood as that a "temporary edge" is created for progress transfer on the basis of the original topology of the workflow. Since the flow of the workflow in the present embodiment is driven by the edge, the above operation is legal, and the transfer of the progress of the workflow can be realized without any other special operation.
[0069] Specifically, when the workflow transition instruction indicates a jump operation, a special progress transition edge instance is generated, for example, an edge instance of edge type "manual_jump", which is used to record that the edge instance is used for progress jump. The starting point is the current node, and the ending point is the target node. If the edge instance has an edge activation field, the state of the edge instance can be set to active or inactive as needed (generally set to active). Then the workflow execution method described in the foregoing embodiments is executed on the target node.
[0070] Specifically, when the workflow transition instruction indicates a rollback operation, a special progress transition edge instance is generated, for example, an edge instance of edge type "manual_back", which is used to record that the edge instance is used for progress rollback. The starting point is the current node, and the ending point is the target node. If the edge instance has an edge activation field, the state of the edge instance can be set to active or inactive as needed (generally set to active). Then the workflow execution method described in the foregoing embodiments is executed on the target node. In addition, it should be noted that when the rollback operation is performed, a node instance according to the definition of the target node will normally exist in the node instance table, and according to actual needs, the node instance can also be selected to be deleted or the state of the node instance is updated to directly use the node instance as the node instance of the current node. However, the above operations cause certain damage to the workflow execution information recorded in the database, which is not conducive to the tracking of the workflow. Therefore, for the rollback operation, the embodiment only recommends to use the way of re-creating a current node instance in the node instance table, and it is not recommended to operate the original node instance unless there is a special need.
[0071] Optionally, the node instance table includes a node activation state field, and the method further includes: receiving a workflow termination instruction, the workflow termination instruction indicating termination of execution of the workflow at the current node; in response to the workflow termination instruction, setting the node activation field of the current node instance to termination; obtaining, from the preset edge definition data, current node out-edge information corresponding to an edge having a first association relationship with the current node; and creating, according to the current node out-edge information, a current edge instance having the first association relationship with the current node in the edge instance table, and setting the edge activation state field of the current edge instance to termination.
[0072] In actual application, there will also be a demand for directly terminating an executing workflow. Similar to the progress transition instruction, the termination of a workflow is generally performed by an administrator.
[0073] The embodiment proposes that, since the workflow termination is a special state, in order to better record the execution information of the workflow, the node activation field is also set for the node. When the workflow termination instruction is received, the current node instance state is set to termination, which is used to record that the workflow is terminated at the node in the node instance table. Then the edge instance of the outgoing edge of the current node is generated, and the state of the edge instance is also set to termination, which is used to record the related information that the workflow is terminated in the edge instance table.
[0074] Optionally, the preset node definition data includes a node in-degree of the node; and the determining whether all edge instances having the second association relationship with the current node exist in the edge instance table includes: counting a number of edge instances having the second association relationship with the current node in the edge instance table; and when the number of edge instances is equal to the node in-degree of the current node, it is determined that all edge instances having the second association relationship with the current node exist in the edge instance table, otherwise, it is determined that all edge instances having the second association relationship with the current node do not exist in the edge instance table.
[0075] The embodiment further limits the operation of "determining whether all edge instances having the second association relationship with the current node exist in the edge instance table".
[0076] Firstly, the most common judgment logic is to find and compare each edge in the edge instance table according to the incoming edge of the current node, to determine whether the corresponding edge instance has been created for each edge.
[0077] However, the above-mentioned method needs to perform multiple targeted database query operations, and the efficiency is low. Therefore, the embodiment proposes that, on the premise that the workflow design is perfect and the workflow execution is correct, based on the edge-driven workflow execution method described in the foregoing embodiment, no redundant edge instance is created. Therefore, when the number of edge instances pointing to a node is equal to the node in-degree, it can be considered that the node should be activated as the current node. For example Figure 4 In the example, the in-degree of node B is 1, and only one edge ab pointing to node B is defined in the workflow, so when an edge instance pointing to node B appears, it is only possible that the edge instance corresponding to edge ab is created, and no further targeted query and comparison is needed to complete the judgment.
[0078] It should be noted that for the progress jump operation proposed in the foregoing embodiments, the rollback and jump operations finally force the creation of a new current node, which is a special operation and does not need to be judged. It has been explicitly stated in the foregoing embodiments that performing these operations should create a new node instance as much as possible to avoid operating on an existing node instance. On the basis of the foregoing, further in combination with the node state field, the database primary key ID field and the like, identification can be distinguished to ensure that the progress jump and rollback special operations and normal operations are isolated from each other and do not affect the implementation of the judgment logic in the embodiment.
[0079] Optionally, the method further comprises: when operating on the node instance table or the edge instance table, creating a corresponding operation record in the operation log.
[0080] The embodiment proposes that on the basis of the foregoing embodiments, an operation log can be further provided to record the work information of the entire workflow in one place. The operation log records all workflow operations such as node instance state changes, edge instance state changes and node activation paths, which is beneficial to the implementation of process visualization, audit tracking and work log management. The storage location of the operation log can be in the workflow engine database or other preset locations.
[0081] Based on the first embodiment, the second embodiment and the third embodiment, the application summarizes seven key operations of workflow flow as shown in Table 6.
[0082] Table 6: Flow behavior list The flow behavior in Table 6 is further described as follows. Operation 1: Node activation next Function summary: For a node with only one outgoing edge, after the work task of the current node is completed, the next node is activated along the edge.
[0083] Trigger condition: current node is completed.
[0084] Logical flow: current node is completed → create an edge instance → determine the next activated current node → generate a new current node instance.
[0085] Operation 2: Node rollback back Function summary: rollback to an executed node (which can be manually triggered or triggered according to an existing rollback edge).
[0086] Trigger condition: current node rollback.
[0087] Logical flow: update the information of the current node instance, record that the current node is rolled back → create an edge instance for normal rollback or a special rollback edge instance → generate a new current node instance.
[0088] Operation 3: Node Branch parallel Function Overview: For nodes with multiple edges, multiple parallel branch nodes are activated at the same time.
[0089] Trigger Condition: Current node is completed.
[0090] Logical Flow: Current node is completed → Get all outgoing edges of the current node, generate outgoing edge instances for each outgoing edge, set the edge activation field according to the requirements → Determine the current node that needs to be activated → Generate a new current node instance.
[0091] Operation 4: Node Merge Function Overview: For nodes with multiple incoming edges, wait for all incoming edges to be activated, and trigger the merging node to execute.
[0092] Trigger Condition: All incoming edges edge_inst have been completed.
[0093] Logical Flow: Check all incoming edges of the merging node → If all incoming edges are in the activated state, generate a new current node instance.
[0094] Operation 5: Node Event Function Overview: Used to activate nodes that depend on interface, script or notification events.
[0095] Trigger Condition: The node reaches the event trigger point.
[0096] Logical Flow: Get event listening information → According to the event listening information and node definition, execute the subsequent actions of success / failure.
[0097] Operation 6: Node Skip Function Overview: Skip to the target node.
[0098] Trigger Condition: Manually triggered.
[0099] Logical Flow: Update the information of the current node instance, record the jump at the current node → Create a special skip edge instance → Generate a new current node instance.
[0100] Operation 7: Node Terminate Function Overview: Terminate the execution of the workflow.
[0101] Trigger Condition: Manually or abnormally triggered.
[0102] Logical Flow: Update the information of the current node instance, record the termination of the workflow at the current node → Create an edge instance, record the termination of the workflow at the edge instance.
[0103] The fourth embodiment of this application also proposes a workflow execution device based on edge-driven operation, such as... Figure 5 As shown, the workflow includes at least one node, and the device comprises: The node information acquisition module 410 is used to acquire the current node information corresponding to the current node from the preset node definition data for at least one node. The node instance creation module 420 is used to create a current node instance of the current node in the node instance table of the workflow engine database based on the current node information. The workflow engine database includes a node instance table and an edge instance table. The edge information acquisition module 430 is used to acquire the current node outgoing edge information corresponding to the edge with the first association relationship with the current node from the preset edge definition data when the work task corresponding to the current node instance is completed. The first association relationship means that the edge takes the current node as the starting point. The edge instance creation module 440 is used to create a current edge instance with the first association relationship with the current node in the edge instance table based on the outgoing edge information of the current node.
[0104] Further functional descriptions of the above modules and units are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0105] In this embodiment, the edge-driven workflow execution device is presented in the form of a functional unit. Here, a unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that execute one or more software or fixed programs, and / or other devices that can provide the above functions.
[0106] Please see Figure 5 , Figure 5 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application, such as... Figure 5 As shown, the computer device includes one or more processors 610, memory 620, and interfaces for connecting the components, including high-speed interfaces and low-speed interfaces. The components communicate with each other via different buses and can be mounted on a common motherboard or otherwise installed as needed. The processors can process instructions executed within the computer device, including instructions stored in or on memory to display graphical information of a GUI on external input / output devices (such as display devices coupled to the interfaces). In some alternative implementations, multiple processors and / or multiple buses can be used with multiple memories and multiple memory modules, if desired. Similarly, multiple computer devices can be connected, each providing some of the necessary operations (e.g., as a server array, a group of blade servers, or a multiprocessor system).Figure 1 The processor 610 is taken as an example.
[0107] The processor 610 can be a central processor, a network processor, or a combination thereof. The processor 610 can further include a hardware chip. The hardware chip can be an application specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device can be a complex programmable logic device, a field programmable logic device, a general array logic, or any combination thereof.
[0108] The memory 620 stores instructions executable by the at least one processor 610, so that the at least one processor 610 performs the method shown in the above embodiments.
[0109] The memory 620 can include a program storage area and a data storage area. The program storage area can store an operating system, at least one application required by a function, and the like. The data storage area can store data created according to the use of the computer device, and the like. In addition, the memory 620 can include a high-speed random access memory, and can further include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some optional embodiments, the memory 620 can optionally include a memory disposed remotely with respect to the processor 610, and these remote memories can be connected to the computer device through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0110] The memory 620 can include a volatile memory, such as a random access memory, and can also include a non-volatile memory, such as a flash memory, a hard disk, or a solid state disk. The memory 620 can further include a combination of the above-mentioned memories.
[0111] The computer device further includes a communication interface 630 for communication between the computer device and other devices or communication networks.
[0112] The embodiments of the present application provide a computer program product. The computer program product includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method of any of the embodiments of the present application.
[0113] Although the embodiments of the present application are described in conjunction with the accompanying drawings, various modifications and changes can be made by those skilled in the art without departing from the spirit and scope of the present application, and such modifications and changes fall within the scope defined by the appended claims.
[0114] It can be understood that, before using the technical solutions disclosed in the embodiments of the present disclosure, the type of personal information involved in the present disclosure, the use range, the use scenario, etc. should be informed to the user and the authorization of the user should be obtained through appropriate means according to relevant laws and regulations.
[0115] For example, in response to receiving an active request of a user, prompt information is sent to the user to explicitly prompt the user that the operation requested to be performed will require obtaining and using personal information of the user. Thus, the user can autonomously select whether to provide personal information to the software or hardware such as an electronic device, an application program, a server or a storage medium, etc. performing the operation of the technical solutions of the present disclosure according to the prompt information.
[0116] As an optional but non-limiting implementation manner, in response to receiving an active request of a user, the manner of sending prompt information to the user may, for example, be a pop-up window manner, and the prompt information may be presented in the form of text in the pop-up window. In addition, the pop-up window may also carry selection controls for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0117] It can be understood that the above notification and obtaining of user authorization process is only illustrative and does not limit the implementation manners of the present disclosure, and other manners meeting relevant laws and regulations can also be applied to the implementation manners of the present disclosure.
[0118] It can be understood that the data (including but not limited to the data itself, the acquisition or use of the data) involved in the technical solutions should comply with the requirements of relevant laws and regulations and relevant provisions.
[0119] It can be understood that in the specific embodiments of the present application, data related to user information, location information, navigation data, etc. is involved, and when the above embodiments are applied to specific products or technologies, the user's permission or consent needs to be obtained, and the collection, use and processing of the related data need to comply with relevant laws and regulations and standards of relevant countries and regions.
[0120] The edge-driven workflow execution method, device, computer device and computer program product illustrated in the above embodiments can be specifically implemented by a computer chip or entity, or by a product with certain functions. A typical implementation device is a computer. Specifically, the computer may, for example, be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0121] For the convenience of description, the above apparatus is described in various units by function for separate description. Of course, the functions of the units can be implemented in one or more software and / or hardware in the implementation of the present application.
[0122] Those skilled in the art should understand that the embodiments of the present application can be provided as an edge-driven workflow execution method, apparatus, computer device and computer program product. Therefore, the present application can adopt a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can adopt a computer program product in the form of being implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.
[0123] The present application is described with reference to flowcharts and / or block diagrams of edge-driven workflow execution method, apparatus, computer device and computer program product according to embodiments of the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device implemented in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in the flow or flows and / or block or blocks.
[0124] These computer program instructions can also be stored in a computer readable storage medium that can direct the computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable storage medium produce a manufactured product including instruction apparatus, which implements the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus that performs the functions specified in the flow or flows and / or block or blocks.
[0125] These computer program instructions can also be loaded into a computer or other programmable data processing device, so that a series of operation steps are performed on the computer or other programmable device to produce a computer implemented process, so that the instructions executed on the computer or other programmable device provide a process for implementing the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks an apparatus that performs the functions specified in the flow or flows and / or block or blocks.
[0126] It should also be noted that the terms "comprises" "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without further constraints, exclude the presence of additional identical elements in the process, method, article, or apparatus that comprises the element.
[0127] Each of the embodiments in the present specification is described in a progressive manner, and the same or similar parts between the embodiments can be mutually referred to, and each of the embodiments mainly describes the difference from other embodiments. In particular, for the edge-driven workflow execution apparatus, computer device and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiments.
[0128] The above only describes the embodiments of the present application and is not intended to limit the present application. Those skilled in the art can make various modifications and changes to the present application. Any modification, equivalent replacement, improvement, etc. within the spirit and principles of the present application shall be included in the scope of the claims of the present application.
[0129] Although the embodiments of the present application are described in conjunction with the drawings, various modifications and changes can be made by those skilled in the art without departing from the spirit and scope of the present application, and such modifications and changes fall within the scope defined by the appended claims.
Claims
1. A workflow execution method based on edge-driven architecture, characterized in that, The workflow includes at least one node, and the method includes: For the current node among the at least one nodes, obtain the current node information corresponding to the current node from the preset node definition data; Based on the current node information, a current node instance of the current node is created in the node instance table of the workflow engine database. The workflow engine database includes the node instance table and the edge instance table. When the task corresponding to the current node instance is completed, the outgoing edge information of the current node corresponding to the edge with the first association relationship with the current node is obtained from the preset edge definition data. The first association relationship means that the edge takes the current node as the starting point. Based on the outgoing edge information of the current node, create a current edge instance in the edge instance table that has the first association relationship with the current node.
2. The method according to claim 1, characterized in that, Before retrieving the current node information corresponding to the current node from the preset node definition data, the method further includes: Determine whether the node instance table contains a current node instance of the current node, and determine whether the edge instance table contains all edge instances that have a second association relationship with the current node, wherein the second association relationship means that the edge ends with the current node; If the node instance table contains a current node instance of the current node, or if the edge instance table does not contain all edge instances that have a second association relationship with the current node, the current node is re-determined from one or more nodes, and the current node information corresponding to the current node is obtained from the preset node definition data. If the node instance table does not contain a current node instance of the current node, and the edge instance table contains all edge instances that have a second association relationship with the current node, the current node information corresponding to the current node is obtained from the preset node definition data.
3. The method according to claim 2, characterized in that, The edge instance table includes an edge activation status field, and the current node outgoing edge information includes the current edge activation conditions of the edges that have a first association relationship with the current node. Creating a current edge instance in the edge instance table that has the first association relationship with the current node includes: Create a current edge instance in the edge instance table that has the first association relationship with the current node. The current edge instance includes an edge activation status field set for the current edge instance according to the current edge activation condition. After determining whether the edge instance table contains all edge instances that have a second association with the current node, the method further includes: Determine whether the edge activation status field of the edge instance that has a second association with the current node is active; If the edge activation status field of the edge instance that has a second association with the current node is not active, the current node is re-determined among the one or more nodes.
4. The method according to claim 3, characterized in that, The edge instance types in the edge instance table include event edge instances and conditional edge instances; Creating a current edge instance in the edge instance table that has the first association relationship with the current node includes: When the type of the current edge instance is the event edge instance, the event listening information of the corresponding system event and / or external event is obtained according to the current edge activation condition; Create a current edge instance in the edge instance table that has the first association relationship with the current node. The current edge instance includes an edge activation status field set for the current edge instance according to the current edge activation condition and the event listening information.
5. The method according to claim 1, characterized in that, The method further includes: Receive a workflow progress transfer instruction, which instructs the workflow progress to be transferred from the current node to the target node; In response to the work progress transfer instruction, a progress transfer edge instance with a third association relationship with the current node is created in the edge instance table. The third association relationship means that the edge starts from the current node and ends at the target node. Select the target node as the current node, and obtain the current node information corresponding to the current node from the preset node definition data.
6. The method according to claim 3, characterized in that, The node instance table includes a node activation status field; The method further includes: Receive a workflow termination instruction, which indicates that the execution of the workflow be terminated at the current node; In response to the workflow termination command, the node activation field of the current node instance is set to terminate; Obtain the outgoing edge information of the current node corresponding to the edge that has the first association relationship with the current node from the preset edge definition data; Based on the outgoing edge information of the current node, create a current edge instance in the edge instance table that has the first association relationship with the current node, and set the edge activation status field of the current edge instance to terminate.
7. The method according to claim 2, characterized in that, The preset node definition data includes the node's in-degree; Determining whether the edge instance table contains all edge instances that have a second association with the current node includes: Calculate the number of edge instances in the edge instance table that have the second association relationship with the current node; When the number of edge instances is equal to the in-degree of the current node, it is determined that the edge instance table contains all edge instances that have a second association relationship with the current node; otherwise, it is determined that the edge instance table does not contain all edge instances that have a second association relationship with the current node.
8. A workflow execution device based on edge-driven operation, characterized in that, The workflow includes at least one node, and the device comprises: The node information acquisition module is used to acquire current node information corresponding to the current node from preset node definition data for the current node among the at least one node; The node instance creation module is used to create a current node instance of the current node in the node instance table of the workflow engine database based on the current node information. The workflow engine database includes the node instance table and the edge instance table. The edge information acquisition module is used to acquire the current node outgoing edge information corresponding to the edge that has a first association relationship with the current node from the preset edge definition data when the work task corresponding to the current node instance is completed. The first association relationship means that the edge takes the current node as its starting point. The edge instance creation module is used to create a current edge instance with the first association relationship with the current node in the edge instance table based on the outgoing edge information of the current node.
9. A computer device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the edge-driven workflow execution method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer program product, characterized in that, Includes computer instructions for causing a computer to execute the edge-driven workflow execution method according to any one of claims 1 to 7.