Information acquisition method and device, equipment, storage medium and program product

By directly sending context information requests from sub-process nodes to root nodes for retrieval from parent nodes, the method addresses inefficiencies in context synchronization, enhancing execution efficiency and reducing database pressure in process engines.

CN119149185APending Publication Date: 2024-12-17MASHANG CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410969930.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-18
Publication Date
2024-12-17

AI Technical Summary

Technical Problem

In complex business scenarios, synchronizing context information between parent and sub-processes in a process engine leads to inefficiencies due to data copying and increased database pressure, slowing down execution efficiency.

Method used

Directly send a context information reading request from a sub-process node to the root process node, allowing the root process node to obtain and return the context information from the parent process node, which is then sent to the sub-process node, eliminating the need for copying and reducing database pressure.

Benefits of technology

Improves the efficiency of sub-process node context information retrieval by avoiding data copying and reducing database load, enhancing overall process engine throughput.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119149185A_ABST
    Figure CN119149185A_ABST
Patent Text Reader

Abstract

The invention discloses an information acquisition method and device, equipment, a storage medium and a program product, and relates to the technical field of computer application. In the method, in response to a contextual information reading request initiated by a sub-process node, a root process node of the sub-process node is determined; sending the context information reading request to a root process node, and receiving context information returned by the root process node; the context information is obtained by the root process node from a parent process node of the child process nodes; and sending the context information to the sub-process node. When the sub-process node reads the context information of the parent process node, the context information reading request is directly sent to the root process node, and the context information returned by the root process node is received, so that the sub-process node does not need to copy the context information of the parent process node; and the sub-process node only needs to apply the context information in the memory, so that the efficiency of reading the context information of the parent process node by the sub-process node is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer application technology, and in particular to an information acquisition method, device, equipment, storage medium and program product. Background Art

[0002] Business Process Modeling Notation (BPMN) is a set of rules for standardizing process definitions. It can use standard graphics to describe the actual business process and ensure that the same process obtains consistent execution results in different process engines.

[0003] In complex business scenarios, the workflow of the process engine is very complex, and each link of the workflow needs to be abstracted into sub-processes, that is, multiple new processes will be created during the flow of the process, so as to improve the readability and reusability of the flowchart of the process engine.

[0004] In this process, the sub-process often needs to read the context information of the parent process for data processing. Therefore, how to synchronize the context information of the sub-process node from the parent process node has become a hot research issue. Summary of the invention

[0005] The present application provides an information acquisition method, apparatus, device, storage medium and program product for improving the efficiency of a sub-process node reading context information of a parent process node.

[0006] In a first aspect, an embodiment of the present application provides an information acquisition method, the method comprising:

[0007] In response to a context information reading request initiated by a sub-process node, determining a root process node of the sub-process node;

[0008] Sending the context information reading request to the root process node, and receiving the context information returned by the root process node; the context information is obtained by the root process node from the parent process node of the child process node;

[0009] The context information is sent to the sub-process node.

[0010] In an embodiment of the present application, when a sub-process node reads the context information of a parent process node, a context information reading request is directly sent to the root process node, and the root process node obtains the context information from the parent process node. Then, the sub-process node only needs to receive the context information of the parent process node returned by the root process node, so that the sub-process node only needs to call the context information of the parent process node for application, and does not need to copy the context information of the parent process node. Moreover, the sub-process node only needs to use the context information in the memory, and does not need to copy the context information and paste the context information into the database, which reduces the data pressure on the process engine database, thereby improving the efficiency of the sub-process node in reading the context information of the parent process node.

[0011] In a second aspect, an embodiment of the present application provides an information acquisition device, the device comprising:

[0012] A determination module, configured to determine a root process node of the sub-process node in response to a context information reading request initiated by the sub-process node;

[0013] A transceiver module, used to send the context information reading request to the root process node, and receive the context information returned by the root process node; the context information is obtained by the root process node from the parent process node of the sub-process node;

[0014] A sending module is used to send the context information to the sub-process node.

[0015] In a third aspect, an embodiment of the present application provides an information acquisition device, comprising: at least one processor, and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the at least one processor implements the method described in the first aspect by executing the instructions stored in the memory.

[0016] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions. When the computer instructions are executed on a computer, the computer executes the method as described in the first aspect.

[0017] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising computer instructions, which, when executed on a computer, enables the method described in the first aspect to be implemented.

[0018] Regarding the beneficial effects of the second to fifth aspects, reference can be made to the contents described in the first aspect above, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. Obviously, the drawings introduced below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0020] Figure 1 A UML diagram of an activity execution provided in an embodiment of the present application;

[0021] Figure 2 A functional block diagram of sharing context information provided in an embodiment of the present application;

[0022] Figure 3 A schematic diagram of an application scenario of an information acquisition method provided in an embodiment of the present application;

[0023] Figure 4 A flowchart of an information acquisition method provided in an embodiment of the present application;

[0024] Figure 5 A schematic diagram of an interceptor execution chain provided in an embodiment of the present application;

[0025] Figure 6 A functional block diagram of an information acquisition method provided in an embodiment of the present application;

[0026] Figure 7 A schematic diagram of the overall process of an information acquisition method provided in an embodiment of the present application;

[0027] Figure 8 A schematic diagram of the structure of an information acquisition device provided in an embodiment of the present application;

