Process instance execution method, device, electronic device and readable medium
By caching process definitions to Redis and establishing memory context objects, the limitations of existing process engines in performance and deployment are solved, and efficient process instance execution and simplified deployment process is achieved.
Patent Information
- Application Number
- CN202411772973.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-04-08
AI Technical Summary
Existing process engines have limitations in performance, deployment architecture, and learning thresholds, resulting in low execution efficiency of process instances.
By obtaining the process definition of the process instance from the database and cache it into Redis, a unique identity of the process instance is generated, a memory context object is established, and all nodes in the process instance are executed in the scheduling logical order.
Significantly improves the execution performance of process instances, reduces dependence on databases, simplifies deployment architecture, and lowers learning barriers.
Smart Images

Figure CN119781918A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information processing, and in particular to a method for executing a process instance, a device for executing a process instance, an electronic device, and a computer-readable medium. Background Art
[0002] Currently, process engines based on BPMN (Business Process Model and Notation) language (such as Activiti) and process scheduling engines based on microservice architecture (such as Netflix Conductor) are widely used in the field of service orchestration. However, these technologies have many limitations in terms of performance, deployment architecture, and learning threshold. Activiti is a typical open source process engine based on BPMN model. It mainly performs process scheduling through four database tables (such as Figure 1 The scheduling process relies on database tables, which limits performance. It is suitable for manual task approval processes, but not for automated service orchestration scenarios. Netflix Conductor is an open source process engine written in Java and is suitable for process scheduling in microservice architectures. It consists of two parts: the client and the server (see the attached Figure 2 As shown in Figure 1). This technology requires an additional server to be deployed. For low-code scenarios, the products developed by users need to support deployment to the specified environment, which increases the complexity and cost of deployment. At the same time, the open source framework has less information and a high entry threshold. The existing technology has the following disadvantages: limited performance. Existing process engines usually rely on databases for scheduling, and frequent database access leads to performance bottlenecks. The deployment is complex, such as Netflix Conductor, which requires additional independent server deployment, which brings additional cost and complexity for users to integrate into the specified environment. The learning threshold is high, the relevant open source technology documentation is limited, and its function implementation requires developers to have high technical capabilities, which is not suitable for non-professional developers or low-code scenarios. Summary of the invention
[0003] The embodiment of the present invention provides a method, device, electronic device and computer-readable storage medium for executing a process instance to solve the problem of low execution efficiency of the process instance.
[0004] The embodiment of the present invention discloses a method for executing a process instance, and the method for executing the process instance includes:
[0005] When a request to execute a process instance is received, the process definition involved in the process instance is obtained from the database, and the process definition is cached in redis in the form of a process memory object;
[0006] Generate a unique identifier for the process instance, and write any one or more of the identifier of the process definition associated with the process instance, execution time information, and execution status information into a process instance table corresponding to the unique identifier of the process instance;
[0007] Establishing and initializing a memory context object of the process instance, the memory context object is used to store context information of the process instance, the context information including any one or more of a unique identifier of the process instance, attributes of any node, process instance execution parameters, output content of any node, and instance execution status;
[0008] All nodes in the process instance are executed in sequence according to the scheduling logic order of the process instance.
[0009] In one embodiment, it further includes:
[0010] A process definition table is pre-established using the JSON data specification, which includes any one or more of a start node, a serial branch node, a parallel branch node, a business node, and an end node, wherein the attributes of any node include any one or more of an identifier, a node type, a node business content definition, input parameters, output parameters, a child node set, and a next node.
[0011] In one embodiment, it further includes:
[0012] Through the execution business interface of the node, the java class corresponding to the node is executed to realize the function of the node.
[0013] In one embodiment, it further includes:
[0014] Use one process to run any execution instance. Multiple execution instances of the same type correspond to different processes.
[0015] In one embodiment, it further includes:
[0016] The process definition is defined in a JSON array, and the process definition includes any one or more of a business process and an execution logic.
[0017] In one embodiment, it further includes:
[0018] The types of the nodes include any one or more of a start node, a service node, a serial branch node, a parallel branch node, and an end node.
[0019] A process instance execution device is provided, comprising:
[0020] A cache module is used to obtain the process definition involved in the process instance from the database when receiving a request to execute the process instance, and cache the process definition in redis in the form of a process memory object;
[0021] A writing module, used to generate a unique identifier of the process instance, and write any one or more of the identifier of the process definition associated with the process instance, the execution time information, and the execution status information into the process instance table corresponding to the unique identifier of the process instance;
[0022] An establishment module, used to establish and initialize a memory context object of the process instance, wherein the memory context object is used to store context information of the process instance, wherein the context information includes any one or more of a unique identifier of the process instance, attributes of any node, process instance execution parameters, output content of any node, and instance execution status;
[0023] The execution module is used to execute all nodes in the process instance in sequence according to the scheduling logic order of the process instance.
[0024] In one embodiment, the cache module, the writing module, the establishing module and the executing module are controlled to implement any one of the above-mentioned execution methods of the process instance.
[0025] The embodiment of the present invention further discloses an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0026] The memory is used to store computer programs;
[0027] The processor is used to implement the method described in the embodiment of the present invention when executing the program stored in the memory.
[0028] The embodiment of the present invention further discloses one or more computer-readable media on which instructions are stored. When executed by one or more processors, the processors are enabled to execute the method described in the embodiment of the present invention.
[0029] The embodiment of the present invention has the following advantages: the parsing, node scheduling and execution of the process instance are all performed in the process, the definition, output and status information of the node are stored in the memory context object of the process, and there is no need to query the node definition and the output content of each node from the database during the execution process. The reading efficiency of the memory cache is significantly higher than that of the database or third-party cache, thereby improving the execution performance of the process instance. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1A schematic diagram of the core scheduling process of the activiti engine provided by an embodiment of the present invention;
[0031] Figure 2 A schematic diagram of the core scheduling process of Netflix Conductor provided by an embodiment of the present invention;
[0032] Figure 3 A flowchart of a method for executing a process instance provided by an embodiment of the present invention;
[0033] Figure 4 An architectural diagram of a method for executing a process instance provided by an embodiment of the present invention;
[0034] Figure 5 A schematic diagram of a scheduling execution process of a method for executing a process instance provided by an embodiment of the present invention;
[0035] Figure 6 It is a structural block diagram of an execution device of a process instance provided in an embodiment of the present invention;
[0036] Figure 7 is a block diagram of an electronic device provided in an embodiment of the present invention;
[0037] Figure 8 is a schematic diagram of a computer-readable medium provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0038] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0039] Reference Figure 3 , shows a flowchart of a method for executing a process instance provided in an embodiment of the present invention, which may specifically include the following steps:
[0040] In step S11, when a request to execute a process instance is received, a process definition involved in the process instance is obtained from a database, and the process definition is cached in redis in the form of a process memory object;
[0041] In step S12, a unique identifier of the process instance is generated, and any one or more of the identifier of the process definition associated with the process instance, the execution time information, and the execution status information are written into the process instance table corresponding to the unique identifier of the process instance;
[0042] In step S13, a memory context object of the process instance is established and initialized, and the memory context object is used to store context information of the process instance, and the context information includes any one or more of the unique identifier of the process instance, the attributes of any node, the execution parameters of the process instance, the output content of any node, and the instance execution status;
[0043] In step S14, all nodes in the process instance are executed in sequence according to the scheduling logic order of the process instance.
[0044] In one embodiment, the core of the technical solution is to execute process instances based on JSON specifications. Process initialization includes obtaining and caching process definitions, generating unique identifiers, and establishing and initializing context objects. Process scheduling and execution are based on scheduling logic, executing each node in turn and completing node functions. Through JSON specifications and interface design, node attributes and functions are defined, and the performance improvement of in-process operation is emphasized. By optimizing storage and execution methods, execution efficiency is improved and resource dependence is reduced.
[0045] Acquisition and caching of process definitions in the database. After receiving a request to execute a process instance, the relevant process definition needs to be extracted from the database. As a traditional storage method, the database can provide stable support, but directly relying on the database may lead to performance bottlenecks in real-time high-frequency access scenarios. Therefore, converting the process definition into a "process memory object" and caching it in Redis helps improve the efficiency of data reading. Redis's efficient read and write characteristics make it a suitable tool for caching. The generation and recording of the unique identifier of the process instance is a key step in achieving process isolation and traceability. Each process instance corresponds to a unique identifier to ensure that the data will not be confused when multiple instances are executed at the same time. At the same time, the identifier, execution time and status information of the process definition are associated to facilitate subsequent status management and troubleshooting. The memory context object is used to dynamically store the execution status and node data of the process instance. Its design goal is to reduce database interaction and improve operation efficiency. The memory context object is the core component of the system operation, integrating the unique identifier of the process instance, node attributes, execution parameters, node output content and other information. Storing all running states in memory and ensuring thread safety through synchronization mechanisms helps improve concurrency performance.
[0046] The execution of the process instance gradually transitions from the start node to the end node according to the established scheduling logic sequence. The definition of the scheduling logic is bound to the process instance to ensure that the execution is consistent and predictable. The sequential execution logic avoids the complex process branch competition problem, making the implementation process simpler and more reliable. The Java class corresponding to the node is called by executing the business interface to complete the specific business logic of the node. The object-oriented nature of the Java class makes the node function modular, which is easy to expand and maintain. The definition of the interface provides a standardized execution method, reducing uncertainty in development.
[0047] Use JSON specification to define the process table, including process structure, node type and attributes. JSON is a lightweight data exchange format that is widely compatible with different programming languages and is suitable for cross-platform process definition. The flexible definition of node attributes supports the representation of complex business logic and simplifies the parsing process. Node types include start nodes, business nodes, serial branch nodes, parallel branch nodes and end nodes. Each type of node has independent functional characteristics. The purpose of node classification is to clarify the division of labor. Serial and parallel nodes are used to control the logical branching of the execution process, while business nodes carry specific functions. A single process is responsible for running an execution instance, and multiple instances of the same type can be distributed in different processes. Concurrent execution of multiple instances is achieved through process isolation to avoid performance bottlenecks caused by resource competition. In a multi-core architecture, computing resources can be fully utilized to achieve linear performance expansion.
[0048] Through the design of cache and memory context objects, the number of database queries is reduced and the execution efficiency is greatly improved. Database access is usually a performance bottleneck. Through memory cache and context, the pressure on the database caused by high-frequency access can be avoided. The combination of Redis and memory has significant advantages in terms of latency and throughput. Real-time scheduling is not dependent on the database, which simplifies the system architecture and reduces resource consumption. Avoiding frequent database queries and update operations not only reduces hardware pressure, but also improves resource utilization. In addition, it can run in a simpler environment, reducing deployment complexity. The standardized design of process definitions and interfaces based on JSON makes the system highly scalable. The structured characteristics of JSON make the modification and extension of process definitions more intuitive and convenient. The standardized interface design provides a unified entry for the addition of system functions, which is convenient for subsequent development.
[0049] JSON (JavaScript Object Notation) is a lightweight, text-based, open data exchange format that is widely used in the field of modern information technology for its simplicity and readability. It represents data in the form of key-value pairs, which is highly structured and easy to parse. Due to its cross-platform nature, most mainstream programming languages (such as Java, Python, C, etc.) natively support JSON and provide a rich library of tools or built-in methods for efficient operation and processing of JSON data. This makes JSON an important technical choice in distributed systems, microservice architectures, and front-end and back-end communications.
[0050] Service orchestration is a visual way to build backend business logic. It breaks down complex business processes into independent functional modules through graphical methods (such as drag-and-drop operations) and defines the logic in the form of flowcharts. This method reduces the tedious details in the traditional coding process and significantly improves development efficiency and configuration flexibility. The typical application scenario of service orchestration is the low-code platform. In this scenario, developers do not even need to have a deep programming foundation. They can complete the design and implementation of the backend logic through simple interactive operations.
[0051] Low-code platforms are a type of development tool that supports rapid generation of applications. Developers can complete the transformation from demand to product with little or no coding. This type of platform is particularly suitable for business scenarios that require rapid iteration, such as enterprise management systems and data analysis platforms. Low-code platforms integrate service orchestration capabilities to present complex back-end business logic to developers in an intuitive way, further lowering the development threshold.
[0052] In view of the shortcomings of the prior art, this embodiment proposes a service orchestration method based on JSON dynamic parsing. It can reduce the dependence on the database, store process instances and node status in the form of memory context objects, reduce database interactions, and significantly improve scheduling performance. It can simplify the deployment architecture, support the monolithic deployment mode, and can be quickly integrated into the low-code platform without the need for additional server-side deployment. It can improve usability, and the process definition adopts JSON data specifications, supports graphical design and fast parsing, further reducing the learning threshold. It is suitable for service orchestration needs in low-code platforms, such as enterprise automated workflow management, order processing process design, etc. By combining the flexibility of JSON, the efficiency of memory context, and the ease of deployment of monolithic architecture, this solution can significantly improve development efficiency and system performance, while meeting the needs of modern business for rapid response and flexible configuration.
[0053] Execute process scheduling in the process, and store execution status and node data in combination with memory context objects, thereby effectively reducing dependence on the database and significantly improving process execution performance. It has the characteristics of simple access and convenient deployment, and is especially suitable for single architecture and low-code platform scenarios. The overall implementation architecture is as follows Figure 4 As shown, it is mainly divided into two parts: process definition and process scheduling, which are explained in detail below.
[0054] The core logic of the process is visually arranged by the front end, and then these process elements are stored in the process definition table. The process definition uses JSON data specifications, including the following node types: start node: identifies the starting point of the process and defines the initialization logic; serial branch node: used to execute a series of child nodes in sequence; parallel branch node: processes multiple child nodes in parallel through multi-threading; business node: executes specific business logic and carries the actual functional module; end node: identifies the end point of the process and defines cleanup and final state operations.
[0055] Each node is stored in the form of an object with the following key attributes. Identification: unique identifier of the node; Node type: distinguish the functional category of the node (such as business node, branch node); Node business content definition: clarify the business logic or operation method; Input and output parameters: define the input and output data of the node; Child node collection: store the structured information of the child node (applicable to branch nodes); Next node: points to the subsequent node of the current node, used to determine the scheduling order. Through the standardized definition of the above attributes, the business content, reference relationship and execution order of the node can be clearly distinguished.
[0056] The functions of business nodes are implemented through specific codes. A type of business node usually corresponds to a Java class, which needs to implement a standardized business interface to encapsulate the execution logic of the node. This design realizes the modularization and code reuse of node functions, providing powerful expansion capabilities for complex processes. When a process execution request is received, the process instance is started according to the request parameters. The main steps are as follows:
[0057] 1. Get the process definition: load the corresponding process definition content from the database and convert it into the program's memory object (JSON structure).
[0058] 2. Cache process definition: To improve performance, you can choose to store the process definition object in Redis cache to avoid repeated queries to the database.
[0059] 3. Generate process instance ID: Generate a unique instance identifier for each execution request, and record the associated process definition ID, execution time and status information in the process instance table.
[0060] 4. Initialize the memory context object: used to store the running status of the instance, including: the unique identifier of the process instance; the definition and association relationship of all nodes; the execution parameters of the current process; the output data of each node; and the overall execution status of the process.
[0061] The execution of the process is strictly carried out according to the scheduling logic, from the start node to the end node.
[0062] The specific process is as follows:
[0063] 1. Start node: Initialize the process environment and record the execution history of the start node.
[0064] 2. Business node: When calling the business interface, the memory context object and node definition are used as input parameters, without accessing the database to obtain the definition or context information. After execution is completed, the output content of the node is written back to the memory context object, and the node execution history is recorded.
[0065] 3. Serial branch node: traverse the sub-node set and execute the sub-nodes one by one in a single-threaded order to ensure the continuity and consistency of the process logic.
[0066] 4. Parallel branch nodes: allocate thread pools and use multi-threading to process multiple child nodes in parallel. After all branch nodes are executed, continue to process subsequent nodes.
[0067] 5. End node: marks the end of the process, updates the process instance history, and clears the context objects and other temporary data in the memory.
[0068] The execution logic of a single process instance is completed in the same process, avoiding the performance overhead caused by cross-process communication. Different process instances can be assigned to independent processes to run, making full use of multi-core CPU resources and achieving linear expansion of concurrent performance.
[0069] The memory context object undertakes all state storage tasks in process execution, avoiding frequent access to database query definitions or reading output data during node execution. This design significantly improves execution efficiency and reduces the pressure on the database. Through Redis cache and memory-level context operations, the system achieves efficient process scheduling and node execution. Compared with traditional database-dependent solutions, this method has more performance advantages, especially for high-concurrency scenarios. The method adopts a single-body mode without the need to add additional server components. Its lightweight characteristics make it easy to integrate into low-code platforms or other development frameworks. The JSON-based process definition method and modular business node design make the addition, modification and maintenance of processes more intuitive and convenient. Through standardized interfaces, developers can quickly integrate new functions to meet diverse business needs. Executing process scheduling in the process and combining memory context objects effectively optimizes process execution efficiency while reducing the complexity of deployment and development. Its lightweight design and high performance make it particularly suitable for low-code platforms and other service scenarios with high requirements for real-time and scalability. Through precise logical design and reasonable technology selection, efficient parsing and execution of process instances are achieved. The overall architecture is simple and efficient based on Redis memory cache and context objects, which greatly reduces database dependence. The modularization of the execution process is to define the process logic through JSON and implement the node function in combination with Java interface. The performance is significantly improved through the parallel design of memory-level cache and process isolation.
[0070] The process definition specification uses JSON arrays for structured description. Each node is stored in the form of a standard JSON object. For ease of explanation and to show its key structure and logic, the specific node definition code is as follows:
[0071] [{
[0072] "Node Name":"Start Node",
[0073] "Node Type":"begin",
[0074] "Node ID":"node_1",
[0075] "Previous node ID":"",
[0076] "Next node identifier":"node_2",
[0077]
[0078]
[0079] The whole process is divided into four stages: initialization, node parsing, node execution, and process completion. The unique identification and execution status of each process instance are saved to ensure isolation and consistency when multiple instances are executed concurrently. The execution status, output results, and context-related data of all nodes are dynamically stored to facilitate real-time acquisition of scheduling logic. During the process execution, cross-node data transmission is supported to avoid redundant external storage and query. The context object is the core storage carrier for the operation of the process instance. The code of the context object is as follows:
[0080]
[0081] *Process execution context object
[0082] * /
[0083] @Data
[0084] public class FlowInstanceContext{
[0085] / **
[0086] *Process instance id
[0087] * /
[0088] private String flowInstanceId;
[0089] / **
[0090] *Process ID
[0091] * /
[0092] private String flowId;
[0093] / **
[0094] *Process instance definition
[0095] * /
[0096] Private Map<String,FlowNodeExtend> flowNodeDefineMap=newConcurrentHashMap();
[0097] / **
[0098] *Process link output
[0099]
[0100] In the technical solution of this embodiment, the parsing, node scheduling and execution of the process instance are all performed in the process, and the definition, output and status information of the node are stored in the memory context object of the process. During the execution process, there is no need to query the node definition and the output content of each node from the database. The reading efficiency of the memory cache is significantly higher than that of the database or third-party cache, thereby improving the execution performance of the process instance.
[0101] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0102] Reference Figure 6 , shows a structural block diagram of an execution device of a process instance provided in an embodiment of the present invention, which may specifically include the following modules:
[0103] The cache module 61 is used to obtain the process definition involved in the process instance from the database when receiving a request to execute the process instance, and cache the process definition in redis in the form of a process memory object;
[0104] The writing module 62 is used to generate a unique identifier of the process instance, and write any one or more of the identifier of the process definition associated with the process instance, the execution time information, and the execution status information into the process instance table corresponding to the unique identifier of the process instance;
[0105] The establishment module 63 is used to establish and initialize the memory context object of the process instance, and the memory context object is used to store the context information of the process instance, and the context information includes any one or more of the unique identifier of the process instance, the attributes of any node, the process instance execution parameters, the output content of any node and the instance execution status;
[0106] The execution module 64 is used to execute all nodes in the process instance in sequence according to the scheduling logic order of the process instance.
[0107] The cache module 61, the writing module 62, the establishing module 63 and the executing module 64 included in the block diagram of the execution device of the process instance are controlled to execute the execution method of the process instance described in any of the above embodiments.
[0108] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0109] In addition, an embodiment of the present invention further provides an electronic device, such as Figure 7 As shown, it includes a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704.
[0110] Memory 703, used for storing computer programs;
[0111] The processor 701 is used to execute the program stored in the memory 703, and implements the following steps: when receiving a request to execute a process instance, obtain the process definition involved in the process instance from the database; generate a unique identifier of the process instance and write it into the process instance table corresponding to the unique identifier of the process instance; establish and initialize the memory context object of the process instance; and execute all nodes in the process instance in sequence according to the scheduling logic order of the process instance. The communication bus mentioned in the above terminal can be a peripheral component interconnect standard (PCI) bus or an extended industry standard architecture (EISA) bus. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0112] The communication interface is used for communication between the above terminal and other devices.
[0113] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0114] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0115] like Figure 8 As shown, in another embodiment provided by the present invention, a computer-readable storage medium 801 is also provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the execution method of the process instance described in the above embodiment.
[0116] In another embodiment provided by the present invention, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the execution method of the process instance described in the above embodiment.
[0117] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.
[0118] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0119] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0120] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A method for executing a process instance, characterized in that: include: When a request to execute a process instance is received, the process definition involved in the process instance is obtained from the database, and the process definition is cached in redis in the form of a process memory object; Generate a unique identifier for the process instance, and write any one or more of the identifier of the process definition associated with the process instance, execution time information, and execution status information into a process instance table corresponding to the unique identifier of the process instance; Establishing and initializing a memory context object of the process instance, the memory context object is used to store context information of the process instance, the context information including any one or more of a unique identifier of the process instance, attributes of any node, process instance execution parameters, output content of any node, and instance execution status; All nodes in the process instance are executed in sequence according to the scheduling logic order of the process instance.
2. The method for executing a process instance according to claim 1, characterized in that: Also includes: A process definition table is pre-established using the JSON data specification, which includes any one or more of a start node, a serial branch node, a parallel branch node, a business node, and an end node, wherein the attributes of any node include any one or more of an identifier, a node type, a node business content definition, input parameters, output parameters, a child node set, and a next node.
3. The method for executing a process instance according to claim 1, wherein: Also includes: Through the execution business interface of the node, the java class corresponding to the node is executed to realize the function of the node.
4. The method for executing a process instance according to claim 1, wherein: Also includes: Use one process to run any execution instance. Multiple execution instances of the same type correspond to different processes.
5. The method for executing a process instance according to claim 1, wherein: Also includes: The process definition is defined in a JSON array, and the process definition includes any one or more of a business process and an execution logic.
6. The method for executing a process instance according to claim 1, wherein: Also includes: The types of the nodes include any one or more of a start node, a service node, a serial branch node, a parallel branch node, and an end node.
7. A process instance execution device, characterized in that: include: A cache module is used to obtain the process definition involved in the process instance from the database when receiving a request to execute the process instance, and cache the process definition in redis in the form of a process memory object; A writing module, used to generate a unique identifier of the process instance, and write any one or more of the identifier of the process definition associated with the process instance, the execution time information, and the execution status information into the process instance table corresponding to the unique identifier of the process instance; An establishment module, used to establish and initialize a memory context object of the process instance, wherein the memory context object is used to store context information of the process instance, wherein the context information includes any one or more of a unique identifier of the process instance, attributes of any node, process instance execution parameters, output content of any node, and instance execution status; The execution module is used to execute all nodes in the process instance in sequence according to the scheduling logic order of the process instance.
8. The execution device of the process instance according to claim 7, characterized in that: The cache module, the writing module, the establishing module and the executing module are controlled to execute the execution method of the process instance described in any one of claims 1-6.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor is used to implement the method according to any one of claims 1 to 6 when executing the program stored in the memory.
10. A computer-readable medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 6.