Workflow engine service processing method and device, equipment and medium
By splitting the workflow engine business logic into input, wait and output process nodes, and using responsive programming components to process waiting process nodes, the performance waste caused by synchronous execution of the core thread pool is solved, and the workflow engine business processing is improved Efficiency and system resource utilization.
Patent Information
- Application Number
- CN202411666545.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-01-07
AI Technical Summary
During the workflow engine business processing process, threads are waiting due to the synchronous execution of the core thread pool, resulting in waste of performance and unable to efficiently process a large amount of business.
Split the workflow engine business logic into input process nodes, waiting process nodes and output process nodes, use responsive programming functional components to process waiting process nodes, and release threads through the core thread pool to improve thread utilization.
By splitting business logic and using responsive programming functional components, the core thread occupation time is reduced, the system's concurrent processing capabilities are improved, the resource is idle, and the performance and efficiency of workflow engine business processing are improved.
Smart Images

Figure CN119271413A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a workflow engine business processing method, device, equipment and medium. Background Art
[0002] During the business processing of the workflow engine, the core thread pool executes each process node synchronously. If it takes 10 minutes for the core thread in the core thread pool to process the current process node A, the core thread will synchronously wait for 10 minutes until the processing is completed before continuing to execute the next process node B. During these 10 minutes, the core thread is in a waiting state and does not perform other operations. Currently, the core thread pool has a fixed number of threads (for example, 50 threads). After more than 10,000 businesses start to be processed at the same time, 50 threads will be stuck in the current process node A, and other nodes will be blocked. This is because there are no idle core threads to execute nodes in other businesses. Only when the current process node A returns the result and releases the thread, other businesses will continue to be executed. It can be seen that this is a great waste of performance.
[0003] From the above, it can be seen that how to improve the performance and efficiency of workflow engine business processing is a problem to be solved in this field. Summary of the invention
[0004] In view of this, the purpose of the present invention is to provide a workflow engine business processing method, device, equipment and medium to improve the performance and efficiency of workflow engine business processing. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a workflow engine business processing method, comprising:
[0006] Split the business logic of the current workflow engine business to obtain input process nodes, waiting process nodes, and output process nodes;
[0007] Using a first core thread in a core thread pool to process the input process node, and after sending the obtained pending request of the current workflow engine service to the responsive programming function component, releasing the first core thread;
[0008] Triggering the responsive programming functional component to process the waiting process node based on the pending request, obtaining the processing result of the current workflow engine business, and sending a thread application request to the core thread pool based on the processing result;
[0009] The core thread pool is called to process the output process node with a second core thread determined based on the thread application request, and the second core thread is released.
[0010] Optionally, the responsive programming functional component includes a worker thread pool, an event publisher, and an event subscriber;
[0011] The triggering of the responsive programming functional component to process the waiting process node based on the pending request, obtaining the processing result of the current workflow engine business, and sending a thread application request to the core thread pool based on the processing result includes:
[0012] Triggering the working thread pool to process the waiting process node based on the pending request to obtain the encapsulated pending request;
[0013] Using the event publisher to send the encapsulated request to be processed to the business processing end to obtain the processing result of the current workflow engine business;
[0014] The processing result is sent to the core thread pool by using the event subscriber, so as to send a thread application request to the core thread pool based on the processing result.
[0015] Optionally, using the event publisher to send the encapsulated request to be processed to a business processing end to obtain a processing result of the current workflow engine business includes:
[0016] Using the event publisher to send the encapsulated request to be processed to the business processing end, and determining the sending time of the encapsulated request to be processed;
[0017] Determine whether the time interval between the current time and the sending time is greater than a preset threshold;
[0018] If the time interval between the current time and the sending time is not greater than the preset threshold, waiting for the service processing end to return the processing result of the current workflow engine service;
[0019] If the time interval between the current time and the sending time is greater than the preset threshold, a processing timeout result is generated, and the processing timeout result is determined as the processing result of the current workflow engine service.
[0020] Optionally, after using the event publisher to send the encapsulated request to be processed to the business processing end, the method further includes:
[0021] Suspending the communication connection between the responsive programming functional component and the business processing end;
[0022] Correspondingly, waiting for the service processing end to return the processing result of the current workflow engine service includes:
[0023] Waiting for the service processing end to return the processing result of the current workflow engine service through the communication connection.
[0024] Optionally, the working thread pool includes a plurality of thread units, and the thread unit includes a selector, a task queue, and an execution thread;
[0025] Correspondingly, triggering the working thread pool to process the waiting process node based on the pending request to obtain the encapsulated pending request includes:
[0026] A target thread unit is determined from the multiple thread units, and the pending request is added to the task queue of the target thread unit, so that the selector of the target thread unit selects the target pending request from the pending requests stored in the task queue, and triggers the execution thread of the target thread unit to process the waiting process node based on the target pending request to obtain the encapsulated pending request.
[0027] Optionally, after releasing the first core thread, the method further includes:
[0028] Monitor whether there is a next workflow engine business. If there is, determine the next workflow engine business as a new current workflow engine business, and jump again to the step of splitting the business logic of the current workflow engine business.
[0029] Optionally, calling the second core thread determined by the core thread pool based on the thread application request to process the output process node includes:
[0030] The core thread pool selects a second core thread from each idle core thread based on the thread application request, and calls the second core thread to process the output process node.
[0031] In a second aspect, the present application discloses a workflow engine business processing device, comprising:
[0032] The business logic splitting module is used to split the business logic of the current workflow engine business to obtain input process nodes, waiting process nodes and output process nodes;
[0033] A first node execution module, configured to process the input process node using a first core thread in a core thread pool, and release the first core thread after sending the obtained pending request of the current workflow engine service to the responsive programming function component;
[0034] A second node execution module is used to trigger the responsive programming function component to process the waiting process node based on the pending request, obtain the processing result of the current workflow engine business, and send a thread application request to the core thread pool based on the processing result;
[0035] The third node execution module is used to call the second core thread determined by the core thread pool based on the thread application request to process the output process node and release the second core thread.
[0036] In a third aspect, the present application discloses an electronic device, comprising:
[0037] Memory, used to store computer programs;
[0038] The processor is used to execute the computer program to implement the steps of the workflow engine business processing method disclosed above.
[0039] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein, when the computer program is executed by a processor, the steps of the workflow engine business processing method disclosed above are implemented.
[0040] The beneficial effects of the present application are as follows: the present application splits the business logic of the current workflow engine business to obtain input process nodes, waiting process nodes and output process nodes; uses the first core thread in the core thread pool to process the input process node, and sends the obtained pending request of the current workflow engine business to the responsive programming functional component, and then releases the first core thread; triggers the responsive programming functional component to process the waiting process node based on the pending request, obtains the processing result of the current workflow engine business, and sends a thread application request to the core thread pool based on the processing result; calls the second core thread determined by the core thread pool based on the thread application request to process the output process node, and releases the second core thread. It can be seen that the present application splits the business logic of the current workflow engine business. The first core thread and the second core thread in the core thread pool only need to process input process nodes and output process nodes, and the processing time required for input process nodes and output process nodes is relatively short, so the first core thread and the second core thread can be released quickly to process the input process nodes of other workflow engine businesses, thereby reducing the occupancy time of the core threads and improving the concurrent processing capability of the system. The responsive programming functional component processes the waiting process nodes with a longer waiting time. The responsive programming functional component will always check whether there are new pending requests, and trigger the processing of the waiting process nodes based on the processing requests, and always check whether the processing results are obtained, so as to send thread application requests to the core thread pool based on the processing results. This mechanism makes more full use of system resources, avoids idle resources due to the long waiting time required for waiting process nodes, and improves the performance and efficiency of workflow engine business processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0042] Figure 1 A flowchart of a workflow engine business processing method disclosed in this application;
[0043] Figure 2 It is a specific traditional workflow engine business process flow chart;
[0044] Figure 3 A specific thread pool structure diagram disclosed in this application;
[0045] Figure 4A specific workflow engine business processing sequence diagram disclosed in this application;
[0046] Figure 5 This is a schematic diagram of the structure of a workflow engine business processing device disclosed in this application;
[0047] Figure 6 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0049] During the business processing of the workflow engine, the core thread pool executes each process node synchronously. If it takes 10 minutes for the core thread in the core thread pool to process the current process node A, the core thread will synchronously wait for 10 minutes until the processing is completed before continuing to execute the next process node B. During these 10 minutes, the core thread is in a waiting state and does not perform other operations. Currently, the core thread pool has a fixed number of threads (for example, 50 threads). After more than 10,000 businesses start to be processed at the same time, 50 threads will be stuck in the current process node A, and other nodes will be blocked. This is because there are no idle core threads to execute nodes in other businesses. Only when the current process node A returns the result and releases the thread, other businesses will continue to be executed. It can be seen that this is a great waste of performance.
[0050] To this end, the present application provides a workflow engine business processing solution to improve the performance and efficiency of workflow engine business processing.
[0051] See also Figure 1 As shown, the embodiment of the present application discloses a workflow engine business processing method, including:
[0052] Step S11: split the business logic of the current workflow engine business to obtain input process nodes, waiting process nodes and output process nodes.
[0053] For example Figure 2A specific traditional workflow engine business processing flow chart is shown. In the traditional workflow engine business processing process, the business logic is not split, that is, the business logic of the workflow engine business is all processed by the same core thread. For example, the specific workflow engine business is an http interface related business. The business logic of the business includes node input, sending http requests, returning http results, node output and other process nodes, all of which are handled by core thread A. Because the processing efficiency of http requests depends on the external system, that is, the business processing end, when the business processing end is busy or the business logic is complex, the http results will be returned very slowly, which will eventually lengthen the time consumption of the process node. At the same time, because it is a synchronous request, the core thread A is always occupied, so that it cannot be released back to the core thread pool, and it cannot execute other process nodes. It can only wait for the business processing end to return the http results, which causes the core thread A to be in a state of resource waste for part of the time. Based on this, this embodiment splits the business logic into three main parts, namely, input process nodes, waiting process nodes and output process nodes. Different process nodes do not necessarily require the same thread to process. In other words, after the current core thread processes the process node it is responsible for, it will process the next process node without wasting time and resources in a waiting state.
[0054] Step S12: using the first core thread in the core thread pool to process the input process node, and after sending the obtained pending request of the current workflow engine service to the responsive programming function component, releasing the first core thread.
[0055] An idle first core thread is selected from the core thread pool, and then the first core thread is used to process the input process nodes that require less time, so as to obtain the pending requests of the current workflow engine business, and after sending the pending requests to the responsive programming functional component, the first core thread is released. It can be seen that the first core thread only needs to complete the processing of the input process nodes of the current workflow engine business, and does not need to wait for the business processing end to return the processing results of the waiting process nodes of the current workflow engine business, but directly releases the first core thread, so that the first core thread is in an idle state, and there is no need to occupy the first core thread unreasonably.
[0056] In this embodiment, after releasing the first core thread, it also includes: monitoring whether there is a next workflow engine business, and if there is the next workflow engine business, determining the next workflow engine business as the new current workflow engine business, and jumping back to the step of splitting the business logic of the current workflow engine business. It can be understood that after releasing the first core thread, the first core thread is in an idle state, and when there is a next workflow engine business, the idle first core thread can be selected to process the input process node of the new business, over and over again. The first core thread can be in a busy state instead of a waiting state during the time period of processing different businesses. In other words, the first core thread does not exist in a situation where it is occupied by the process node of the business and is in a waiting state, which can effectively improve the utilization rate of the core thread.
[0057] Step S13: triggering the responsive programming functional component to process the waiting process node based on the pending request, obtaining the processing result of the current workflow engine business, and sending a thread application request to the core thread pool based on the processing result.
[0058] It is understandable that responsive programming is an alternative to imperative programming. This alternative exists because responsive programming solves the limitations of imperative programming. By understanding these limitations, the benefits of responsive patterns can be better grasped. Responsive programming is functional and declarative, involving the description of pipelines or streams through which data flows, rather than describing a set of steps to be executed in sequence. Responsive streams process data as long as it is available, rather than requiring the data to be provided as a whole. In fact, the input data can be infinite, such as a constant stream of real-time temperature data at a certain location. java.nio (java non-blocking IO) refers to the new API (Application Programming Interface) provided in JDK1.4 and above to provide a data container with cache support for primitive types, which can be used to provide non-blocking, highly scalable networks.
[0059] In this embodiment, the responsive programming functional component includes a working thread pool, an event publisher, and an event subscriber; the responsive programming functional component is triggered based on the pending request to process the waiting process node, obtain the processing result of the current workflow engine business, and send a thread application request to the core thread pool based on the processing result, including: triggering the working thread pool to process the waiting process node based on the pending request to obtain the encapsulated pending request; using the event publisher to send the encapsulated pending request to the business processing end to obtain the processing result of the current workflow engine business; using the event subscriber to send the processing result to the core thread pool to send a thread application request to the core thread pool based on the processing result. The responsive programming functional component is introduced on the basis of the original functional component. The responsive programming functional component includes a working thread pool, an event publisher, and an event subscriber, and the event publisher is shared in the working thread pool. The event subscriber acts as a coordinator and will apply for a processing thread to the core thread pool with exception information and a result set. The specific process of the responsive programming functional component processing the waiting process node is as follows:
[0060] 1) The pending request can trigger the worker thread pool to process the waiting process node to obtain the encapsulated pending request;
[0061] 2) Use the event publisher to send the encapsulated pending request to the business processing end to obtain the processing result of the current workflow engine business. It should be noted that the processing result of the current workflow engine business can be the response result returned by the business processing end in response to the encapsulated pending request, or it can be generated when the business processing end fails to return the response result within the specified time;
[0062] 3) Use event subscribers to send processing results to the core thread pool, and send thread application requests to the core thread pool based on the processing results. That is to say, after obtaining the processing results of the current workflow engine business, the event subscriber sends the processing results to the core thread pool, so that an idle core thread can be applied for subsequent processing.
[0063] In this embodiment, the use of the event publisher to send the encapsulated request to be processed to the business processing end to obtain the processing result of the current workflow engine business includes: using the event publisher to send the encapsulated request to be processed to the business processing end, and determining the sending time of the encapsulated request to be processed; judging whether the time interval between the current time and the sending time is greater than a preset threshold; if the time interval between the current time and the sending time is not greater than the preset threshold, waiting for the business processing end to return the processing result of the current workflow engine business; if the time interval between the current time and the sending time is greater than the preset threshold, generating a processing timeout result, and determining the processing timeout result as the processing result of the current workflow engine business. It is understandable that after the event publisher sends the encapsulated pending request to the business processing end, there may be a situation where the business processing end cannot respond to the encapsulated pending request in time, that is, after sending the request, it keeps monitoring whether the time interval between the current time and the request sending time is greater than the preset threshold. If it is greater, it means that the business processing end has timed out in responding to the business. At this time, a processing timeout result is automatically generated, indicating that there is an abnormality in the current business processing end, and the processing timeout result is used as the processing result of the current workflow engine business and returned to the core thread pool; if it is less than, it means that the business processing end has not responded to the business timeout at this time, and you can continue to wait for the business processing end to return the processing result of the current workflow engine business. When the business processing end returns the processing result of the current workflow engine business, the processing result of the current workflow engine business is returned to the core thread pool.
[0064] In this embodiment, after the event publisher sends the encapsulated pending request to the business processing end, the method further includes: suspending the communication connection between the responsive programming functional component and the business processing end. After the event publisher sends the encapsulated pending request to the business processing end, the communication connection between the responsive programming functional component and the business processing end is suspended. It should be noted that suspending the communication connection does not mean closing the communication connection.
[0065] In this embodiment, the waiting for the service processing end to return the processing result of the current workflow engine service includes: waiting for the service processing end to return the processing result of the current workflow engine service through the communication connection. The responsive programming functional component receives the processing result of the current workflow engine service returned by the service processing end through the communication connection.
[0066] In this embodiment, the working thread pool includes multiple thread units, and the thread units include selectors, task queues, and execution threads; accordingly, the triggering of the working thread pool to process the waiting process node based on the pending request to obtain the encapsulated pending request includes: determining a target thread unit from the multiple thread units, and adding the pending request to the task queue of the target thread unit, so that the selector of the target thread unit selects the target pending request from each pending request stored in the task queue, and triggering the execution thread of the target thread unit to process the waiting process node based on the target pending request to obtain the encapsulated pending request. For example Figure 3 A specific thread pool structure diagram is shown, where the working thread pool includes multiple thread units eventGroup, each thread unit includes a selector selector, a task queue taskQueue and an execution thread eventLoop, and a target thread unit is determined from the multiple thread units. The target thread unit can be selected according to the busyness of each thread unit, and the pending request is added to the task queue of the target thread unit, so that the selector of the target thread unit selects the target pending request from the pending requests stored in the task queue and determines the priority of each pending request, so that the selector can determine the target pending request from the pending requests according to the priority of each pending request, and then trigger the execution thread of the target thread unit to process the waiting process node based on the target pending request to obtain the encapsulated pending request.
[0067] Step S14: calling the second core thread determined by the core thread pool based on the thread application request to process the output process node, and releasing the second core thread.
[0068] In this embodiment, the calling of the second core thread determined by the core thread pool based on the thread application request to process the output process node includes: filtering out the second core thread from each idle core thread based on the thread application request by the core thread pool, and calling the second core thread to process the output process node. The core thread pool filters out the second core thread from each idle core thread according to the thread application request, and calls the second core thread to process the output process node. It should be noted that the second core thread used to process the output process node of the current workflow engine business may be the first core thread, or may not be the first core thread. The core thread pool will filter out the second core thread according to the idle state and busy state of each core thread. For example, core thread A processes the input process node, and core thread B processes the output process node; when the second core thread finishes processing the output process node, the second core thread is released, so that the second core thread returns to the idle state. When there is an output process node to be processed for the next workflow engine business, the idle second core thread can also be called.
[0069] The beneficial effects of the present application are as follows: the present application splits the business logic of the current workflow engine business to obtain input process nodes, waiting process nodes and output process nodes; uses the first core thread in the core thread pool to process the input process node, and sends the obtained pending request of the current workflow engine business to the responsive programming functional component, and then releases the first core thread; triggers the responsive programming functional component to process the waiting process node based on the pending request, obtains the processing result of the current workflow engine business, and sends a thread application request to the core thread pool based on the processing result; calls the second core thread determined by the core thread pool based on the thread application request to process the output process node, and releases the second core thread. It can be seen that the present application splits the business logic of the current workflow engine business. The first core thread and the second core thread in the core thread pool only need to process input process nodes and output process nodes, and the processing time required for input process nodes and output process nodes is relatively short, so the first core thread and the second core thread can be released quickly to process the input process nodes of other workflow engine businesses, thereby reducing the occupancy time of the core threads and improving the concurrent processing capability of the system. The responsive programming functional component processes the waiting process nodes with a longer waiting time. The responsive programming functional component will always check whether there are new pending requests, and trigger the processing of the waiting process nodes based on the processing requests, and always check whether the processing results are obtained, so as to send thread application requests to the core thread pool based on the processing results. This mechanism makes more full use of system resources, avoids idle resources due to the long waiting time required for waiting process nodes, and improves the performance and efficiency of workflow engine business processing.
[0070] Below Figure 4 Taking a specific workflow engine business processing sequence diagram shown as an example, the present application is explained accordingly.
[0071] 1) Split the business logic of the current workflow engine business (i.e., workflow engine business 1) to obtain input process nodes, waiting process nodes, and output process nodes;
[0072] 2) Using the first core thread in the core thread pool to process the input process node, for example, the first core thread pool is core thread A, and after sending the pending request of the current workflow engine business to the responsive programming function component, the core thread A is released. When there is the next workflow engine business (i.e., workflow engine business 2), the core thread A can be called to process the input process node of the next workflow engine business;
[0073] 3) Based on the pending request, the responsive programming function component is triggered to process the waiting process node, obtain the processing result of the current workflow engine business, and send a thread application request to the core thread pool based on the processing result; specifically, the responsive programming function component is triggered to send the encapsulated pending request to the business processing end, and the communication connection between the responsive programming function component and the business processing end is suspended, waiting for the business processing end to return the processing result of the current workflow engine business through the communication connection to complete the processing of the waiting process node, and then the processing result is sent to the core thread pool, so as to send a thread application request to the core thread pool based on the processing result;
[0074] 4) Call the second core thread determined by the core thread pool based on the thread application request to process the output process node, and release the second core thread. Specifically, the core thread pool selects the second core thread from the idle core threads based on the thread application request, such as core thread B, and calls core thread B to process the output process node. When core thread B finishes processing the output process node, core thread B is released.
[0075] See also Figure 5 As shown, the embodiment of the present application discloses a workflow engine business processing device, including:
[0076] The business logic splitting module 11 is used to split the business logic of the current workflow engine business to obtain input process nodes, waiting process nodes and output process nodes;
[0077] A first node execution module 12 is used to process the input process node using a first core thread in a core thread pool, and after sending the obtained pending request of the current workflow engine service to the responsive programming function component, release the first core thread;
[0078] The second node execution module 13 is used to trigger the responsive programming function component to process the waiting process node based on the pending request, obtain the processing result of the current workflow engine business, and send a thread application request to the core thread pool based on the processing result;
[0079] The third node execution module 14 is used to call the second core thread determined by the core thread pool based on the thread application request to process the output process node, and release the second core thread.
[0080] The beneficial effects of the present application are as follows: the present application splits the business logic of the current workflow engine business to obtain input process nodes, waiting process nodes and output process nodes; uses the first core thread in the core thread pool to process the input process node, and sends the obtained pending request of the current workflow engine business to the responsive programming functional component, and then releases the first core thread; triggers the responsive programming functional component to process the waiting process node based on the pending request, obtains the processing result of the current workflow engine business, and sends a thread application request to the core thread pool based on the processing result; calls the second core thread determined by the core thread pool based on the thread application request to process the output process node, and releases the second core thread. It can be seen that the present application splits the business logic of the current workflow engine business. The first core thread and the second core thread in the core thread pool only need to process input process nodes and output process nodes, and the processing time required for input process nodes and output process nodes is relatively short, so the first core thread and the second core thread can be released quickly to process the input process nodes of other workflow engine businesses, thereby reducing the occupancy time of the core threads and improving the concurrent processing capability of the system. The responsive programming functional component processes the waiting process nodes with a longer waiting time. The responsive programming functional component will always check whether there are new pending requests, and trigger the processing of the waiting process nodes based on the processing requests, and always check whether the processing results are obtained, so as to send thread application requests to the core thread pool based on the processing results. This mechanism makes more full use of system resources, avoids idle resources due to the long waiting time required for waiting process nodes, and improves the performance and efficiency of workflow engine business processing.
[0081] Furthermore, an embodiment of the present application also provides an electronic device. Figure 6 This is a structural diagram of an electronic device 20 according to an exemplary embodiment. The content in the diagram cannot be regarded as any limitation on the scope of use of the present application.
[0082] Figure 6A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Specifically, it may include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the workflow engine business processing method performed by the electronic device disclosed in any of the aforementioned embodiments.
[0083] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device; the communication interface 24 can create a data transmission channel between the electronic device and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.
[0084] Among them, the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 21 can be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 21 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 21 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 21 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0085] In addition, the memory 22, as a carrier for storing resources, can be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon include an operating system 221, a computer program 222 and data 223, etc. The storage method can be temporary storage or permanent storage.
[0086] Among them, the operating system 221 is used to manage and control the hardware devices and computer programs 222 on the electronic device to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21, which can be Windows, Unix, Linux, etc. In addition to including a computer program that can be used to complete the workflow engine business processing method performed by the electronic device disclosed in any of the aforementioned embodiments, the computer program 222 can also further include a computer program that can be used to complete other specific tasks. In addition to data received by the electronic device and transmitted from an external device, the data 223 can also include data collected by its own input and output interface 25, etc.
[0087] Furthermore, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the workflow engine business processing method disclosed above. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the above embodiments, and no further description will be given here.
[0088] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0089] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. The steps of the method or algorithm described in conjunction with the embodiments disclosed herein can be implemented directly with hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), memory, read-only memory (ROM), electrically programmable EPROM (Erasable Programmable Read Only Memory), electrically erasable programmable EEPROM (Electrically Erasable Programmable read only memory), register, hard disk, removable disk, CD-ROM (Compact Disc Read-Only Memory), or any other form of storage medium known in the technical field.
[0090] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0091] The above is a detailed introduction to a workflow engine business processing method, device, equipment and medium provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A workflow engine business processing method, characterized in that: include: Split the business logic of the current workflow engine business to obtain input process nodes, waiting process nodes, and output process nodes; Using a first core thread in a core thread pool to process the input process node, and after sending the obtained pending request of the current workflow engine service to the responsive programming function component, releasing the first core thread; Triggering the responsive programming functional component to process the waiting process node based on the pending request, obtaining the processing result of the current workflow engine business, and sending a thread application request to the core thread pool based on the processing result; The core thread pool is called to process the output process node with a second core thread determined based on the thread application request, and the second core thread is released.
2. The workflow engine business processing method according to claim 1, characterized in that: The responsive programming functional components include a worker thread pool, an event publisher, and an event subscriber; The triggering of the responsive programming functional component to process the waiting process node based on the pending request, obtaining the processing result of the current workflow engine business, and sending a thread application request to the core thread pool based on the processing result includes: Triggering the working thread pool to process the waiting process node based on the pending request to obtain the encapsulated pending request; Using the event publisher to send the encapsulated request to be processed to the business processing end to obtain the processing result of the current workflow engine business; The processing result is sent to the core thread pool by using the event subscriber, so as to send a thread application request to the core thread pool based on the processing result.
3. The workflow engine business processing method according to claim 2, characterized in that: The using the event publisher to send the encapsulated request to be processed to the business processing end to obtain the processing result of the current workflow engine business includes: Using the event publisher to send the encapsulated request to be processed to the business processing end, and determining the sending time of the encapsulated request to be processed; Determine whether the time interval between the current time and the sending time is greater than a preset threshold; If the time interval between the current time and the sending time is not greater than the preset threshold, waiting for the service processing end to return the processing result of the current workflow engine service; If the time interval between the current time and the sending time is greater than the preset threshold, a processing timeout result is generated, and the processing timeout result is determined as the processing result of the current workflow engine service.
4. The workflow engine business processing method according to claim 3, characterized in that: After using the event publisher to send the encapsulated request to be processed to the business processing end, the method further includes: Suspending the communication connection between the responsive programming functional component and the business processing end; Correspondingly, waiting for the service processing end to return the processing result of the current workflow engine service includes: Waiting for the service processing end to return the processing result of the current workflow engine service through the communication connection.
5. The workflow engine business processing method according to claim 2, characterized in that: The working thread pool includes a plurality of thread units, each of which includes a selector, a task queue, and an execution thread; Correspondingly, triggering the working thread pool to process the waiting process node based on the pending request to obtain the encapsulated pending request includes: A target thread unit is determined from the multiple thread units, and the pending request is added to the task queue of the target thread unit, so that the selector of the target thread unit selects the target pending request from the pending requests stored in the task queue, and triggers the execution thread of the target thread unit to process the waiting process node based on the target pending request to obtain the encapsulated pending request.
6. The workflow engine business processing method according to claim 1, characterized in that: After releasing the first core thread, the method further includes: Monitor whether there is a next workflow engine business. If there is, determine the next workflow engine business as a new current workflow engine business, and jump again to the step of splitting the business logic of the current workflow engine business.
7. The workflow engine business processing method according to any one of claims 1 to 6, characterized in that: The calling of the second core thread determined by the core thread pool based on the thread application request to process the output process node includes: The core thread pool selects a second core thread from the idle core threads based on the thread application request, and calls the second core thread to process the output process node.
8. A workflow engine business processing device, characterized in that: include: The business logic splitting module is used to split the business logic of the current workflow engine business to obtain input process nodes, waiting process nodes and output process nodes; A first node execution module, configured to process the input process node using a first core thread in a core thread pool, and release the first core thread after sending the obtained pending request of the current workflow engine service to the responsive programming function component; A second node execution module is used to trigger the responsive programming function component to process the waiting process node based on the pending request, obtain the processing result of the current workflow engine business, and send a thread application request to the core thread pool based on the processing result; The third node execution module is used to call the second core thread determined by the core thread pool based on the thread application request to process the output process node and release the second core thread.
9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor is used to execute the computer program to implement the steps of the workflow engine business processing method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein, when the computer program is executed by a processor, the steps of the workflow engine business processing method as described in any one of claims 1 to 7 are implemented.