[0028] Fig. 9 A schematic diagram of the structure of an information acquisition device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0030] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.

[0031] The terms "first", "second", "third", etc. in the specification and claims of this application and the above drawings are used to distinguish similar or similar objects or entities, and do not necessarily mean to limit a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.

[0032] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.

[0033] The term "module" refers to any known or later developed hardware, software, firmware, artificial intelligence, fuzzy logic, or combination of hardware and / or software code that is capable of performing the functions associated with that element.

[0034] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

[0035] For the convenience of explanation, the above description has been made in conjunction with specific embodiments. However, the above exemplary discussion is not intended to be exhaustive or limit the embodiments to the specific forms disclosed above. Based on the above teachings, various modifications and variations can be obtained. The selection and description of the above embodiments are to better explain the principles and practical applications, so that those skilled in the art can better use the embodiments and various different variations of the embodiments suitable for specific use considerations.

[0036] In order to facilitate understanding of the technical solutions provided by the embodiments of the present application, professional terms related to the embodiments of the present application are first introduced here.

[0037] Process engine: also known as workflow engine, a software used to drive business to flow according to a set fixed process. The process engine mentioned in this application follows the BPMN2.0 specification by default. Different process engines may have slightly different implementations of BPMN2.0. The process engines involved in the technical solutions provided in the embodiments of this application are all Camunda7.6.

[0038] Camunda: Camunda is a Java-based workflow framework that supports the BPMN2.0 specification. This application demonstrates the architecture implementation of BPMN2.0 based on Camunda.

[0039] Process node: a task processing node in the process engine, used to execute business logic. The BPMN2.0 specification defines process nodes as tasks, gateways, events, sub-processes, extended applications, etc.

[0040] Service Task: Used to call services. In the process engine, a service task provides a work item for an external worker by calling Java code.

[0041] Subprocess: A new process created during the process flow is called a subprocess. After the subprocess ends, it can return to the parent process and call the process node of the subprocess from the parent process to continue execution.

[0042] Process Virtual Machine (PVM): provides a set of standardized APIs (Application Programming Interface) to abstract and define the most basic parts of the workflow. PVM can create other PVM objects and build a PVM execution tree during the workflow runtime. The running sub-process is a typical PVM execution tree.

[0043] Scope: PVM introduces the concept of scope to manage and isolate process data of multiple processes on the PVM execution tree.

[0044] Context information: A collection of process data shared in a PVM scope. Generally speaking, context information belongs to a specific scope, and the process instances in the PVM execution tree have separate scopes, so the context information between each process is isolated.

[0045] It should be noted that the operation of the process engine is essentially to execute atomic operations one by one in a pre-arranged order. The process engine provides the PvmAtomicOperation (virtual atomic activity) interface to support various atomic operations of BPMN2.0. The function of this interface is to call the execute (PvmExecutionImpl execution) method (virtual execution implementation method) of this interface to execute a single-step operation in the process instance. The input parameter of this method is the current execution instance reference.

[0046] PvmAtomicOperationActivityExecute provides execution actions for process nodes of the process engine. It obtains the ActivityBehavior interface of the current node and executes its execute method. The implementation of this interface provides business logic implementation for different process nodes. For the ServiceTask node, the process engine provides the TaskActivityBehavior interface that obtains the task processing class from the Spring container.

[0047] The task processing class interfaces of different process engines are different. The process engine Camunda in this application supports two interfaces: ActivityBehavior and JavaDelegate. The technical solution provided in the embodiment of this application is implemented based on JavaDelegate, and the implementation steps based on ActivityBehavior are consistent with the implementation steps based on JavaDelegate, so no further details will be given here.

[0048] Next, the background technology related to the embodiments of the present application is introduced.

[0049] Business Process Modeling Notation (BPMN) is a set of rules for standardizing process definitions. It can use standard graphics to describe the actual business process and ensure that the same process gets consistent execution results in different process engines. In complex business scenarios, the workflow of the process engine is very complex.

[0050] ExecutionEntity is an execution instance of a process after it is started, representing the runtime state of the process. ExecutionEntity implements the ActivityExecution interface, which is the activity execution interface in PVM. Figure 1 It is a UML (Unified Modeling Language) diagram of ActivityExecution.

[0051] like Figure 1As shown in the figure, the ActivityExecution interface inherits the DelegateExecution interface, which is the input parameter of the task execution interface JavaDelegate of the ServiceTask node. The DelegateExecution interface inherits the VariableScope interface, which is a scope interface. It has the same life cycle as the execution instance and is only shared in this execution instance. In addition, the DelegateExecution interface can interact with the VariableScope interface through the BaseDelegateExecution interface, the ProcessEngineServicesAware interface, and the BpmnModelExecutionContext interface.

[0052] The workflow of the process engine needs to abstract each link of the workflow into a sub-process. The specific implementation is: the ActivityExecution interface has a very important attribute isScope (binding scope). When the isScope attribute is true, the execution instance will create a new ExecutionEntity (execution instance) when executing a node with a scope or executing a process definition, that is, a sub-process will be created, and a new VariableScope (variable scope) will be created for the sub-process.

[0053] The current process engine uses the Copying algorithm to achieve context sharing between the parent process and the child process. Figure 2 The figure shows the functional block diagram of the current shared context information. When the sub-process is started, a copy of the parent process context information is copied from the parent process as the initialization context information for the sub-process startup and written into the sub-process context information. The sub-process node directly reads the sub-process context information including the parent process context information. After the sub-process is executed, the sub-process context information including the parent process context information is written back to the parent process context.

