Business processing method and apparatus, storage medium, and electronic device
Patent Information
- Application Number
- CN202310157042.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-17
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-02-17
AI Technical Summary
但是,上述的方案仅支持一种运行方式,即只能支持同步或异步,且不支持动态变更工作流,每次变更需要重新部署工程
[0036]根据本公开的一个方面,提供一种存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时上述的业务处理方法。
Smart Images

Figure CN116089048B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of computer technology, and more specifically, to business processing methods and apparatus, storage media and electronic devices. Background Technology
[0002] This section is intended to provide background or context for embodiments of the present invention, and the description herein is not intended to imply that it is prior art simply because it is included in this section.
[0003] With the rapid development of computer technology, different applications or services on terminal devices can perform different functions. Alternatively, a single application or service can perform multiple functions. Services providing different functions can be combined to form new services. One existing approach implements specific business logic through hard coding, fixing the process in the code according to business requirements. However, hard coding is prone to issues such as the inability to reuse atomic services, and the need to modify the code to handle different results for different use cases. Furthermore, context passing needs to be implemented in message queues, requiring detailed differentiation for different use cases. Adjusting the process requires redeveloping the code and redeploying the project. Task persistence and state management also need to be manually maintained, leading to inefficiency and redundant development. Another existing approach implements specific business logic through workflow orchestration, requiring the use of a description language to define a workflow that meets the requirements, describing the entire call process. However, this approach only supports one operating mode—synchronous or asynchronous—and does not support dynamic workflow changes; each change requires redeploying the project. Summary of the Invention
[0004] Therefore, there is a great need for an improved business processing method and apparatus, storage medium and electronic equipment, which can provide a workflow that can simultaneously meet synchronous and asynchronous operation scenarios.
[0005] In this context, embodiments of the present invention are intended to provide a business processing method and apparatus, a storage medium, and an electronic device.
[0006] According to one aspect of this disclosure, a business processing method is provided, the method comprising: generating a task event in response to a scheduling request of a target business; processing the task event to load a workflow corresponding to the target business; parsing the workflow to determine the execution mode and a workflow node to be executed; executing the workflow node to be executed and generating a node event based on the current execution result; updating the task event in response to the node event, and parsing the workflow based on the updated task event to determine the next workflow node to be executed and executing it, until the workflow is completed.
[0007] In one exemplary embodiment of this disclosure, generating a task event in response to a scheduling request of a target service includes: processing the scheduling request of the target service through an event engine, generating the corresponding task event, and pushing the task event to the execution engine.
[0008] In one exemplary embodiment of this disclosure, processing the task event to load the workflow corresponding to the target service includes: an execution engine processing the task event and loading the workflow corresponding to the target service from a first storage medium.
[0009] In one exemplary embodiment of this disclosure, the execution mode corresponding to the workflow includes synchronous execution mode or asynchronous execution mode.
[0010] In an exemplary embodiment of this disclosure, when the execution mode corresponding to the workflow is synchronous execution, the step of parsing the workflow to determine the execution mode and the workflow node to be executed includes: receiving the task event through an RPC thread pool and configuring an RPC thread for the task event; initializing the context information of the workflow using the configured RPC thread, generating a workflow task and submitting it to the workflow execution thread pool; the workflow execution thread pool processing the workflow task and configuring a workflow execution thread, using the configured workflow execution thread to process the workflow task, generating a first event and pushing it to the local event engine; the local event engine processing the first event, generating a task event and pushing it to the DSL engine to load the workflow corresponding to the target service, and the DSL engine parsing the workflow and determining the workflow node to be executed; generating a second event based on the workflow node to be executed and submitting it to the workflow execution thread pool.
[0011] In one exemplary embodiment of this disclosure, executing the workflow node to be executed and generating a node event based on the current execution result includes: configuring a workflow execution thread for the workflow node to be executed in a workflow execution thread pool, executing the workflow node to be executed according to the allocated workflow execution thread to obtain the current execution result; generating the node event based on the current execution result, and pushing the node event to the local event engine.
[0012] In an exemplary embodiment of this disclosure, the step of responding to the node event to update the task event, and triggering the parsing of the workflow based on the updated task event to determine the next workflow node to be executed and execute it until the workflow is completed includes: processing the node event by a local event engine to update the task event, and pushing the updated task event to a DSL engine; parsing the workflow by the DSL engine to determine the next workflow node to be executed, and updating a second event based on the determined next workflow node to be executed and pushing it to the workflow execution thread pool; processing the updated second event in the workflow execution thread pool and allocating a workflow execution thread for the next workflow node to be executed, and executing the next workflow node to be executed through the allocated workflow execution thread to obtain the current execution result; generating a new node event based on the current execution result, and pushing the new node event to the local event engine; and repeating the above method until the workflow is completed.
[0013] In one exemplary embodiment of this disclosure, when the execution mode corresponding to the workflow is asynchronous execution, generating a task event in response to the scheduling request of the target business includes: the event engine obtaining the scheduling request of the target business from a preset message queue and generating a corresponding task event; and writing the task event into the message queue for allocation of the task event.
[0014] In one exemplary embodiment of this disclosure, the step of responding to the node event to update the task event, and triggering the parsing of the workflow based on the updated task event to determine the next workflow node to be executed and execute it until the workflow is completed includes: an event engine generating a new task event based on the node event and writing the new task event into the message queue to allocate the new task event; a target execution engine responding to the allocated new task event and loading the workflow corresponding to the target business; parsing the workflow using a DSL engine to determine the execution method and the workflow node to be executed corresponding to the workflow; the execution engine executing the workflow node to be executed, generating a new node event based on the current execution result, and pushing the new node event to the event engine; and repeating the above method until the workflow is completed.
[0015] In one exemplary embodiment of this disclosure, when the execution mode corresponding to the workflow is asynchronous execution, the method further includes: the event engine establishing an event listening task for the execution engine to obtain the events generated by the execution engine during the workflow operation and store them in a second storage medium.
[0016] In one exemplary embodiment of this disclosure, the method further includes: acquiring workflow data of the workflow operation and storing it in a third storage medium.
[0017] In one exemplary embodiment of this disclosure, the workflow nodes include: system logic nodes and functional nodes.
[0018] In one exemplary embodiment of this disclosure, the method further includes: inputting a corresponding workflow based on the business process corresponding to the target business, and determining the execution method corresponding to the workflow; and storing the workflow in a first storage medium.
[0019] According to one aspect of this disclosure, a business processing system is provided, comprising:
[0020] The scheduling request processing module is used to generate task events in response to scheduling requests from target services.
[0021] The workflow parsing module is used to process the task events to load the workflow corresponding to the target business; and to parse the workflow to determine the execution method and the workflow nodes to be executed.
[0022] The node execution module is used to execute the workflow nodes to be executed and generate node events based on the current execution results;
[0023] The loop execution control module is used to update the task event in response to the node event, and to parse the workflow based on the updated task event to determine the next workflow node to be executed and execute it until the workflow is completed.
[0024] In one exemplary embodiment of this disclosure, the scheduling request processing module is used to process the scheduling request of the target service through the event engine, generate the corresponding task event, and push the task event to the execution engine.
[0025] In one exemplary embodiment of this disclosure, the workflow parsing module is used to execute the engine to process the task event and load the workflow corresponding to the target service from the first storage medium.
[0026] In one exemplary embodiment of this disclosure, the execution mode corresponding to the workflow includes synchronous execution mode or asynchronous execution mode.
[0027] In one exemplary embodiment of this disclosure, the workflow parsing module includes: a synchronous execution processing module, configured to, when the execution mode corresponding to the workflow is synchronous execution, receive the task event through an RPC thread pool and configure an RPC thread for the task event; initialize the context information of the workflow using the configured RPC thread, generate a workflow task and submit it to the workflow execution thread pool; the workflow execution thread pool processes the workflow task and configures a workflow execution thread, uses the configured workflow execution thread to process the workflow task to generate a first event and pushes it to the local event engine; the local event engine processes the first event to generate a task event and pushes it to the DSL engine to load the workflow corresponding to the target service, and the DSL engine parses the workflow and determines the workflow node to be executed; and generates a second event based on the workflow node to be executed and submits it to the workflow execution thread pool.
[0028] In one exemplary embodiment of this disclosure, the node execution module includes: a synchronous node execution module, configured to configure a workflow execution thread for the workflow node to be executed in a workflow execution thread pool, and execute the workflow node to be executed according to the allocated workflow execution thread to obtain the current execution result; generate the node event based on the current execution result, and push the node event to the local event engine.
[0029] In one exemplary embodiment of this disclosure, the loop execution control module includes: a synchronous loop execution module, configured to have the node events processed by a local event engine to update task events, and push the updated task events to a DSL engine; the DSL engine parses the workflow to determine the next workflow node to be executed, and updates a second event based on the determined next workflow node to be executed and pushes it to the workflow execution thread pool; the workflow execution thread pool processes the updated second event and allocates a workflow execution thread for the next workflow node to be executed, and executes the next workflow node to be executed through the allocated workflow execution thread to obtain the current execution result; a new node event is generated based on the current execution result, and the new node event is pushed to the local event engine; the above method is executed repeatedly until the workflow is completed.
[0030] In one exemplary embodiment of this disclosure, the scheduling request processing module is further configured to, when the execution mode corresponding to the workflow is asynchronous execution, obtain the scheduling request of the target service from a preset message queue and generate a corresponding task event; and write the task event into the message queue for allocation of the task event.
[0031] In one exemplary embodiment of this disclosure, the loop execution control module includes: an asynchronous loop execution module, configured to: an event engine generate new task events based on the node events and write the new task events into the message queue to allocate the new task events; a target execution engine responds to the allocated new task events and loads the workflow corresponding to the target business; a DSL engine parses the workflow to determine the execution method and the workflow nodes to be executed; the execution engine executes the workflow nodes to be executed, generates new node events based on the current execution results, and pushes the new node events to the event engine; and the above method is executed repeatedly until the workflow is completed.
[0032] In one exemplary embodiment of this disclosure, the system further includes: an event listening module, configured to, when the execution mode corresponding to the workflow is asynchronous execution, establish an event listening task for the execution engine, so as to obtain the events generated by the execution engine during the workflow operation and store them in a second storage medium.
[0033] In one exemplary embodiment of this disclosure, the system further includes: a workflow data storage module, used to acquire workflow data of workflow operation and store it in a third storage medium.
[0034] In one exemplary embodiment of this disclosure, the workflow nodes include: system logic nodes and functional nodes.
[0035] In one exemplary embodiment of this disclosure, the system further includes: a workflow input module, configured to input a corresponding workflow based on the business process corresponding to the target business, and determine the execution method corresponding to the workflow; and store the workflow in a first storage medium.
[0036] According to one aspect of this disclosure, a storage medium is provided that stores a computer program thereon, wherein the computer program, when executed by a processor, performs the aforementioned business processing method.
[0037] According to one aspect of this disclosure, an electronic device is provided, comprising:
[0038] Processor; and
[0039] Memory for storing the executable instructions of the processor;
[0040] The processor is configured to execute any of the above-described business processing methods by executing the executable instructions.
[0041] According to the business processing method of this invention, the workflow corresponding to the target business is loaded by processing the task event corresponding to the scheduling request of the target business. The workflow is parsed to determine the corresponding execution method and the workflow nodes to be executed. The workflow nodes to be executed are then executed according to the corresponding execution method, and node events are generated based on the current execution result. The task events are updated according to the currently generated node events, and the workflow is parsed based on the updated task events to determine the next workflow node to be executed and execute it, until the workflow is completed. This workflow approach improves work efficiency and enhances the maintainability of the business system. Furthermore, by parsing the workflow to determine the corresponding execution method, it can be applied to both synchronous and asynchronous application scenarios, solving the problem of multi-scenario applicability of workflow engines. Moreover, by parsing the workflow to determine the workflow nodes to be executed, work efficiency can be effectively improved. Attached Figure Description
[0042] The above and other objects, features, and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description taken in conjunction with the accompanying drawings. Several embodiments of the invention are illustrated in the drawings by way of example, not limitation, in which:
[0043] Figure 1 A schematic diagram illustrating a business processing method according to an embodiment of the present invention is shown.
[0044] Figure 2 A schematic diagram illustrating a method for inputting workflow according to an embodiment of the present invention is shown.
[0045] Figure 3 A schematic diagram of a workflow engine architecture according to an embodiment of the present invention is shown.
[0046] Figure 4 A schematic diagram illustrating a workflow parsing method in a synchronous execution mode according to an embodiment of the present invention is shown.
[0047] Figure 5 A schematic diagram illustrating the logic of a workflow engine implementation for a synchronous scenario according to an embodiment of the present invention is shown.
[0048] Figure 6 A schematic flowchart illustrating a method for executing a workflow in a synchronous scenario according to an embodiment of the present invention is shown.
[0049] Figure 7 A schematic diagram illustrating a method for executing a workflow in an asynchronous scenario according to an embodiment of the present invention is shown.
[0050] Figure 8A schematic diagram illustrating the logic of an asynchronous workflow engine implementation according to an embodiment of the present invention is shown.
[0051] Figure 9 A block diagram of a business processing system according to an embodiment of the present invention is shown schematically.
[0052] Figure 10 A schematic diagram of a storage medium according to an embodiment of the present invention is shown; and
[0053] Figure 11 A block diagram of an electronic device according to an embodiment of the invention is shown schematically.
[0054] In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts. Detailed Implementation
[0055] The principles and spirit of the invention will now be described with reference to several exemplary embodiments. It should be understood that these embodiments are given merely to enable those skilled in the art to better understand and implement the invention, and are not intended to limit the scope of the invention in any way. Rather, these embodiments are provided to make this disclosure more thorough and complete, and to fully convey the scope of this disclosure to those skilled in the art.
[0056] Those skilled in the art will recognize that embodiments of the present invention can be implemented as a system, apparatus, device, method, or computer program product. Therefore, this disclosure can be specifically implemented in the following forms: entirely hardware, entirely software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0057] The data disclosed herein may be data authorized by the user or fully authorized by all parties. The collection, dissemination, and use of the data shall comply with the requirements of relevant national laws and regulations. The implementation methods / executives of this disclosure may be combined with each other.
[0058] According to embodiments of the present invention, a business processing method, a business processing system, a storage medium, and an electronic device are provided.
[0059] In this document, any number of elements in the accompanying figures is for illustrative purposes and not for limitation, and any naming is for distinction only and has no limiting meaning.
[0060] The principles and spirit of the present invention will be explained in detail below with reference to several representative embodiments. Invention Overview
[0062] The inventors have discovered that in existing technologies, different services can be used to provide different business functions. When needed, multiple different services can be combined to provide a new service and implement a new business function. For example, in a multimedia playback application, two atomic services, lyrics conversion and material production, can be combined to implement a new audio and video production function. In one approach, hard coding can be used, that is, the process is fixed in the code according to business requirements. For example, for the aforementioned new business function, the specific process can be described as follows: First, the code initiates a network call to the lyrics conversion service, waits for and receives the result, and then parses the result; after parsing the result, the request is assembled, and then a call is initiated to the material production service, which also receives and parses the result, and then the final result is converted into the form desired by the business. The advantage of hard coding is its simple logic, but the integrated atomic services cannot be reused. The result parsing process may be different for each different use case, requiring code to implement strategies; context passing needs to be done in a message queue, and different use cases need to be distinguished; task persistence, state, etc., need to be maintained manually, which is inefficient and repetitive; adjusting the process requires redeveloping the code and re-deploying the project. In another approach, workflow orchestration can be used to implement the aforementioned new business logic. The process can be described as follows: Based on the business requirements, a workflow is defined using a description language (typically XML or JSON) that details the entire service call process. This defined workflow is then entered into a workflow engine. The business interacts with the workflow engine to initiate a call. The workflow engine executes the work according to the entered workflow and finally returns a result to the caller. However, this approach only supports one mode of operation: synchronous or asynchronous. Some workflows, such as Flowable, do not support dynamic workflow changes; each change requires redeploying the project. This is unsuitable in the context of rapid iteration in existing applications.
[0063] In view of the above, the basic idea of the present invention is to implement a business processing method control and apparatus according to the embodiments of the present invention, thereby achieving an implementation scheme for a workflow engine that simultaneously satisfies both synchronous and asynchronous scenarios, and enabling its workflow to be dynamically changed and effective.
[0064] After introducing the basic principles of the present invention, various non-limiting embodiments of the present invention will be described in detail below.
[0065] Exemplary methods
[0066] The following describes a business processing method according to an exemplary embodiment of the present invention, with reference to the accompanying drawings.
[0067] refer to Figure 1 The business processing method may include the following steps:
[0068] S1. Generate a task event in response to the scheduling request of the target service;
[0069] S2. Process the task event to load the workflow corresponding to the target business; and parse the workflow to determine the execution method and the workflow node to be executed.
[0070] S3. Execute the workflow node to be executed, and generate node events based on the current execution result;
[0071] S4. In response to the node event, update the task event, and parse the workflow based on the updated task event to determine the next workflow node to be executed and execute it until the workflow is completed.
[0072] In the business processing method of this invention, the workflow corresponding to the target business is loaded by processing the task event corresponding to the scheduling request of the target business. The workflow is parsed to determine the corresponding execution method and the workflow nodes to be executed. Then, the workflow nodes to be executed are executed according to the corresponding execution method, and node events are generated based on the current execution result. The task events are updated according to the currently generated node events, and the workflow is parsed based on the updated task events to determine the next workflow node to be executed and execute it, until the workflow is completed. The workflow approach improves work efficiency and enhances the maintainability of the business system. Furthermore, by parsing the workflow to determine the corresponding execution method, it can be applied to both synchronous and asynchronous application scenarios, solving the problem of multi-scenario applicability of workflow engines. Moreover, by parsing the workflow to determine the workflow nodes to be executed, work efficiency can be effectively improved.
[0073] In an exemplary embodiment of this disclosure, reference is made to Figure 2 As shown, the above-mentioned business processing methods may include:
[0074] Step S101: Based on the business process corresponding to the target business, enter the corresponding workflow and determine the execution method of the workflow;
[0075] Step S102: Store the workflow in the first storage medium.
[0076] Specifically, the target business can be pre-edited using a corresponding domain-specific language (DSL) based on its specific business process and the tasks corresponding to each process node, and the DSL can be stored for subsequent business implementation. During workflow editing, the execution method can be determined based on the actual needs and application scenarios of the target business, i.e., configured as a synchronous or asynchronous workflow; and corresponding execution method identification information can be added to the DSL.
[0077] For example, the target business described above can be a specific function within an application. For instance, the target business could be an audio / video production function within an audio / video playback application, where users can customize lyrics, audio, and video materials. This function can be formed by arranging multiple atomic business functions according to a predetermined logic, thus creating a new business capability. Then, XML or JSON can be used to describe this rearranged logic, forming a workflow DSL. The resulting workflow DSL can be persisted and stored on a specified storage device, such as the storage space of the terminal device or the server. Depending on the actual application scenario of the audio / video production function, its execution mode can be configured as an asynchronous workflow. The aforementioned atomic business can be an atomic service used to solve specific atomic problems, such as video transcoding, lyrics editing, cover art creation, etc.
[0078] For example, the aforementioned audio and video production function can be composed of two atomic services: lyrics conversion and material production. The lyrics conversion service can process user-defined lyrics data and audio data, and match the lyrics data with the audio data. The material production service can be used to edit user-defined materials such as video data and audio data to obtain user-made audio and video data.
[0079] In step S1, a task event is generated in response to the scheduling request of the target service.
[0080] In an exemplary embodiment of this disclosure, the above-mentioned generation of task events in response to the scheduling request of the target service may include: processing the scheduling request of the target service through an event engine, generating the corresponding task event, and pushing the task event to the execution engine.
[0081] Specifically, the above methods can be executed and implemented on the terminal device. The target business logic can be implemented through a workflow engine. Specifically, an event engine and an execution engine can be configured.
[0082] The event engine is used to schedule events. These events mainly include: external input events to the workflow engine and events generated by the execution engine. External input events can be external commands, such as starting or stopping a workflow. For example, an external command could be triggered when a user activates an audio / video production app or service within the application to start the workflow; or it could be triggered when the user finishes production to stop the workflow; or it could be triggered when the user configures a synchronous execution model; or it could be triggered when the user selects materials from another database; and so on. Events generated by the execution engine can be triggered when each workflow node executes a task during the task flow execution process.
[0083] The events generated by the execution engine are primarily used for workflow management, including workflow node completion events, workflow node start notification events, workflow node retry notification events, workflow completion events, and so on. Specifically, the event engine dispatches events to the execution engine and performs persistence processing on the dispatched events. Persistence processing refers to writing data from the server or terminal's memory to disk during operation. Mature products exist for data writing, reading, and updating; these products can be called persistent storage media, such as MySQL databases.
[0084] For example, the target service mentioned above could be an audio / video editing service. When a user clicks a control in an audio playback application to use the audio / video editing service, a corresponding scheduling request is triggered. This scheduling request could be a service invocation request or an activation request, etc. The event engine can handle this scheduling request and generate a corresponding task event. The event engine consumes this event and pushes it to the execution engine so that the execution engine can process the task event.
[0085] In step S2, the task event is processed to load the workflow corresponding to the target business; and the workflow is parsed to determine the execution method and the workflow node to be executed.
[0086] In an exemplary embodiment of this disclosure, processing the task event to load the workflow corresponding to the target service includes: an execution engine processing the task event and loading the workflow corresponding to the target service from a first storage medium.
[0087] Specifically, refer to Figure 3As shown, after receiving a task event from the event engine 301, the execution engine 302 can load the workflow DSL corresponding to the current target service into the preset first storage medium 304. After loading the workflow, the DSL engine 303 can parse the workflow, first extracting the corresponding workflow execution method and determining the current workflow node to be executed. For example, the corresponding execution method can be determined by parsing the identification information of the pre-configured workflow execution method. Alternatively, the specific workflow execution method can be determined based on the current application scenario of the target service. Alternatively, before parsing the workflow, the execution method of the current workflow can be customized according to user instructions, and the user-defined execution method can be matched with the pre-configured execution method. If the match is successful, execution continues; if the match fails, the parsing process stops and the user is notified. The user-defined workflow execution method can be carried in the scheduling request for the target service. For example, the target business is pre-configured for asynchronous execution, but the user can customize it to synchronous execution in the user interface. When parsing the workflow, the parsed workflow execution mode is compared with the user-defined execution mode. If the execution mode fails to match, the workflow parsing stops, and a corresponding prompt message can be displayed in the user interface. Alternatively, the target business is pre-configured for asynchronous execution, and the user customizes it as asynchronous when activating the target business. When parsing the workflow, the pre-configured execution mode is matched with the user-defined execution mode. If the match is successful, the workflow parsing process continues.
[0088] In an exemplary embodiment of this disclosure, the workflow nodes include: system logic nodes and functional nodes.
[0089] For example, the DSL engine provides the parsed execution nodes to the execution engine, which then executes these nodes directly. Nodes can be divided into two categories: system logic nodes and functional nodes. System logic nodes are primarily responsible for logic scheduling, such as executing if…else, switch…case, fork…join, dynamic splitting, and script nodes. Functional nodes can possess true atomic functions, such as the lyrics conversion service and material creation service mentioned above, or specific atomic functions like cover detection and video detection.
[0090] In step S3, the workflow node to be executed is executed, and a node event is generated based on the current execution result.
[0091] In an exemplary embodiment of this disclosure, reference is made to Figure 3As shown in the diagram, after the DSL engine 303 parses the workflow and determines the current workflow node to be executed, it can submit the workflow node to be executed to the execution engine 302, so that the execution engine 302 can execute the workflow node to be executed, execute the corresponding node task, and generate a node event again based on the execution result of the node task, so that the node event can be delivered to the event engine 301 to trigger the subsequent process.
[0092] In step S4, in response to the node event, the task event is updated, and the workflow is parsed based on the updated task event to determine the next workflow node to be executed and executed, until the workflow is completed.
[0093] In an exemplary embodiment of this disclosure, after receiving an event delivered by the execution engine, the event engine can trigger a new event as an updated task event based on the node event, consume the updated task event and deliver it to the execution engine. This can trigger the execution engine to load the workflow DSL and parse it to obtain the next workflow node to be executed and execute it, thereby realizing the sequential execution of node tasks in the workflow until the workflow is completed. Each workflow node completes its corresponding node task and generates the final task result to be fed back to the user.
[0094] In the exemplary embodiments of this disclosure, the defined workflow DSL can be persisted, for example, stored in the second storage medium 305. The workflow engine loads the workflow DSL from this storage medium during runtime, which is crucial for the operation of the workflow engine. The benefit of this is that the workflow can be dynamically modified at any time, allowing users to add, modify, delete, or change any one or more workflow nodes according to actual business needs, thereby effectively improving workflow efficiency.
[0095] Furthermore, all events generated during workflow execution can be persisted. For example, data related to events generated by the event engine can be stored in the first storage medium 304, primarily for subsequent problem tracking or manual intervention in workflow execution. Additionally, workflow execution data can also be persisted; for example, this data can be stored in the second storage medium 305. For instance, workflow execution data mainly includes workflow input parameters, node input parameters, node execution results, workflow execution results, error messages, and so on. Of course, users can also customize different persistence strategies for different data based on the specific application scenario of the target service and actual business needs, and write them into the workflow for execution.
[0096] In an exemplary embodiment of this disclosure, the execution mode corresponding to the workflow includes synchronous execution mode or asynchronous execution mode.
[0097] In an exemplary embodiment of this disclosure, when the execution mode corresponding to the workflow is synchronous execution, refer to Figure 4 As shown, parsing the workflow to determine the execution method and workflow nodes to be executed may specifically include:
[0098] Step S211: Receive the task event through the RPC thread pool and configure the RPC thread for the task event; use the configured RPC thread to initialize the context information of the workflow, generate a workflow task, and submit it to the workflow execution thread pool.
[0099] Step S212: The workflow execution thread pool processes the workflow task and configures the workflow execution thread. The configured workflow execution thread processes the workflow task, generates a first event, and pushes it to the local event engine.
[0100] Step S213: The local event engine processes the first event to generate a task event and pushes it to the DSL engine to load the workflow corresponding to the target service, and the DSL engine parses the workflow and determines the workflow node to be executed.
[0101] Step S214: Generate a second event based on the workflow node to be executed and send it to the workflow execution thread pool.
[0102] In an exemplary embodiment of this disclosure, when the execution mode corresponding to the workflow is synchronous execution, the execution of the workflow node to be executed and the generation of node events based on the current execution result include:
[0103] Configure a workflow execution thread for the workflow node to be executed in the workflow execution thread pool, and execute the workflow node to be executed according to the allocated workflow execution thread to obtain the current execution result; generate the node event based on the current execution result, and push the node event to the local event engine.
[0104] In an exemplary embodiment of this disclosure, when the execution mode corresponding to the workflow is synchronous execution, refer to Figure 5 As shown, the step of responding to the node event to update the task event, and triggering the parsing of the workflow based on the updated task event to determine the next workflow node to be executed and execute it, until the workflow is completed, includes:
[0105] Step S411: The local event engine processes the node events to update the task events and pushes the updated task events to the DSL engine;
[0106] In step S412, the DSL engine parses the workflow to determine the next workflow node to be executed, and updates the second event based on the determined next workflow node to be executed and pushes it to the workflow execution thread pool.
[0107] Step S413: The workflow execution thread pool processes the updated second event and allocates a workflow execution thread for the next workflow node to be executed, and executes the next workflow node to be executed through the allocated workflow execution thread to obtain the current execution result;
[0108] Step S414: Generate a new node event based on the current execution result, and push the new node event to the local event engine;
[0109] Step S415: Repeat the above method until the workflow is completed.
[0110] Specifically, for synchronous application scenarios, since synchronous workflows operate only on a single machine, the event engine in the business flow engine logic of synchronous scenarios can use a local event engine to achieve the effect of events flowing locally. The DSL engine is used to parse the workflow DSL, and it is unaffected by the work scenario and does not need to distinguish between scenarios. The execution engine needs to determine the appropriate actions based on the scenario when executing the nodes parsed by the DSL engine.
[0111] Specifically, in synchronous scenarios, the execution engine can consist of two collaborative parts: an RPC thread pool and a workflow execution thread pool. The RPC thread pool primarily receives external workflow requests (e.g., start / stop), initializes the context, and then submits the workflow task to the workflow execution thread pool, receiving a Future. This Future can be used for timeouts, exception interruptions, and trace propagation. The workflow execution thread pool can be used to implement the reproduction of tasks and events by node type, and possesses atomic-level Demo capability. That is, the primary function of the workflow execution thread is to actually execute the workflow nodes and generate new events; secondly, it responds to Future interrupts and uses Futures to handle result callbacks. For example, the aforementioned thread pool is a tool for managing threads based on pooling principles and can be applied to multi-threaded servers. RPC (Remote Procedure Call) can be a remote call between different nodes in distributed computing.
[0112] For example, refer to Figure 6 The schematic diagram of the workflow engine implementation logic in the synchronous scenario shown illustrates that it can receive scheduling requests for target business triggered by users in the application through the external interface layer 601, and generate corresponding "start workflow" control instructions based on the scheduling requests. The event corresponding to this control instruction can be processed by the RPC thread pool 604 in the execution engine 606, and a corresponding RPC thread is configured for the event. Thus, the configured RPC thread can be used for context initialization, and a corresponding workflow task can be created based on the corresponding workflow, and the workflow task can be submitted to the workflow execution thread pool 605. After receiving the task submitted by the RPC thread, the workflow execution thread pool 605 processes the current workflow task and configures a corresponding workflow execution thread for it. The configured workflow execution thread processes the workflow task and generates a first event, which is then submitted to the local event engine 603. This event may include the execution result of the current node.
[0113] After receiving the first event, the local event engine 603 can consume the first event (Event), load the workflow DSL, generate the corresponding task event, and submit it to the DSL engine 602. Upon receiving the task event submitted by the event engine, the DSL engine 602 processes the current event, parses the corresponding workflow DSL, determines the workflow execution method, and obtains the current workflow node to be executed. Based on the parsed result, the DSL engine 602 generates the corresponding second event (Event) for the current workflow node to be executed and submits it to the workflow execution thread pool 605. Upon receiving the event, the workflow execution thread pool 605 can allocate the corresponding workflow execution thread for the event corresponding to the workflow node to process the task of the workflow node; after the current task is completed, it generates a new event based on the task execution result of the current node and submits it to the event engine, allowing the event engine to process the current event again; thus achieving sequential execution of tasks at each node in the workflow.
[0114] In synchronous scenarios, the local event engine loads the workflow DSL once, triggering the DSL engine to parse the workflow DSL, determine the current workflow node to be executed, and generate the corresponding event, which is then delivered to the execution engine. The workflow execution thread pool processes the specific task corresponding to the workflow node to be executed. Based on the task execution result, the local event engine generates the corresponding event and delivers it to the local event engine to trigger the local event engine to consume the event (at this time, the local event engine does not need to reload the workflow DSL), updates the task event, and delivers it to the DSL engine. This allows the DSL engine to parse the workflow DSL again, determine the new workflow node to be executed, and deliver it to the execution engine again. The workflow execution thread pool processes the specific task corresponding to the updated workflow node to be executed. This process is repeated until the workflow ends and the tasks of each workflow node are completed.
[0115] In an exemplary embodiment of this disclosure, when the execution mode corresponding to the workflow is asynchronous execution, generating a task event in response to the scheduling request of the target business includes:
[0116] The event engine retrieves the scheduling request of the target service from a preset message queue and generates a corresponding task event; and writes the task event into the message queue for allocation.
[0117] In an exemplary embodiment of this disclosure, when the execution mode corresponding to the workflow is asynchronous execution, refer to Figure 7 As shown, the step of responding to the node event to update the task event, and triggering the parsing of the workflow based on the updated task event to determine the next workflow node to be executed and execute it, until the workflow is completed, includes:
[0118] Step S421: The event engine generates a new task event based on the node event and writes the new task event into the message queue to allocate the new task event;
[0119] Step S422: The target execution engine responds to the assigned new task event and loads the workflow corresponding to the target business.
[0120] Step S423: Use the DSL engine to parse the workflow and determine the execution method and workflow nodes to be executed.
[0121] Step S424: The execution engine executes the workflow node to be executed, generates a new node event based on the current execution result, and pushes the new node event to the event engine;
[0122] Step S425: Repeat the above method until the workflow is completed.
[0123] In an exemplary embodiment of this disclosure, when the execution mode corresponding to the workflow is asynchronous execution, the method further includes: the event engine establishing an event listening task for the execution engine to obtain the events generated by the execution engine during the workflow operation and store them in a second storage medium.
[0124] Specifically, in asynchronous scenarios, the event engine can choose a distributed message queue, such as RocketMQ or Kafka. This allows a workflow to flow across multiple machines in an asynchronous cluster, and the workflow will not terminate when the cluster is deployed or restarted, ensuring that the asynchronous workflow will definitely complete. In an asynchronous cluster, each machine has the same execution engine, and the implementation of the DSL engine is consistent with that in synchronous scenarios. However, the execution of nodes in asynchronous scenarios differs from that in synchronous scenarios; complex collaborative jobs are not required, only simple execution is needed.
[0125] Specifically, in asynchronous scenarios, the event engine can pre-create a distributed message queue. For scheduling requests for target services triggered by users in the application, these requests can be written to the message queue in chronological order. The event engine can then process these scheduling requests sequentially. For a scheduling request sequentially extracted from the message queue, a corresponding task event can be generated and written back to the message queue in order, facilitating the event engine's distribution of task events to the asynchronous cluster. Specifically, the aforementioned scheduling requests and task events can be written to the same message queue. After generating the corresponding task event for a scheduling request, the request can be deleted or marked to avoid duplicate execution. Alternatively, a separate message queue can be used for the corresponding task events generated for the scheduling requests. (See reference) Figure 8As shown, event engine 801 allocates task events in the message queue, for example, based on the load of each server 806 in the asynchronous cluster 805. Since each server (machine) in the asynchronous cluster is configured with the same execution engine 807, each task event may be executed by a different server. Therefore, each time execution engine 807 receives a task event from event engine 801, it needs to load the workflow DSL. The DSL engine 808 parses the workflow DSL to obtain the current workflow node to be executed. This node executes the corresponding task and generates an event based on the task execution result, which is then delivered to event engine 801. After receiving a task event uploaded by the execution engine of any server in the asynchronous cluster, event engine 801 generates a new task event to be allocated, writes it to the message queue, allocates it from the message queue, determines the corresponding target execution engine in the asynchronous cluster, and delivers the new task event to the target execution engine. Upon receiving the new task event, the target execution engine triggers the loading of the workflow DSL corresponding to the target business, triggers the DSL engine to parse the workflow DSL to obtain the updated workflow node to be executed, and the execution engine executes the node task corresponding to the updated workflow node to be executed. Based on the execution result of the node task, the corresponding task event is generated and submitted to the event engine again so that the event engine can process the task event. This process can be repeated until the workflow is completed.
[0126] Furthermore, because asynchronous scenarios have less stringent performance requirements than synchronous scenarios, and because asynchronous scenarios often involve a large number of batch executions, they place higher demands on problem tracking and troubleshooting. Therefore, in asynchronous scenarios, workflow DSLs, events, and workflow execution data are all persisted; and different persistence media can be selected and stored on different storage devices depending on the data characteristics; for example, refer to... Figure 8As shown, the event engine's event listening data for the execution engine can be stored in the first persistent medium 804, while the execution data and workflow DSL generated by the execution engine during workflow execution can be stored in the second persistent medium 803; events generated by the execution engine can be stored in the third persistent medium 802. For example, events can be persistently stored in an HBase database. With persistent data, the workflow can be traced; for example, a workflow tracing system can be built based on persistent data to visualize and reconstruct the workflow execution process. For example, a flowchart of the workflow DSL can be created based on the parsed results of the persistent workflow DSL, and the execution details of each node can be obtained based on the persistent workflow execution data; a corresponding event list can be generated based on the persistent events, thereby enabling the tracing of the workflow. The aforementioned workflow tracing can refer to the complete reconstruction of a single execution process in a distributed scenario, including but not limited to the service nodes, call parameters, and return results designed during the process.
[0127] In summary, the business processing method provided in this disclosure allows for the pre-entry of the service-specific workflow DSL, specifying its working mode as synchronous or asynchronous, and storing it. Different workflow engine implementation logics are configured for synchronous and asynchronous operations respectively. For example, the workflow engine can be implemented based on workflow engines such as Zeebe, Camunda, Conductor, Candence, and Flowable. After starting the workflow, the execution engine can load and parse the workflow DSL to obtain the corresponding working mode, thus allowing the use of different workflow engine logics (synchronous or asynchronous) according to specific needs. Alternatively, after loading the workflow DSL, the usage scenario can be determined, and different engine logic can be selected for execution based on different scenarios. The event engine is mainly used for event scheduling, dispatching events to the execution engine. After receiving the event scheduled by the event engine, the execution engine loads the workflow DSL from the persistent medium; this process is not a necessary step. In asynchronous distributed scenarios, the workflow DSL is loaded every time an event is consumed, but in synchronous scenarios, the DSL only needs to be loaded when the workflow execution begins. Then, the execution engine hands the workflow DSL to the DSL engine. The DSL engine parses the workflow DSL and, combined with the event type and context, parses out the next or next batch of workflow nodes to be executed. The DSL engine then provides the parsed nodes to the execution engine, which executes these nodes directly. After a node completes execution, it generates another event and posts it to the event engine, thus forming a closed loop that repeats until the workflow is complete. If there are no more nodes to be executed, it means the workflow has been completed. At this point, the DSL engine parses the workflow output and returns the result. This solution orchestrates the workflow process, implementing event-driven workflow engine logic, eliminating hard coding, improving work efficiency, and enhancing system maintainability. Furthermore, the workflow engine logic designed based on this solution solves the problem of multi-scenario applicability, and can be applied to both synchronous and asynchronous scenarios. In addition, by persistently storing the workflow DSL, users can adjust the workflow DSL in real time according to actual business needs, thereby supporting dynamic changes to the workflow and further improving work efficiency.
[0128] Exemplary device
[0129] After introducing the business processing method of the exemplary embodiment of the present invention, the business processing method system of the exemplary embodiment of the present invention will be described next with reference to the accompanying drawings.
[0130] refer to Figure 9As shown in the exemplary embodiment of the present invention, a business processing system 900 may include: a scheduling request processing module 901, a workflow parsing module 902, a node execution module 903, and a loop execution control module 904. Wherein,
[0131] The scheduling request processing module 901 can be used to generate task events in response to scheduling requests from target services.
[0132] The workflow parsing module 902 can be used to process the task event to load the workflow corresponding to the target business; and parse the workflow to determine the execution method and the workflow node to be executed.
[0133] The node execution module 903 can be used to execute the workflow node to be executed and generate node events based on the current execution result.
[0134] The loop execution control module 904 is used to update the task event in response to the node event, and to parse the workflow based on the updated task event to determine the next workflow node to be executed and execute it until the workflow is completed.
[0135] According to an exemplary embodiment of this disclosure, the scheduling request processing module is used to process the scheduling request of the target service through the event engine, generate the corresponding task event, and push the task event to the execution engine.
[0136] According to an exemplary embodiment of this disclosure, the workflow parsing module is used to execute the engine to process the task event and load the workflow corresponding to the target service from the first storage medium.
[0137] According to exemplary embodiments of this disclosure, the execution mode corresponding to the workflow includes synchronous execution mode or asynchronous execution mode.
[0138] According to an exemplary embodiment of this disclosure, the workflow parsing module includes a synchronous execution processing module.
[0139] The synchronous execution processing module can be used to receive the task event through an RPC thread pool and configure an RPC thread for the task event when the execution mode corresponding to the workflow is synchronous execution; initialize the context information of the workflow using the configured RPC thread, generate a workflow task and submit it to the workflow execution thread pool; the workflow execution thread pool processes the workflow task and configures a workflow execution thread, uses the configured workflow execution thread to process the workflow task to generate a first event and pushes it to the local event engine; the local event engine processes the first event to generate a task event and pushes it to the DSL engine to load the workflow corresponding to the target business, and the DSL engine parses the workflow and determines the workflow node to be executed; and generates a second event based on the workflow node to be executed and submits it to the workflow execution thread pool.
[0140] According to an exemplary embodiment of this disclosure, the node execution module includes: a synchronous node execution module.
[0141] The synchronous node execution module can be used to configure a workflow execution thread for the workflow node to be executed in the workflow execution thread pool, and execute the workflow node to be executed according to the allocated workflow execution thread to obtain the current execution result; generate the node event based on the current execution result, and push the node event to the local event engine.
[0142] According to an exemplary embodiment of this disclosure, the loop execution control module includes: a synchronous loop execution module.
[0143] The synchronous loop execution module can be used to process the node events by the local event engine to update the task events, and push the updated task events to the DSL engine; the DSL engine parses the workflow to determine the next workflow node to be executed, and updates the second event based on the determined next workflow node to be executed and pushes it to the workflow execution thread pool; the workflow execution thread pool processes the updated second event and allocates a workflow execution thread for the next workflow node to be executed, and executes the next workflow node to be executed through the allocated workflow execution thread to obtain the current execution result; a new node event is generated based on the current execution result, and the new node event is pushed to the local event engine; the above method is executed repeatedly until the workflow is completed.
[0144] According to an exemplary embodiment of this disclosure, the scheduling request processing module is further configured to, when the execution mode corresponding to the workflow is asynchronous execution, obtain the scheduling request of the target service from a preset message queue and generate a corresponding task event; and write the task event into the message queue for allocation of the task event.
[0145] According to an exemplary embodiment of this disclosure, the loop execution control module includes: an asynchronous loop execution module.
[0146] The asynchronous loop execution module can be used by the event engine to generate new task events based on the node events, and write the new task events into the message queue to allocate the new task events; the target execution engine responds to the allocated new task events and loads the workflow corresponding to the target business; the DSL engine parses the workflow to determine the execution method and the workflow nodes to be executed; the execution engine executes the workflow nodes to be executed, generates new node events based on the current execution results, and pushes the new node events to the event engine; the above method is executed repeatedly until the workflow is completed.
[0147] According to an exemplary embodiment of this disclosure, the system 900 may further include an event listening module.
[0148] The event listening module can be used to establish an event listening task for the execution engine when the execution mode of the workflow is asynchronous, so as to obtain the events generated by the execution engine during the workflow operation and store them in the second storage medium.
[0149] According to an exemplary embodiment of this disclosure, the system 900 may further include a workflow data storage module.
[0150] The workflow data storage module can be used to acquire workflow data from workflow execution and store it in a third storage medium.
[0151] According to an exemplary embodiment of this disclosure, the workflow node includes: a system logic node and a functional node.
[0152] According to an exemplary embodiment of this disclosure, the system 900 may further include: a workflow input module.
[0153] The workflow entry module can be used to enter the corresponding workflow based on the business process corresponding to the target business, and determine the execution method of the workflow; and store the workflow in the first storage medium.
[0154] Since the functional modules of the business processing system in this embodiment of the invention are the same as those in the above-described business processing method, they will not be described again here.
[0155] Exemplary storage media
[0156] After introducing the multimedia playback control method, apparatus, and system according to exemplary embodiments of the present invention, the following references are made. Figure 10 The storage medium of an exemplary embodiment of the present invention will be described.
[0157] refer to Figure 10 As shown, a program product 100 for implementing the above-described method according to an embodiment of the present invention is described. It may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a device such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, the readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0158] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0159] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0160] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0161] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0162] Exemplary electronic devices
[0163] After introducing the storage medium of exemplary embodiments of the present invention, the following references are made. Figure 11 An electronic device according to an exemplary embodiment of the present invention will be described.
[0164] Figure 11 The electronic device 800 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0165] like Figure 11 As shown, the electronic device 800 is presented in the form of a general-purpose computing device. The components of the electronic device 800 may include, but are not limited to: at least one processing unit 810, at least one storage unit 820, a bus 830 connecting different system components (including storage unit 820 and processing unit 810), and a display unit 840.
[0166] The storage unit stores program code that can be executed by the processing unit 810, causing the processing unit 810 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit 810 can perform actions such as... Figure 1 The steps shown include: generating a task event in response to a scheduling request from a target service; processing the task event to load the workflow corresponding to the target service; parsing the workflow to determine the execution method and the workflow node to be executed; executing the workflow node to be executed and generating a node event based on the current execution result; updating the task event in response to the node event, and parsing the workflow based on the updated task event to determine the next workflow node to be executed and executing it, until the workflow is completed.
[0167] Storage unit 820 may include volatile storage units, such as random access memory (RAM) 8201 and / or cache memory 8202, and may further include read-only memory (ROM) 8203.
[0168] The storage unit 820 may also include a program / utility 8204 having a set (at least one) of program modules 8205, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0169] Bus 830 may include a data bus, an address bus, and a control bus.
[0170] Electronic device 800 can also communicate with one or more external devices 110 (e.g., keyboard, pointing device, Bluetooth device, etc.) via input / output (I / O) interface 850. Electronic device 800 also includes a display unit 840 connected to input / output (I / O) interface 850 for display purposes. Furthermore, electronic device 800 can communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 860. As shown, network adapter 860 communicates with other modules of electronic device 800 via bus 830. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0171] It should be noted that although several modules or sub-modules of the audio playback device and audio sharing device are mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of the present invention, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided and embodied by multiple units / modules.
[0172] Furthermore, although the operations of the method of the present invention are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. Additionally or alternatively, certain steps may be omitted, multiple steps may be combined into one step, and / or one step may be broken down into multiple steps.
[0173] While the spirit and principles of the invention have been described with reference to several specific embodiments, it should be understood that the invention is not limited to the disclosed specific embodiments, and the division of aspects does not imply that features in these aspects cannot be combined for benefit; such division is merely for ease of description. The invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
Claims
1. A business processing method, characterized in that, The method includes: Generate task events in response to scheduling requests from target services; The process involves processing the task event to load the workflow corresponding to the target service; parsing the workflow using a DSL engine to determine the execution mode and the workflow node to be executed; wherein, when the execution mode of the workflow is synchronous execution, parsing the workflow to determine the execution mode and the workflow node to be executed includes: receiving the task event through an RPC thread pool and configuring an RPC thread for the task event; initializing the context information of the workflow using the configured RPC thread, generating a workflow task and submitting it to the workflow execution thread pool; the workflow execution thread pool processing the workflow task and configuring a workflow execution thread, using the configured workflow execution thread to process the workflow task, generating a first event and pushing it to the local event engine; the local event engine processing the first event, generating a task event and pushing it to the DSL engine to load the workflow corresponding to the target service, and the DSL engine parsing the workflow and determining the workflow node to be executed; generating a second event based on the workflow node to be executed and submitting it to the workflow execution thread pool. When the execution mode of the workflow is asynchronous, the workflow node to be executed is executed, and a node event is generated based on the current execution result; the event engine generates a new task event based on the node event and writes the new task event into the message queue to allocate the new task event; the execution engine responds to the allocated new task event and loads the workflow corresponding to the target business; the DSL engine parses the workflow by combining the event type corresponding to the new task event and the workflow context information to determine the next or next batch of workflow nodes to be executed; the execution engine executes the next or next batch of workflow nodes to be executed, generates a new node event based on the current execution result, and pushes the new node event to the event engine; the above method is executed repeatedly until the workflow is completed; When the execution mode of the workflow is synchronous, a workflow execution thread is configured for the workflow node to be executed in the workflow execution thread pool, and the workflow node to be executed is executed according to the allocated workflow execution thread to obtain the current execution result; the node event is generated based on the current execution result and pushed to the local event engine; the task event is updated in response to the node event, and the workflow is parsed based on the updated task event to determine the next workflow node to be executed and execute it, until the workflow is completed.
2. The business processing method according to claim 1, characterized in that, The generation of task events in response to the scheduling request of the target service includes: The event engine processes the scheduling request of the target service, generates the corresponding task event, and pushes the task event to the execution engine.
3. The business processing method according to claim 1, characterized in that, The process of processing the task event to load the workflow corresponding to the target business includes: The execution engine processes the task events and loads the workflow corresponding to the target service from the first storage medium.
4. The business processing method according to claim 1, characterized in that, The process of responding to the node event to update the task event, and triggering the parsing of the workflow based on the updated task event to determine the next workflow node to be executed and execute it, until the workflow is completed, includes: The node events are processed by the local event engine to update the task events, and the updated task events are pushed to the DSL engine; The DSL engine parses the workflow to determine the next workflow node to be executed, and updates the second event based on the determined next workflow node to be executed and pushes it to the workflow execution thread pool. The workflow execution thread pool processes the updated second event and allocates a workflow execution thread for the next workflow node to be executed, and executes the next workflow node to be executed through the allocated workflow execution thread to obtain the current execution result; A new node event is generated based on the current execution result, and the new node event is pushed to the local event engine; Repeat the above method until the workflow is completed.
5. The business processing method according to claim 1, characterized in that, When the execution mode corresponding to the workflow is asynchronous execution, the generation of task events in response to the scheduling request of the target business includes: The event engine retrieves the scheduling request for the target service from a preset message queue and generates a corresponding task event; and The task event is written into the message queue for use in allocating the task event.
6. The business processing method according to claim 1, characterized in that, When the execution mode corresponding to the workflow is asynchronous execution, the method further includes: The event engine establishes an event listening task for the execution engine to obtain events generated by the execution engine during workflow execution and store them in a second storage medium.
7. The business processing method according to claim 1, characterized in that, The method further includes: Acquire workflow data from the workflow process and store it in a third storage medium.
8. The business processing method according to claim 1, characterized in that, Workflow nodes include: system logic nodes and functional nodes.
9. The business processing method according to claim 1, characterized in that, The method further includes: Enter the corresponding workflow based on the business process corresponding to the target business, and determine the execution method of the workflow; The workflow is stored in a first storage medium.
10. A business processing system, characterized in that, The system includes: The scheduling request processing module is used to generate task events in response to scheduling requests from target services. A workflow parsing module is used to process the task events to load the workflow corresponding to the target business; it uses a DSL engine to parse the workflow, determine the execution mode and the workflow node to be executed; wherein, when the execution mode of the workflow is synchronous execution, the step of parsing the workflow to determine the execution mode and the workflow node to be executed includes: receiving the task events through an RPC thread pool and configuring an RPC thread for the task events; initializing the context information of the workflow using the configured RPC thread, generating a workflow task and submitting it to the workflow execution thread pool; the workflow execution thread pool processes the workflow task and configures a workflow execution thread, uses the configured workflow execution thread to process the workflow task to generate a first event and pushes it to the local event engine; the local event engine processes the first event to generate a task event and pushes it to the DSL engine to load the workflow corresponding to the target business, and the DSL engine parses the workflow and determines the workflow node to be executed; and a second event is generated based on the workflow node to be executed and submitted to the workflow execution thread pool. The node execution module is used to execute the workflow node to be executed when the execution mode of the workflow is asynchronous, and generate a node event based on the current execution result; when the execution mode of the workflow is synchronous, configure a workflow execution thread for the workflow node to be executed in the workflow execution thread pool, and execute the workflow node to be executed according to the allocated workflow execution thread to obtain the current execution result; generate the node event based on the current execution result, and push the node event to the local event engine; The loop execution control module is used to: when the execution mode of the workflow is asynchronous, generate new task events based on the node events in the event engine, and write the new task events into the message queue to allocate the new task events; the execution engine responds to the allocated new task events and loads the workflow corresponding to the target business; the DSL engine parses the workflow by combining the event type corresponding to the new task events and the workflow context information to determine the next or next batch of workflow nodes to be executed; the execution engine executes the next or next batch of workflow nodes to be executed, generates new node events based on the current execution results, and pushes the new node events to the event engine; the above method is repeated until the workflow is completed. When the execution mode corresponding to the workflow is synchronous execution, the task event is updated in response to the node event, and the workflow is parsed based on the updated task event to determine the next workflow node to be executed and execute it until the workflow is completed.
11. The business processing system according to claim 10, characterized in that, The scheduling request processing module is used to process the scheduling request of the target service through the event engine, generate the corresponding task event, and push the task event to the execution engine.
12. The business processing system according to claim 10, characterized in that, The workflow parsing module is used to execute the engine to process the task events and load the workflow corresponding to the target business from the first storage medium.
13. The business processing system according to claim 10, characterized in that, The loop execution control module includes: The synchronous loop execution module is used to process the node events by the local event engine to update the task events and push the updated task events to the DSL engine; the DSL engine parses the workflow to determine the next workflow node to be executed, and updates the second event based on the determined next workflow node to be executed and pushes it to the workflow execution thread pool; the workflow execution thread pool processes the updated second event and allocates a workflow execution thread for the next workflow node to be executed, and executes the next workflow node to be executed through the allocated workflow execution thread to obtain the current execution result; a new node event is generated based on the current execution result, and the new node event is pushed to the local event engine; the above method is executed repeatedly until the workflow is completed.
14. The business processing system according to claim 10, characterized in that, The scheduling request processing module is also used to, when the execution mode corresponding to the workflow is asynchronous execution, have the event engine obtain the scheduling request of the target business from a preset message queue and generate the corresponding task event; And write the task event into the message queue for use in allocating the task event.
15. The business processing system according to claim 10, characterized in that, The system also includes: The event listening module is used to establish an event listening task for the execution engine when the execution mode corresponding to the workflow is asynchronous, so as to obtain the events generated by the execution engine during the workflow operation and store them in the second storage medium.
16. The business processing system according to claim 10, characterized in that, The system also includes: The workflow data storage module is used to acquire workflow data from workflow execution and store it in a third storage medium.
17. The business processing system according to claim 10, characterized in that, Workflow nodes include: system logic nodes and functional nodes.
18. The business processing system according to claim 10, characterized in that, The system also includes: The workflow entry module is used to enter the corresponding workflow based on the business process corresponding to the target business, and determine the execution method of the workflow; and store the workflow in the first storage medium.
19. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the business processing method according to any one of claims 1 to 9.
20. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the business processing method of any one of claims 1 to 9 by executing the executable instructions.
Citation Information
Patent Citations
Workflow processing method and device, computer equipment and storage medium
CN110738389A
Task processing method and device
CN112817745A