[0054] In this process, if the parent process has a lot of context information data, copying the parent process context information will increase the interaction time between the parent and child process nodes and slow down the execution efficiency of the child process. At the same time, when copying the parent process context information to the child process context information, the copied context information needs to be pasted into the database first, and then used in the memory of the child process node, so that there are multiple identical context information in the database, which reduces the space of the child process node, increases the data pressure of the process engine database, and reduces the efficiency of the child process node in obtaining the context information of the parent process node. In addition, during the operation of the sub-process, two or even more copies (nested sub-processes) of context information will be stored. When the sub-process context information including the parent process context information is written back to the parent process context at the end of the sub-process execution, the amount of data of the parent process will increase dramatically, making the operation efficiency of the sub-process and the parent process low.

[0055] In view of this, an embodiment of the present application provides an information acquisition method, which responds to a context information reading request initiated by a sub-process node, determines the root process node of the sub-process node; sends the context information reading request to the root process node, and receives the context information returned by the root process node; wherein the context information is obtained by the root process node from the parent process node of the sub-process node; and sends the context information to the sub-process node. When the sub-process node reads the context information of the parent process node, the context information reading request is directly sent to the root process node, and the root process node obtains the context information from the parent process node. Then, the sub-process node only needs to receive the context information returned by the root process node, so that the sub-process node does not need to copy the context information of the parent process node, and the sub-process node only needs to use the context information in the memory, thereby improving the efficiency of the sub-process node reading the context information of the parent process node.

[0056] In order to better understand the embodiments of the present application, the application scenarios applicable to the embodiments of the present application are described below.

[0057] Please refer to Figure 3 , is a schematic diagram of an application scenario of an information acquisition method provided in an embodiment of the present application. Figure 3 As shown, the scenario diagram includes a process execution device 110 and an information acquisition device 120. The process execution device 110 and the information acquisition device 120 can perform wired or wireless communication.

[0058] like Figure 3As shown, the user can input the business and business logic to be executed on the process execution device 110. Among them, the process engine installed in the process execution device 110 executes the process of business logic. When executing the process of business logic, if a sub-process is started, after the sub-process is started, if a context information reading request is initiated, the information acquisition device 120 responds to the context information reading request initiated by the sub-process node, determines the root process node of the sub-process node; sends the context information reading request to the root process node, and receives the context information returned by the root process node; the context information is obtained by the root process node from the parent process node of the sub-process node; the context information is sent to the sub-process node to synchronize the context information of the sub-process node from the parent process node.

[0059] It should be noted that Figure 3 The process execution device 110 and the information acquisition device 120 shown in the figure may be two different devices, or modules on two different devices, or modules in the same device, which is not limited in the embodiment of the present application.

[0060] Of course, the method provided in the embodiment of the present application is not limited to Figure 3 The application scenarios shown can also be used in other possible application scenarios, and the embodiments of the present application are not limited thereto. Figure 3 The functions that can be implemented by each device in the application scenario shown will be described in the subsequent method embodiments, and will not be described in detail here.

[0061] Please refer to Figure 4 , is a flow chart of an information acquisition method provided in an embodiment of the present application. The information acquisition method is executed by an information acquisition device, and the information acquisition device can be a terminal or a server. Among them, the terminal can be a vehicle-mounted device, a mobile phone, a tablet, a computer, a cellular phone, a cordless phone, a personal digital assistant (PDA), a handheld device, a computing device, a wearable device, etc. The server can be a physical server or a server cluster composed of multiple servers. Figure 4 The information acquisition method can be specifically executed by a processor of an information acquisition device.

[0062] like Figure 4 As shown, the method comprises the following steps:

[0063] S401, in response to a context information reading request initiated by a sub-process node, determining a root process node of the sub-process node.

[0064] In a possible implementation, in response to a context information reading request initiated by a sub-process node, determining a root process node of the sub-process node may be performed in the following two implementations:

[0065] Implementation method one: parse the context information reading request to determine the field information of the sub-process node; the field information includes the identification information of the node on the path from the sub-process node to the root process node; split the field information according to the field information parsing rules, and determine the root process node of the sub-process node based on the splitting result.

[0066] In a possible implementation, if the field information has been split according to the field information parsing rules, the number of nodes M on the path from the sub-process node to the root process node is determined based on the splitting result; then the root process node of the sub-process node is determined based on the number of nodes M.

[0067] If the number of nodes M is equal to 1, the node identified by the identification information in the field information is determined as the root process node of the sub-process node.

[0068] If the number of nodes M is a positive integer greater than 1, the root process node of the sub-process node is determined according to any of the following two methods:

[0069] Method 1: Based on the M identification information and the splitting order of the M nodes, the identification information of the root process node of the sub-process node is determined; and the node identified by the identification information of the root process node is determined as the root process node of the sub-process node.

[0070] Among them, the splitting starts from the sub-process node on the path from the sub-process node to the root process node, the identification information of the last split node is the identification information of the root process node, and the node represented by the identification information is used as the root process node of the sub-process node.

[0071] Method 2: Parse the context information reading request to determine the business identifier of the sub-process node; obtain the identification information of the root process node of the sub-process node from the root process node cache based on the business identifier of the sub-process node; the root process node cache includes a mapping relationship between the business identifier and the identification information of the root process node; determine the node identified by the identification information of the root process node as the root process node of the sub-process node.

[0072] In specific implementation, the context information reading request of the sub-process node carries the identification information executionId (execution identification) of the sub-process node, as well as field information. Among them, the field information includes the identification information of M nodes on the path from the sub-process node to the root process node. Therefore, when determining the root process node, it is necessary to parse the field information according to the field information parsing rules to obtain the identification information of M nodes. Then it is necessary to determine whether the sub-process node has a parent process node.

[0073] In the embodiment of the present application, the process engine provides two methods, getParentId() (get parent node identifier()) and getSuperExecution() (get super execution()), as the basis for associating with the parent process node. By calling getParentId() or getSuperExecution() of the DelegateExecution interface, the field information of the sub-process node is parsed and split, and the sub-process node is determined whether it has a parent process node based on the split result:

[0074] If it is determined that the number of nodes M on the path from the sub-process node to the root process node is equal to 1, it is determined that the sub-process node has no parent process node and the sub-process node itself is the root process node. Then the node identified by the identification information in the field information is determined as the root process node of the sub-process node. At the same time, the identification information executionId (execution identification) of the sub-process node and the reference (identification information of the root process node) are added to the rootExecutionCache (root process node cache).

[0075] If it is determined that the number of nodes M on the path from the sub-process node to the root process node is greater than 1, it is determined that the sub-process node has a parent process node, and the root process node of the sub-process node is determined according to any of the following two methods:

[0076] According to the splitting order of the M nodes, starting from the identification information of the sub-process node, index forward step by step on the path from the sub-process node to the root process node until the identification information of the root process node of the sub-process node is obtained, and the node identified by the identification information of the root process node is determined as the root process node of the sub-process node. At the same time, the executionId (execution identification) and reference of the sub-process node are added to the root process node cache.

[0077] Alternatively, the context information reading request is parsed to determine the business identifier of the sub-process node, and the identification information of the root process node of the sub-process node is obtained from the rootExecutionCache (root process node cache) according to the getParentId() (get parent node identifier()) method or the getSuperExecution() (get super execution()) method, and the node identified by the identification information of the root process node is determined as the root process node of the sub-process node. At the same time, the executionId (execution identifier) ​​and reference of the sub-process node are added to the root process node cache.

[0078] Implementation method two: parse the context information reading request to determine the business identifier of the sub-process node; obtain the identification information of the root process node of the sub-process node from the root process node cache based on the business identifier of the sub-process node; the root process node cache includes a mapping relationship between the business identifier and the identification information of the root process node; determine the node identified by the identification information of the root process node as the root process node of the sub-process node.

[0079] In a possible implementation, if the field information is not split according to the field information parsing rule, it is possible to choose not to split the field information, and directly determine the root process node of the sub-process node according to the implementation.

[0080] The specific implementation is to parse the context information reading request, determine the business identifier of the sub-process node, obtain the identification information of the root process node of the sub-process node from the rootExecutionCache (root process node cache) according to the getParentId() (get parent node identifier()) method or the getSuperExecution() (get super execution()) method, and determine the node identified by the identification information of the root process node as the root process node of the sub-process node. At the same time, add the executionId (execution identifier) ​​and reference (identification information of the root process node) of the sub-process node to the root process node cache.

[0081] The root process node cache is established by the process engine where the sub-process node is located before executing the process of the root process node; the root process node cache is established in the following way:

[0082] For any business, the process engine obtains the business logic of the business and encapsulates the business logic into the command execution method of the process engine to obtain the encapsulated command execution method; the process engine executes the business logic process based on the encapsulated command execution method, and when executing the business logic process, records the identification information of the business root process node and the business identification of the business; the business identification and the identification information of the root process node are associated and stored in the root process node cache.

[0083] In specific implementation, the process engine implements PVM based on the command mode, that is, encapsulating the "execution action" of the workflow into a Command interface implementation class, and encapsulating the business logic of the "execution action" into the execute() method of the Command interface, and the command is run in the command context (CommandContext). The command context is not the same as the process context, and the process context is part of the command context.

[0084] The command execution uses the responsibility chain mode. In simple terms, there is a process engine such as Figure 5 The command interceptor execution chain is shown. Figure 5 As shown in the figure, there is an important interceptor object in the command interceptor execution chain: the default command interceptor. Before the subsequent command execution interceptor is executed, the current context environment is checked. If the CommandContext object does not exist, the command context is created before the command execution interceptor is executed; after the subsequent command execution interceptor is executed, all data persistence objects in the cache are flushed and the CommandContext object is closed.

[0085] Therefore, in the embodiment of the present application, after starting the process engine, the business logic of the business is executed, and the root process node cache is created at the same time. First, a user-defined ExecutionCacheInterceptor is added, and then the ExecutionCacheInterceptor creates the rootExecutionCache of the PVM root process node, and ensures that the rootExecutionCache survives the entire life cycle of the command execution, and realizes the automatic recycling of the rootExecutionCache. The implementation steps are as follows:

[0086] First, encapsulate the business logic of the business into the command execution method of the process engine of the business to obtain the encapsulated command execution method, that is, define the interceptor, and rewrite the execute() method of CommandInterceptor according to the business logic by calling the CommandInterceptor interface to obtain the rewritten command execution method.

[0087] Then, define rootExecutionCache (root process node cache). The cache structure of rootExecutionCache is ThreadLocal <Map<String,DelegateExecutionProxy> >.

[0088] Among them, ThreadLocal is a thread-local variable, which is thread-private data. The process engine salvage mechanism supports the same task being salvaged by multiple jobs (tasks). The use of thread-local variables can isolate each process by thread. The Map key stores the primary key of the PVM execution instance, that is, the identification information executionId of each sub-process node; the Map value stores the execution instance reference of the root process node of the PVM execution tree where the execution instance is located, that is, the identification information of the root process node of each sub-process node. Using java polymorphism and using the DelegateExecution type to store references can hide PVM's implementation of other interfaces.

[0089] Then, the next interceptor of the user-defined execution cache interceptor (ExecutionCacheInterceptor) in the command interceptor execution chain is the command execution interceptor, and the command will be executed in the command execution interceptor. After the command execution is completed, the rootExecutionCache (root process node cache) is set to be recycled to ensure that the life cycle of the rootExecutionCache is consistent with that of the parent and child process nodes.

[0090] Finally, the user-defined execution cache interceptor (ExecutionCacheInterceptor) is injected into the command interceptor execution chain. The injection method is: through the ProcessEnginePlugin (process engine plug-in) interface provided by the process engine, rewrite the preInt (print) method of the interface, and inject it into the spring (application framework) platform. The preInt method will call the ExecutionCacheInterceptor when the process engine starts.

[0091] Add the user-defined execution cache interceptor (ExecutionCacheInterceptor) to the two properties of the ProcessEngineConfigurationImpl (process engine related configuration information) class through the ProcessEnginePlugin interface provided by the process engine to implement the expansion of the command interceptor execution chain. The types of these two properties are both List (list) collections of interceptors:

[0092] One is the customPostCommandInterceptorsTxRequired (need to customize the tx command interceptor) attribute;

[0093] One is the customPostCommandInterceptorsTxRequiresNew (need to customize the new tx command interceptor) property.

[0094] After the definition of rootExecutionCache (root process node cache) is completed and the responsibility chain pattern used for command execution is extended, the process engine executes the business logic process based on the encapsulated command execution method, and when executing the business logic process, it records the identification information of the business root process node and the business identification of the business; the business identification and the identification information of the root process node are associated and stored in the root process node cache.

[0095] Thus, the root process node cache is successfully established, and the root process node cache includes a mapping relationship between the business identifier and the identification information of the root process node.

[0096] The root process node of a PVM execution tree is constant. Therefore, in the embodiment of the present application, it is not necessary to recursively search for the root process node from the sub-process node layer by layer as in the parent delegation mechanism. Instead, a root process node cache that conforms to the business logic can be directly established in the process engine, and the business identifier of the business and the identification information of the root process node are associated and stored in the root process node cache. As a result, when the sub-process is running, the root process node of the sub-process node can be directly obtained from the root process node cache without the need for layer-by-layer indexing, making the DelegateExecutionProxy (proxy object) extremely efficient in task delegation, almost as efficient as directly operating the sub-process context, and speeding up the efficiency of determining the root process node.

[0097] S402, sending a context information reading request to the root process node, and receiving context information returned by the root process node; the context information is obtained by the root process node from the parent process node of the sub-process node.

[0098] In a possible implementation, the operations of the parent process node and the child process node on the context information are all atomic operations, and the context information reading request delegated by the child process node to the parent process node is generally unlikely to fail. Therefore, in the embodiment of the present application, the context information reading request initiated by the child process node can be directly sent to the proxy object, and the proxy object sends the context information reading request to the root process node through the access interface matched by the root process node, and directly receives the context information returned by the root process node.

[0099] See also Figure 6 , is a functional block diagram of an information acquisition method provided in an embodiment of the present application. Figure 6As shown, in the present application, after the sub-process is started, the sub-process node initiates a context information reading request, which is sent to the DelegateExecution interface matching the root process node of the PVM execution tree via the DelegateExecutionProxy (proxy object). The DelegateExecution interface matching the root process node directly calls the context information of the parent process node of the sub-process node to the proxy object, and then the proxy object sends the context information of the parent process node to the sub-process node. The sub-process node only needs to use the context information of the parent process node in memory.

[0100] Among them, the working principle of DelegateExecutionProxy (proxy object) is basically similar to the parent delegation algorithm in the Java virtual machine (JVM) class loading mechanism, but there are also differences. The difference between the two is that the parent delegation algorithm is not necessarily the root loader (Bootstrap ClassLoader) to execute the class loading request. If the parent class loader cannot handle the loading request, the class loading request will still be handed over to the subclass for processing. The DelegateExecutionProxy (proxy object) in this application sends all the context information acquisition requests of the sub-process node to the root process node, and the variable scope of the root process node is obtained from the parent process node of the sub-process node.

[0101] In a possible implementation, after determining the root process node of the sub-process node, it is also necessary to determine whether a context information reading request can be sent to a proxy object, and the proxy object sends the context information reading request to the root process node through an access interface matched by the root process node. Therefore, a determination method is provided in an embodiment of the present application: determining whether a context information reading request can be sent to a proxy object based on the interface type of the root process node, and the proxy object sends the context information reading request to the root process node through an access interface matched by the root process node.

[0102] Further execution is: based on the interface definition rules and the root process node of the sub-process node, determine the interface type of the root process node of the sub-process node; when the interface type is the same as the interface type of the access interface matching the root process node, the proxy object sends the context information reading request to the root process node through the access interface.

[0103] In specific implementation, the interface type of the root process node in this application is obtained after obtaining the root process node, and the Class object instance of the interface definition class is obtained according to the getDeclaringClass (declaration class) object of the Method (method) object in the process engine, that is, the interface type of the root process node is obtained according to the pre-configured interface definition rules. After obtaining the interface type of the root process node, the interface type of the root process node is compared with the interface type of the access interface matched by the root process node. If the interface type of the root process node is different from the interface type of the access interface matched by the root process node, the step of sending the context information read request to the proxy object and sending the context information read request to the root process node through the access interface matched by the root process node is not executed. If the interface type of the root process node is the same as the interface type of the access interface matched by the root process node, the context information read request is sent to the proxy object, and the proxy object sends the context information read request to the root process node through the access interface matched by the root process node.

[0104] The interface type of the access interface matched by the root process node is set in advance according to the functional requirements of the business. The interface definition rules are set according to business requirements when the process engine environment is established, and the embodiment of the present application does not limit this.

[0105] Exemplarily, if the interface type of the access interface matched by the root process node is VariableScope (variable scope), and the interface type of the root process node is not VariableScope, the step of sending the context information reading request to the proxy object and sending the context information reading request to the root process node through the access interface matched by the root process node is not performed. If the interface type of the root process node is VariableScope, the context information reading request is sent to the proxy object, and the proxy object sends the context information reading request to the root process node through the access interface matched by the root process node.

[0106] Furthermore, in order to minimize code intrusion, the process of determining whether the interface type of the root process node is the same as the interface type of the access interface matching the root process node is set as a global configuration to ensure that the program automatically takes effect when calling the PVM interface.

[0107] In this embodiment, by determining that the interface type of the root process node is the same as the interface type of the access interface matching the root process node, it is ensured that the context information reading request is smoothly sent to the root process node, and the context information of the parent process node of the sub-process node sent by the root process node is received.

[0108] Therefore, the sub-process node does not need to copy the context information of the parent process node. Similarly, when the sub-process runs to the end, it is not necessary to write back the context information of the parent process node. At the same time, all operations to obtain context information are implemented by the proxy object by calling the DelegateExecution interface on the root process node. The context information of the sub-process node does not need to participate in the context information acquisition operation, which improves the efficiency of the sub-process node reading the context information of the parent process node.

[0109] In a possible implementation, the premise of sending the context information reading request to the proxy object and the proxy object sending the context information reading request to the root process node through the access interface matched by the root process node is that a proxy object with corresponding functions has been established. Therefore, before the process engine where the sub-process node is located in the embodiment of the present application executes the process of the root process node, it is necessary to first establish a proxy object that meets specific functional requirements through a dynamic proxy class.

[0110] In other words, the proxy object in the embodiment of the present application is established through a dynamic proxy class by the process engine where the sub-process node is located before executing the process of the root process node, and the proxy object meets specific functional requirements.

[0111] Among them, the specific functional requirements are to send a context information reading request to the root process node and receive the context information returned by the root process node.

[0112] Specifically, before the process engine where the sub-process node is located executes the process of the root process node, it needs to first establish a proxy object that meets specific functional requirements through the dynamic proxy class, and the execution is:

[0113] First, use the Aspect Oriented Programming (AOP) function of the Spring container to create a JDK dynamic proxy; then use the JDK dynamic proxy to create a proxy object that meets specific functional requirements.

[0114] The specific implementation is that the process engine where the sub-process node is located uses the AOP function of the Spring container to intercept the implementation of JavaDelegate (Java delegate) in the Spring container, and replaces the input parameters of the execute (DelegateExecution execution) method with the DelegateExecutionProxy (proxy object) passed into the DelegateExecution (delegate execution) interface. Then, the JDK dynamic proxy is used to create a DelegateExecutionProxy (proxy object), so that the proxy object sends the context information reading request of the sub-process node to the root process node of the PVM execution tree where the sub-process node is located.

[0115] S403, sending the context information to the sub-process node.

[0116] Specifically, the information stored in the variable scope of the root process node in the embodiment of the present application includes: the context information of each process node on the PVM execution tree, the identification information of each process node, and the corresponding relationship between the identification information of each process node. According to the identification information of the child process node, the context information of the parent process node is called in the variable scope of the root process node and sent to the proxy object; after the proxy object receives the context information of the parent process node returned by the root process node, it sends the context information of the parent process node to the child process node.

[0117] Furthermore, there are some special elements in the process engine. These special elements are outside the process node and are located in the PVM kernel. They cannot be captured by the Spring container, cannot create proxy objects, and cannot use the information acquisition method provided in the embodiments of the present application.

[0118] Therefore, for these special elements, a tool class VariableScopeUtil (variable scope utility) is provided in an embodiment of the present application. VariableScopeUtil implements the VariableScope (variable scope) interface, and its function is to support context operations on the current scope, and set the variables used for process reversal into the context information of the current execution instance, thereby realizing the context information acquisition operation.

[0119] For ease of understanding, combined Figure 7 The complete process of using a proxy object to execute an information acquisition method provided in an embodiment of the present application is described.

[0120] In step S701, a context information reading request initiated by a sub-process node is received;

[0121] In step S702, it is determined whether the sub-process node has a parent process node;

[0122] If the sub-process node has no parent process node, then in step S703, it is determined that the sub-process node is a root process node; if the sub-process node has a parent process node, then in step S704, the root process node of the sub-process node is determined from the root process node cache;

[0123] In step S705, it is determined whether the interface type of the root process node and the interface type of the access interface matched by the root process node are the same;

[0124] If the interface type of the root process node is the same as the interface type of the access interface that matches the root process node, then in step S706, the proxy object sends a context information read request to the root process node through the access interface and receives the context information returned by the root process node; the context information is obtained by the root process node from the parent process node of the child process node. If the interface type of the root process node is different from the interface type of the access interface that matches the root process node, step S708 is directly executed.

[0125] In step S707, the context information returned by the root process node is sent to the sub-process node.

[0126] In step S708, the information acquisition operation ends.

[0127] Therefore, when the child process node reads the context information of the parent process node, the context information reading request is directly sent to the root process node, and the root process node obtains the context information from the parent process node. Then the child process node only needs to receive the context information of the parent process node returned by the root process node, so that the child process node only needs to call the context information of the parent process node for application, and does not need to copy the context information of the parent process node. Moreover, the child process node only needs to use the context information in the memory, and does not need to copy the context information and paste the context information into the database, which reduces the data pressure of the process engine database and enables the process engine to have a higher throughput, thereby improving the efficiency of the child process node in reading the context information of the parent process node.

[0128] Based on the same inventive concept, an embodiment of the present application provides an information acquisition device, which is used to implement any of the above-mentioned information acquisition methods.

[0129] Please refer to Figure 8 , is a schematic diagram of the structure of an information acquisition device provided in an embodiment of the present application. Figure 8 As shown, the device 800 includes a determination module 801 , a transceiver module 802 , and a sending module 803 .

[0130] A determination module 801 is used to determine the root process node of the sub-process node in response to a context information reading request initiated by the sub-process node;

[0131] The transceiver module 802 is used to send the context information reading request to the root process node, and receive the context information returned by the root process node; the context information is obtained by the root process node from the parent process node of the child process node;

[0132] The sending module 803 is used to send the context information to the sub-process node.

[0133] In a possible implementation, the transceiver module 802 is specifically used to: send the context information reading request to the proxy object, and the proxy object sends the context information reading request to the root process node through the access interface matched by the root process node.

[0134] In one possible implementation, the proxy object is established through a dynamic proxy class by the process engine where the sub-process node is located before executing the process of the root process node, and the proxy object meets specific functional requirements; the specific functional requirements are to send the context information reading request to the root process node, and to receive the context information returned by the root process node.

[0135] In a possible implementation manner, the determining module 801 is specifically configured to:

[0136] Parsing the context information reading request to determine the field information of the sub-process node; the field information includes identification information of nodes on the path from the sub-process node to the root process node;

[0137] The field information is split according to the field information parsing rule, and the root process node of the sub-process node is determined according to the splitting result.

[0138] In a possible implementation manner, the determining module 801 is specifically configured to:

[0139] Parsing the context information reading request to determine the service identifier of the sub-process node;

[0140] Based on the business identifier of the sub-process node, obtaining the identification information of the root process node of the sub-process node from the root process node cache; the root process node cache includes a mapping relationship between the business identifier and the identification information of the root process node;

[0141] The node identified by the identification information of the root process node is determined as the root process node of the sub-process node.

[0142] In a possible implementation, the device further includes a creation module: the root process node cache is established by the process engine where the sub-process node is located before executing the process of the root process node; the root process node cache is established in the following manner:

[0143] For any business, the process engine obtains the business logic of the business and encapsulates the business logic into the command execution method of the process engine to obtain the encapsulated command execution method; the process engine executes the process of the business logic based on the encapsulated command execution method, and when executing the process of the business logic, records the identification information of the root process node of the business and the business identification of the business; the business identification and the identification information of the root process node are associated and stored in the root process node cache.

[0144] In a possible implementation manner, the transceiver module 802 is specifically configured to:

[0145] Determine the interface type of the root process node of the sub-process node based on the interface definition rule and the root process node of the sub-process node;

[0146] In the case where the interface type is the same as the interface type of the access interface matched with the root process node, the proxy object sends the context information reading request to the root process node through the access interface.

[0147] Based on the same inventive concept, an embodiment of the present application provides an information acquisition device, which is used to implement any of the above-mentioned information acquisition methods.

[0148] Refer to the following Fig. 9 To describe the information acquisition device according to this embodiment of the present application. Fig. 9 The information acquisition device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0149] like Fig. 9 As shown, the information acquisition device is in the form of a general electronic device. The components of the information acquisition device may include but are not limited to: at least one processor 901, at least one memory 902, and a bus interface 903 connecting different system components (including the memory 902 and the processor 901).

[0150] The memory 902 is used to store instructions executable by the processor 901;

[0151] Among them, Fig. 9In the embodiment, the bus interface 903 may include any number of interconnected buses and bridges, specifically linking together various circuits of one or more processors 901 represented by the processor and memory 902 represented by the memory. The bus architecture may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. The bus interface 903 provides an interface. Optionally, the processor 901 may be a CPU (central processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field-Programmable Gate Array) or a CPLD (Complex Programmable Logic Device), and the processor 901 may also adopt a multi-core architecture.

[0152] The processor 901 executes the information acquisition method described in any one of the above embodiments by calling the computer program stored in the memory 902 .

[0153] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 902 including instructions, and the instructions can be executed by the processor 901 to complete the above-mentioned information acquisition method. Optionally, the storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0154] In an exemplary embodiment, a computer program product is also provided, including a computer program, and when the computer program is executed by the processor 901, any method of the information acquisition method provided in the present application is implemented.

[0155] In an exemplary embodiment, various aspects of an information acquisition method provided by the present application can also be implemented in the form of a program product, which includes program code. When the program product is run on a computer device, the program code is used to enable the computer device to execute the steps of the information acquisition method according to various exemplary embodiments of the present application described above in this specification.

[0156] The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.

[0157] The program product for the information acquisition method of the embodiment of the present application can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on the information acquisition device. However, the program product of the present application is not limited to this. In this document, the readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.

[0158] A readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein readable program code is carried. Such propagated data signals may take a variety of forms, including, but not limited to, electromagnetic signals, optical signals, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium other than a readable storage medium, which may transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0159] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0160] The program code for performing the operations of the present application can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and also conventional procedural programming languages ​​such as "C" language or similar programming languages. The program code can be executed entirely on the user electronic device, partially on the user device, as an independent software package, partially on the user electronic device and partially on the remote electronic device, or entirely on the remote electronic device or server. In the case of a remote electronic device, the remote electronic device can be connected to the user electronic device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external electronic device (for example, using an Internet service provider to connect through the Internet).

[0161] It should be noted that, although several units or subunits of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided into multiple units to be embodied.

[0162] In addition, although the operations of the method of the present application are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.

[0163] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0164] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, 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 image scaling device to produce a machine, so that the instructions executed by the processor of the computer or other programmable image scaling device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0165] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable image scaling device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, the instruction device being implemented in the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0166] These computer program instructions may also be loaded onto a computer or other programmable image scaling device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0167] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0168] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for obtaining information, It is characterized in that The method comprises: In response to a context information reading request initiated by a sub-process node, determining a root process node of the sub-process node; Sending the context information reading request to the root process node, and receiving the context information returned by the root process node; the context information is obtained by the root process node from the parent process node of the child process node; The context information is sent to the sub-process node.

2. The method according to claim 1, It is characterized in that The sending the context information reading request to the root process node includes: The context information reading request is sent to the proxy object, and the proxy object sends the context information reading request to the root process node through the access interface matched by the root process node.

3. The method according to claim 2, It is characterized in that The method further comprises: The proxy object is established through a dynamic proxy class by the process engine where the sub-process node is located before executing the process of the root process node, and the proxy object meets specific functional requirements; the specific functional requirements are to send the context information reading request to the root process node and receive the context information returned by the root process node.

4. The method according to claim 1, It is characterized in that The determining the root process node of the sub-process node includes: Parsing the context information reading request to determine the field information of the sub-process node; the field information includes identification information of nodes on the path from the sub-process node to the root process node; The field information is split according to the field information parsing rule, and the root process node of the sub-process node is determined according to the splitting result.

5. The method according to claim 1, It is characterized in that The determining the root process node of the sub-process node includes: Parsing the context information reading request to determine the service identifier of the sub-process node; Based on the business identifier of the sub-process node, obtaining the identification information of the root process node of the sub-process node from the root process node cache; the root process node cache includes a mapping relationship between the business identifier and the identification information of the root process node; The node identified by the identification information of the root process node is determined as the root process node of the sub-process node.

6. The method according to claim 5, It is characterized in that The root process node cache is established by the process engine where the sub-process node is located before executing the process of the root process node; the root process node cache is established in the following manner: For any business, the process engine obtains the business logic of the business, and encapsulates the business logic into the command execution method of the process engine to obtain the encapsulated command execution method; The process engine executes the business logic process based on the encapsulated command execution method, and when executing the business logic process, records the identification information of the root process node of the business and the business identification of the business; and associates the business identification and the identification information of the root process node and stores them in the root process node cache.

7. The method according to claim 2, It is characterized in that The sending the context information reading request to the proxy object, wherein the proxy object sends the context information reading request to the root process node through the access interface matched by the root process node, includes: Determine the interface type of the root process node of the sub-process node based on the interface definition rule and the root process node of the sub-process node; In the case where the interface type is the same as the interface type of the access interface matched with the root process node, the proxy object sends the context information reading request to the root process node through the access interface.

8. An information acquisition device, It is characterized in that The device comprises: A determination module, configured to determine a root process node of the sub-process node in response to a context information reading request initiated by the sub-process node; A transceiver module, used to send the context information reading request to the root process node, and receive the context information returned by the root process node; the context information is obtained by the root process node from the parent process node of the sub-process node; A sending module is used to send the context information to the sub-process node.

9. An information acquisition device, It is characterized in that include: at least one processor, and a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the at least one processor implements the method according to any one of claims 1 to 7 by executing the instructions stored in the memory.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer is caused to execute the method according to any one of claims 1 to 7.

11. A computer program product, It is characterized in that The invention comprises computer instructions, which, when executed on a computer, enable the method according to any one of claims 1 to 7 to be implemented.