An event-triggered workflow engine algorithm
By integrating event reception, storage, consumption and condition judgment modules in the workflow engine, and adopting standardized event configuration and event queue optimization queuing algorithm, the problem of insufficient real-time and flexibility in the event-driven mode in the existing technology is solved, and the Event-triggered processes and process-driven businesses improve the ability to respond to emergencies and the maintainability of the system.
Patent Information
- Application Number
- CN202410382272.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-01
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-04-01
AI Technical Summary
In the event-driven mode of the existing workflow engine, the real-time and flexibility of events are limited, and the triggering of process nodes relies on business requests initiated by the application layer, which may cause conflicts or delays in emergency scenarios and fail to effectively handle complex events. and priority control.
Integrate the reception, storage, consumption, distribution, parsing and condition judgment of events into the workflow engine, and use standardized event configuration, event queue optimization queuing and complex event condition judgment algorithms to implement event triggering processes and process-driven businesses to improve real-time performance and agility.
It improves the event processing capabilities of the workflow engine, realizes the operating mechanism of event-triggered processes and process-driven businesses, reduces the development and maintenance costs of process changes, enhances the response capabilities to emergencies and the maintainability of the system, and improves Improve resource utilization efficiency and process execution efficiency.
Smart Images

Figure CN118377519B
Abstract
Description
Technical Field
[0001] The present invention relates to an event-triggered workflow engine algorithm, and in particular to an event-triggered workflow engine algorithm applied in the technical field of workflow engines. Background Art
[0002] Traditional workflow engines divide complex business processes into multiple nodes. Whether a node is executed or not depends on the triggering of node execution conditions by internal and external events. However, existing workflow engines are usually only responsible for process modeling, and event parsing and conditional judgment are implemented by the application layer. This leads to the need to modify the application layer code in addition to modifying the process template when adjusting the business process, which increases the difficulty of system maintenance. In the event-driven mode, the event source puts the event into an independent event queue. The engine needs to consume a large number of events to obtain key events, and the real-time performance is poor, especially in emergency business processes with complex external tasks and sub-tasks.
[0003] The specification of Chinese invention patent CN113672205 discloses a workflow framework driven by business events. The framework uses the process layer proxy interface to find the corresponding process instance and current node according to the business number, calls the business service to obtain the processing result, and then transfers the instance to the next node according to the preset flow conditions. This design separates the process flow logic from the business application layer and service layer to the process layer, avoiding the pollution of the process logic to the business code, achieving high cohesion and low coupling between the process and the business, and improving the scalability of the framework.
[0004] However, the framework still has some shortcomings. The triggering of process nodes is completely dependent on business requests initiated by the application layer. The ability to respond to external events is insufficient. The processing results of business services can only affect the process through request responses. The real-time and flexibility are limited. The framework does not involve complex event processing and priority control, which may cause conflicts or delays in emergency scenarios triggered by multiple events. Summary of the invention
[0005] In view of the above-mentioned prior art, the technical problem to be solved by the present invention is to integrate the reception, storage, consumption, distribution, parsing and conditional judgment of events into the engine, simplify maintenance and improve real-time performance, introduce the event-driven mechanism into the underlying algorithm of the workflow engine, and give it the ability to perceive and process business events, so as to realize an agile process of event-triggered processes and process-driven businesses, which can not only reduce the development and maintenance costs when the process changes, but also improve the agility and resilience of the process in responding to emergencies.
[0006] To solve the above problems, the present invention provides a workflow engine algorithm based on event triggering, including a workflow engine and multiple business systems, wherein the workflow engine includes a workflow engine interface, a conditional event queue, a conditional event distribution and consumption module, a conditional event configuration module, a conditional judgment module, and a process template;
[0007] The following steps are also included:
[0008] S1. Standardized event configuration: converting the original event into a standard event through a standardized event configuration method, wherein the standard event includes priority and consumer feature information;
[0009] S2, event queue optimization queuing, the conditional event queue receives and stores standard events, and uses the event queue optimization queuing algorithm to optimize the queue of standard events according to their priority and consumer feature information;
[0010] S3, process instance generation, generating a process instance according to the process template and input parameters obtained from the workflow engine interface;
[0011] S4, event distribution and node judgment, the conditional event distribution consumption module consumes standard events from the conditional event queue and distributes them to the process instance, and the conditional judgment module uses the complex event condition judgment algorithm to determine whether to trigger the node execution according to the event condition;
[0012] Complex event condition judgment algorithms include:
[0013] Event attribute extraction, extracting attribute vectors and weights of standard events;
[0014] Conditional initialization, the satisfaction degree of each condition of the initialization node is 0;
[0015] Event matching, calculate the weighted similarity between each standard event attribute vector and the condition attribute vector as the matching degree between the event and the condition;
[0016] Condition satisfaction update: update the satisfaction of each condition to the maximum matching degree of all events matching it;
[0017] Condition satisfaction judgment, comparing the satisfaction of each condition with its threshold to determine whether the condition is met;
[0018] Node execution decision, based on the Boolean expression of the node execution condition and the satisfaction of each condition, decides whether to trigger the node execution; the node execution condition is composed of a logical combination of standard events;
[0019] S5, process completion and monitoring optimization. The end node execution completion represents the process execution completion. The process monitoring interface displays the process progress and efficiency for optimizing process templates and parameters.
[0020] The original events include events generated within the system and events generated by tasks and subtasks of the external business system.
[0021] As a further improvement of the present application, the standardized event configuration method includes:
[0022] Key attribute identification: identifying the most critical attribute subset for event judgment and processing from the original event attribute set;
[0023] Attribute mapping, establishing the mapping relationship between key attributes and standard event attributes;
[0024] Attribute value conversion: convert the values of each key attribute of the original event into the values of the corresponding standard event attributes.
[0025] As a further improvement of the present application, the event queue optimization queuing algorithm includes:
[0026] Feature extraction, extracting event priority and consumer feature vectors;
[0027] Priority sorting, sorting events in descending order according to their priority;
[0028] Grouping of events with the same priority: events with the same priority are divided into one group. Events within the group have the same priority, and events between groups have decreasing priorities.
[0029] Consumer feature matching: calculate the similarity between each event and the consumer feature vector as the consumer feature matching degree of the event;
[0030] In-group sorting: In each event group, events are sorted in descending order according to the matching degree of the event consumer characteristics;
[0031] Event queue generation: The sorted event groups are spliced from high to low priority to form an optimized event queue.
[0032] As a further improvement of the present application, the complex event condition judgment algorithm includes:
[0033] Event attribute extraction, extracting attribute vectors and weights of standard events;
[0034] Conditional initialization, the satisfaction degree of each condition of the initialization node is 0;
[0035] Event matching, calculate the weighted similarity between each standard event attribute vector and the condition attribute vector as the matching degree between the event and the condition;
[0036] Condition satisfaction update: update the satisfaction of each condition to the maximum matching degree of all events matching it;
[0037] Condition satisfaction judgment, comparing the satisfaction of each condition with its threshold to determine whether the condition is met;
[0038] The node execution decision is based on the Boolean expression of the node execution condition and the satisfaction of each condition to decide whether to trigger the node execution; the node execution condition is composed of a logical combination of standard events.
[0039] As another improvement of the present application, the following steps are also included:
[0040] Process template design: business analysts sort out business processes, divide process nodes, clarify node execution conditions, use standardized event configuration methods to define standard events, design process templates, and publish them to the engine;
[0041] Event standardization and queue entry, standardized events are pushed to the conditional event queue, and the event distribution and consumption module uses the event queue optimization queuing algorithm to distribute events to process instances;
[0042] Node judgment and execution, the condition judgment module uses the complex event condition judgment algorithm to judge whether the node condition is met. If it is met, the node execution is triggered, the result is output and the process is driven forward. If it is not met, it continues to wait for the event;
[0043] The process is completed. When the terminal node is executed, it means the process is executed, the result is output, and the resources occupied by the instance are released.
[0044] Process monitoring and optimization: managers can understand process progress and efficiency through the process monitoring interface, analyze inefficient links, adjust process templates, modify event definitions, condition weights and other parameters, and optimize processes.
[0045] As another improved supplement of the present application, the event queue optimization queuing algorithm further includes:
[0046] Set the expiration time of the event to determine whether the waiting time of the event in the queue exceeds the preset expiration threshold. If it exceeds, the event will be removed from the queue;
[0047] Queue sharding management divides the event queue into multiple sub-queues for different consumers according to their characteristics and load conditions, thus achieving parallel distribution and processing of events.
[0048] As another improved supplement of the present application, the standardized event configuration method further supports:
[0049] Use expert knowledge base to define standard event attributes and mapping relationships;
[0050] Use data mining algorithms to learn and optimize event attribute mapping rules from historical event data;
[0051] Use online machine learning algorithms to optimize event attribute extraction, conversion, and mapping strategies in real time to improve the adaptability and accuracy of event standardization.
[0052] As another improvement of the present application, the complex event condition judgment algorithm further supports selecting one or more of the following steps as needed:
[0053] Use multiple attribute similarity measurement functions to adapt to different types of event attributes;
[0054] Introducing machine learning algorithms to dynamically adjust condition thresholds and improve flexibility in judgment;
[0055] Supports customized conditional combination logic to meet personalized node execution control requirements.
[0056] The following steps are involved:
[0057] Receive original events, extract event attributes, and convert original events into standard events according to preset standardization rules;
[0058] Standard events are queued according to priority and consumer characteristics, with high-priority events and events that are highly compatible with consumers being processed first;
[0059] Distribute standard events to corresponding process instance nodes and update the conditional status of the nodes;
[0060] Determine whether the node condition is met. If it is met, the node execution is triggered. If it is not met, wait for subsequent events.
[0061] Output node execution results to drive the process forward until the process is completed;
[0062] Monitor process execution efficiency, adjust process templates, event attribute mapping, condition weights and other parameters, and dynamically optimize the process.
[0063] In summary, this application has the following beneficial effects:
[0064] 1. Improve the event processing capability of the workflow engine. The conditional event queue, event distribution and consumption module, event configuration module and event judgment module are integrated into the workflow engine to form a complete event-driven process management solution. The engine can directly perceive and process various business events, convert events into the driving force of the process, and truly realize the operation mechanism of event-triggered process and process-driven business, breaking the limitation of traditional workflows that passively wait for business calls, enabling them to actively perceive and respond to business changes in a timely manner, and improving the real-time and agility of workflows.
[0065] 2. Improve the priority processing capability of key business events, use the event queue to optimize the queuing algorithm, and intelligently sort the events according to the event priority and consumer characteristics to ensure that high-priority and process-related events can be processed first, avoiding low-value events from occupying system resources and affecting the execution efficiency of key businesses. At the same time, since complex event dependency judgments are completed within the engine, the waiting time for the application layer to judge events is eliminated, so that the process can quickly respond to business demands. Especially in emergency scenarios where sudden events occur frequently, the present invention can identify the most urgent and important events from massive events, quickly drive related processes, and improve the workflow's ability to respond to crises.
[0066] 3. Simplify the development and maintenance work when the process changes. A standardized event model and configurable rules are introduced to unify and abstract the heterogeneous events originally scattered in various business systems to form a common event semantic system. Based on this, the event triggering conditions of the process can be configured directly in the process template without hard coding in the application layer code, thus realizing the decoupling of business logic and process control. When the business process changes, only the process template and event rules need to be modified to automatically drive the execution conditions of all related nodes to be updated without modifying the business code. This reduces the development and testing workload of process changes and improves the maintainability of the system.
[0067] 4. Reduce resource consumption and waiting time for event processing. Traditional event-driven workflows usually adopt a publish-subscribe model. The engine needs to filter out specific events that the process is concerned about from massive events, which causes the system to consume a lot of resources to store and process irrelevant events, and the events that actually trigger the process conditions may have to wait for a long time before they are processed. The present invention performs fine-grained priority labeling and feature extraction when events are queued, so that the engine can discover and process process-related events as early as possible, reducing event accumulation and redundant processing, and improving resource utilization efficiency. At the same time, the length of the event queue can also be dynamically controlled through an optimization algorithm to avoid unlimited expansion.
[0068] 5. A set of core algorithms that support the full life cycle management of workflows is provided. The standardized event configuration method, event queue optimization queuing algorithm, and complex event condition judgment algorithm proposed in the present invention provide practical computing models and implementation logic from the three key links of event adaptation, event scheduling, and event judgment. These three algorithms cover the core scenarios of event-driven process management, are versatile and scalable, and can support the flexible orchestration and efficient execution of complex business processes. At the same time, the algorithm adopts a loosely coupled componentized design, and each part can be optimized and evolved independently, which facilitates the introduction of new event types and rule engines, and continuously improves the algorithm performance.
[0069] 6. Lays a technical foundation for a new generation of intelligent and adaptive workflow platforms. The present invention adheres to the design concept of making workflows more business-aware, and endows the workflow engine with the ability to perceive business semantics and learn business rules. Based on the event-driven model, the workflow engine can continuously monitor the business operation status, and autonomously learn the business value and driving rules of events through data mining to form a knowledge base for process optimization. On this basis, the workflow platform can dynamically adjust the process model, task priority, resource allocation strategy, etc. according to the real-time business situation to achieve adaptive optimization of process management. At the same time, the event data accumulated by the workflow engine can also feed back to the business system, assist in business decision-making and predictive analysis, and achieve a business closed loop. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 This is a structural diagram of this application;
[0071] Figure 2 Interaction for this application Figure 1 ;
[0072] Figure 3 Interaction for this application Figure 2 ;
[0073] Figure 4 A flow chart of the standardized event configuration method for this application;
[0074] Figure 5 A flow chart of the standardized event configuration method for this application;
[0075] Figure 6 This is a flow chart of the event queue optimization queuing algorithm for this application;
[0076] Figure 7 This is an interaction diagram of the complex event condition judgment algorithm of this application. DETAILED DESCRIPTION
[0077] Three implementation modes of the present application are described in detail below with reference to the accompanying drawings.
[0078] The first implementation method:
[0079] Figure 1-Figure 3 Shown.
[0080] An event-triggered workflow engine algorithm includes a workflow engine and multiple business systems, wherein the workflow engine includes a workflow engine interface, a conditional event queue, a conditional event distribution and consumption module, a conditional event configuration module, a conditional judgment module, and a process template;
[0081] The following steps are also included:
[0082] S1. Standardized event configuration: converting the original event into a standard event through a standardized event configuration method, wherein the standard event includes priority and consumer feature information;
[0083] S2, event queue optimization queuing, the conditional event queue receives and stores standard events, and uses the event queue optimization queuing algorithm to optimize the queue of standard events according to their priority and consumer feature information;
[0084] S3, process instance generation, generating a process instance according to the process template and input parameters obtained from the workflow engine interface;
[0085] S4, event distribution and node judgment, the conditional event distribution consumption module consumes standard events from the conditional event queue and distributes them to the process instance, and the conditional judgment module uses the complex event condition judgment algorithm to determine whether to trigger the node execution according to the event condition;
[0086] S5, process completion and monitoring optimization. The end node execution completion represents the process execution completion. The process monitoring interface displays the process progress and efficiency for optimizing process templates and parameters.
[0087] The original events include events generated within the system and events generated by tasks and subtasks of the external business system.
[0088] Step S1, standardized event configuration. Business analysts use the standardized event configuration function provided by the conditional event configuration module through the workflow engine interface to standardize the original events generated by the business system. The original events include events generated within the system (such as timer events, abnormal events, etc.) and events generated by tasks and subtasks of the external business system (such as order creation events, payment completion events, etc.).
[0089] The standardized event configuration process is as follows: first, identify the most critical attribute subset for event judgment and processing from the attribute set of the original event, such as event type, timestamp, associated business entity ID, etc.; then, establish a mapping relationship from key attributes to standard event attributes; finally, convert the values of each key attribute of the original event into the values of the corresponding standard event attributes.
[0090] After the above standardization processing, the original event is converted into a standard event. Each standard event contains a unified set of attributes, as well as priority and consumer characteristic information. The priority is used to indicate the importance and urgency of the event. The smaller the value, the higher the priority. The consumer characteristic information is used to describe the expected consumer of the event (i.e., the process instance node), such as the business field to which it belongs, the process link in which it is located, etc.
[0091] Step S2, event queue optimization queuing, standardized events are pushed to the conditional event queue, the conditional event queue is responsible for receiving and storing standard events, in order to improve event processing efficiency, the conditional event queue uses the event queue optimization queuing algorithm to queue events.
[0092] The event queue optimization queuing algorithm first extracts the priority and consumer feature vector of each event, and then sorts the events in descending order according to the priority. Events with the same priority are divided into the same group, and the priority between groups decreases. Next, the algorithm calculates the similarity between the consumer feature vector of each event and the feature vector of the process instance node as the consumer matching degree of the event. Within each priority group, the algorithm sorts the events in descending order according to the consumer matching degree of the event. Finally, the sorted priority groups are spliced in order to form an optimized event queue.
[0093] By optimizing the queuing of event queues, events with high priority and highly matching with the current process instance nodes will be processed first, thus improving the timeliness and effectiveness of event processing.
[0094] Step S3, process instance generation. Business personnel select a pre-designed process template through the workflow engine interface, fill in the necessary input parameters (such as the associated business order number, customer information, etc.), and then submit a process instance generation request. The workflow engine generates a process instance based on the obtained process template and input parameters, and initializes the context data of the process instance.
[0095] Step S4, event distribution and node judgment. The conditional event distribution consumption module continues to consume queued standard events from the conditional event queue, and distributes the events to the corresponding process instance nodes according to the characteristic information of the event consumer. After the conditional judgment module of the process instance receives the standard event, it uses the complex event condition judgment algorithm to determine whether the execution conditions of the node are met.
[0096] The complex event condition judgment algorithm first extracts the attribute vector and weight of the standard event, then initializes the satisfaction of each node condition to 0. The algorithm calculates the weighted similarity between each standard event attribute vector and the condition attribute vector as the matching degree of the event to the condition, and updates the satisfaction of the condition to the maximum matching degree of all matching events. Next, the algorithm compares the satisfaction of each condition with the preset threshold to determine whether the condition is satisfied. Finally, the algorithm determines whether to trigger the node execution based on the Boolean expression of the node execution condition and the satisfaction of each condition. The node execution condition can be a logical combination of multiple standard events, such as event A and event B, event C or event D, etc.
[0097] If the node execution condition is met, the node execution is triggered, the result is output, and the process is driven to the next node according to the process definition; if the node execution condition is not met, the node continues to wait for subsequent events until the condition is met or the maximum waiting time of the node is reached.
[0098] Step S5, process completion and monitoring optimization. When the process instance executes to the end node and the end node is executed, the entire process instance is executed, the output result of the process instance is persistently stored, the relevant task data is updated, and the system resources occupied by the process instance are released.
[0099] Managers can use the process monitoring interface provided by the workflow engine to view information such as the execution progress of process instances, the operating efficiency of key nodes, etc. in real time. For process instances with low execution efficiency and high resource usage, managers can dynamically adjust the design of process templates based on business needs and system load, such as adding or deleting nodes, modifying branch conditions, adjusting event attribute mapping rules and condition weights, etc., to continuously optimize the execution quality and efficiency of the process.
[0100] Through key technologies such as standardized event configuration, event queue optimization, and complex event condition judgment, the workflow engine's ability to model and execute complex business processes has been improved, achieving automated and intelligent management of the entire life cycle of the process.
[0101] In practical applications, this embodiment can also be flexibly expanded and customized to meet the business needs of different industries and fields. For example, the workflow engine can be integrated with other business systems of the enterprise (such as ERP, CRM, etc.) to realize the automatic flow and synchronization of business data; machine learning algorithms can be introduced to continuously optimize event attribute extraction, queuing and node condition judgment strategies based on historical data and expert knowledge; a visual process template design tool can be provided to support users to quickly assemble and configure process templates in a drag-and-drop manner, etc. These extensions and customizations further enhance the practicality and intelligence level of this embodiment.
[0102] The second implementation method:
[0103] Figure 1-Figure 7 Shown.
[0104] The standardized event configuration method comprises:
[0105] Key attribute identification: identifying the most critical attribute subset for event judgment and processing from the original event attribute set;
[0106] Attribute mapping, establishing the mapping relationship between key attributes and standard event attributes;
[0107] Attribute value conversion: convert the values of each key attribute of the original event into the values of the corresponding standard event attributes.
[0108] The standardized event configuration method also supports:
[0109] Use expert knowledge base to define standard event attributes and mapping relationships;
[0110] Use data mining algorithms to learn and optimize event attribute mapping rules from historical event data;
[0111] Use online machine learning algorithms to optimize event attribute extraction, conversion, and mapping strategies in real time to improve the adaptability and accuracy of event standardization.
[0112] The event queue optimization queuing algorithm includes:
[0113] Feature extraction, extracting event priority and consumer feature vectors;
[0114] Priority sorting, sorting events in descending order according to their priority;
[0115] Grouping of events with the same priority: events with the same priority are divided into one group. Events within the group have the same priority, and events between groups have decreasing priorities.
[0116] Consumer feature matching: calculate the similarity between each event and the consumer feature vector as the consumer feature matching degree of the event;
[0117] In-group sorting: In each event group, events are sorted in descending order according to the matching degree of the event consumer characteristics;
[0118] Event queue generation: The sorted event groups are spliced from high to low priority to form an optimized event queue.
[0119] The event queue optimization queuing algorithm also includes:
[0120] Set the expiration time of the event to determine whether the waiting time of the event in the queue exceeds the preset expiration threshold. If it exceeds, the event will be removed from the queue;
[0121] Queue sharding management divides the event queue into multiple sub-queues for different consumers according to their characteristics and load conditions, thus achieving parallel distribution and processing of events.
[0122] The complex event condition judgment algorithm includes:
[0123] Event attribute extraction, extracting attribute vectors and weights of standard events;
[0124] Conditional initialization, the satisfaction degree of each condition of the initialization node is 0;
[0125] Event matching, calculate the weighted similarity between each standard event attribute vector and the condition attribute vector as the matching degree between the event and the condition;
[0126] Condition satisfaction update: update the satisfaction of each condition to the maximum matching degree of all events matching it;
[0127] Condition satisfaction judgment, comparing the satisfaction of each condition with its threshold to determine whether the condition is met;
[0128] The node execution decision is based on the Boolean expression of the node execution condition and the satisfaction of each condition to decide whether to trigger the node execution; the node execution condition is composed of a logical combination of standard events.
[0129] The complex event condition judgment algorithm also supports selecting one or more of the following steps as needed:
[0130] Use multiple attribute similarity measurement functions to adapt to different types of event attributes;
[0131] Introducing machine learning algorithms to dynamically adjust condition thresholds and improve flexibility in judgment;
[0132] Supports customized conditional combination logic to meet personalized node execution control requirements.
[0133] Key attribute identification: system administrators analyze business needs and historical event data to identify the most critical attribute subset for event judgment and processing from the attribute set of the original event. For example, for the order process of an e-commerce platform, key attributes may include order ID, product name, payment amount, order time, etc. This can be semi-automated with the help of expert knowledge base and data mining algorithms to improve the accuracy and efficiency of attribute identification.
[0134] Attribute mapping: the system administrator establishes a mapping relationship between the standard event attribute set and the original event key attribute set. For example, the original event's order ID attribute is mapped to the standard event's business order number attribute, and the product name attribute is mapped to the business object attribute. The attribute mapping relationship can be defined in a rule-based or template-based manner, stored in the expert knowledge base, and supports data mining algorithms to learn and optimize mapping rules from historical data.
[0135] Attribute value conversion: The system converts the values of each key attribute of the original event into the values of the corresponding standard event attributes based on the attribute mapping relationship. Attribute value conversion may involve operations such as data type conversion, format normalization, and enumeration value mapping. For example, the date attribute of the original event is converted from the yyyy-MM-dd format to the UNIX timestamp format of the standard event. The rules for attribute value conversion can be statically configured or dynamically optimized through machine learning algorithms to adapt to changes in data formats.
[0136] After the above three steps, the original events are converted into structured and standardized event objects, which facilitate subsequent operations such as event matching, filtering, and aggregation analysis.
[0137] The standardized event configuration approach also supports the following extension steps:
[0138] Use the expert knowledge base to define standard event attributes and mapping relationships. The knowledge base predefines standard event attribute models and mapping templates for common business areas. System administrators can directly reuse or flexibly adjust them to quickly complete event standardization configuration.
[0139] Use data mining algorithms to learn and optimize event attribute mapping rules from historical event data. The system regularly analyzes historical event data, mines association rules and mapping patterns between attributes, automatically generates or adjusts attribute mapping relationships, and reduces manual configuration workload.
[0140] Use online machine learning algorithms to optimize the extraction, conversion, and mapping strategies of event attributes in real time. The system continuously monitors event data streams and uses incremental learning algorithms to dynamically update event attribute processing models to adapt to changes in data distribution and improve the accuracy and real-time performance of event standardization.
[0141] The event queue optimization queuing algorithm includes the following steps:
[0142] Feature extraction: The system extracts priority and consumer feature vectors from the input standard events. Priority is a predefined enumeration value or numerical value that indicates the importance of the event; the consumer feature vector represents the characteristics of the expected consumer of the event, such as department, role, business scenario, etc., and is usually represented in the form of a high-dimensional sparse vector.
[0143] Priority sorting, the system sorts events in descending order according to their priority, with high-priority events placed at the front of the queue. This can be achieved using a comparison-based sorting algorithm (such as quick sort) or a bucket-based sorting algorithm (such as counting sort).
[0144] Grouping of events with the same priority: the system divides events with the same priority into a group. Events within the group have the same priority, and events between different groups are arranged in descending order. This step can be achieved by using a grouping algorithm (such as hash grouping) based on priority sorting.
[0145] Consumer feature matching: The system calculates the similarity between the consumer feature vector of each event and the feature vector of the potential consumer (i.e., process instance node) as the consumer feature matching degree of the event. The similarity calculation can use methods such as vector space models (such as cosine similarity) and probability models (such as Bayesian inference).
[0146] In-group sorting: In each priority group, the system sorts events in descending order according to the matching degree of the event consumer characteristics. Events with high matching degree are placed at the front of the group. This can be achieved using a sorting algorithm similar to priority sorting.
[0147] When the event queue is generated, the system will splice the sorted priority groups in order to form an optimized event queue. In the spliced queue, high-priority events are always placed before low-priority events, and events of the same priority are sorted from high to low according to the degree of matching of consumer features.
[0148] The event queue optimization queuing algorithm also includes the following expansion steps:
[0149] Set the expiration time of the event. The system sets an expiration timestamp for each event and scans the event queue regularly to remove events whose waiting time exceeds the preset expiration threshold (such as 30 minutes) from the queue to avoid event backlog.
[0150] Queue sharding management: The system divides the event queue into multiple sub-queues for different consumers according to their characteristics and load conditions. Each sub-queue only stores events related to a specific consumer, achieving parallel distribution and processing of events and improving system throughput. Sub-queues can be sharded using algorithms such as consistent hashing.
[0151] The complex event condition judgment algorithm includes the following steps:
[0152] Event attribute extraction, the system extracts attribute vectors and weights from the input standard events. The attribute vector represents the characteristics of the event, and the weight represents the importance of each attribute to the condition judgment, which can be manually configured or automatically learned.
[0153] Condition initialization: The system initializes the satisfaction of each execution condition of the node to 0. The satisfaction is a real value that indicates the degree of matching of the event to the condition, and the initial value is the minimum value 0.
[0154] For event matching, the system calculates the weighted similarity between the attribute vector of each input event and the attribute vector of the node condition as the matching degree of the event to the condition. The weighted similarity comprehensively considers the importance of each attribute and can be calculated using methods such as weighted Euclidean distance and weighted Jaccard coefficient.
[0155] Condition satisfaction update: the system updates the satisfaction of each condition to the maximum value of the matching degrees of all events that match it, ensuring that the satisfaction of the condition reflects the matching degree of the most relevant event.
[0156] Condition satisfaction judgment: the system compares the satisfaction of each condition with the preset threshold. If the satisfaction is greater than or equal to the threshold, the condition is considered satisfied; otherwise, the condition is considered unsatisfied. The threshold can be configured separately for different conditions to control the tightness of the conditions.
[0157] Node execution decision, the system comprehensively judges the satisfaction of all conditions based on the Boolean expression of the node execution condition. If the result of the Boolean expression is true, the node execution is triggered; otherwise, the node is not executed and continues to wait for new events to update the condition status. The node execution condition supports Boolean operators such as AND, OR, and NOT, which can express complex logical relationships between multiple events.
[0158] The complex event condition judgment algorithm also supports the following extended steps for users to choose and apply as needed:
[0159] Use a variety of attribute similarity measurement functions to adapt to different types of event attributes. The system selects appropriate similarity measurement functions for different types of attributes, such as numeric, categorical, and textual attributes, such as Euclidean distance, Jaccard coefficient, TF-IDF cosine, etc., to improve the accuracy of event matching.
[0160] A machine learning algorithm is introduced to dynamically adjust the condition threshold. The system collects historical data of node execution, trains classification or regression models, and automatically optimizes the condition threshold to achieve a balance between accuracy and recall rate, thereby reducing misjudgments and missed judgments.
[0161] Supporting customized conditional combination logic, the system provides users with a visual conditional editor, allowing users to freely combine events and conditions, define personalized node execution control strategies, and meet flexible and changing business needs.
[0162] Standardized event configuration method, event queue optimization queuing algorithm and complex event condition judgment algorithm. By adopting intelligent technologies such as expert knowledge base, data mining, and machine learning, these algorithms are further optimized on the original basis, enhancing the adaptability, accuracy and efficiency of the workflow engine, enabling it to cope with complex and changing business scenarios and massive heterogeneous event flows, providing highly intelligent and reliable technical support for enterprise-level workflow management.
[0163] The third implementation method:
[0164] Figure 1-Figure 7 Shown.
[0165] The following steps are also included:
[0166] Process template design: business analysts sort out business processes, divide process nodes, clarify node execution conditions, use standardized event configuration methods to define standard events, design process templates, and publish them to the engine;
[0167] Event standardization and queue entry, standardized events are pushed to the conditional event queue, and the event distribution and consumption module uses the event queue optimization queuing algorithm to distribute events to process instances;
[0168] Node judgment and execution, the condition judgment module uses the complex event condition judgment algorithm to judge whether the node condition is met. If it is met, the node execution is triggered, the result is output and the process is driven forward. If it is not met, it continues to wait for the event;
[0169] The process is completed. When the terminal node is executed, it means the process is executed, the result is output, and the resources occupied by the instance are released.
[0170] Process monitoring and optimization: managers can understand process progress and efficiency through the process monitoring interface, analyze inefficient links, adjust process templates, modify event definitions, condition weights and other parameters, and optimize processes.
[0171] The following steps are involved:
[0172] Receive original events, extract event attributes, and convert original events into standard events according to preset standardization rules;
[0173] Standard events are queued according to priority and consumer characteristics, with high-priority events and events that are highly compatible with consumers being processed first;
[0174] Distribute standard events to corresponding process instance nodes and update the conditional status of the nodes;
[0175] Determine whether the node condition is met. If it is met, the node execution is triggered. If it is not met, wait for subsequent events.
[0176] Output node execution results to drive the process forward until the process is completed;
[0177] Monitor process execution efficiency, adjust process templates, event attribute mapping, condition weights and other parameters, and dynamically optimize the process.
[0178] Process template design: business analysts use the visual process designer provided by the system to sort out business processes, divide process nodes, and clarify the execution conditions of each node. Then, they use standardized event configuration methods to define standard events involved in the process, including event attributes, attribute mapping rules, condition weights, etc. Finally, the designed process template is published to the workflow engine for subsequent instantiation.
[0179] In the process of designing the process template, the process nodes are reasonably divided. Each node represents a relatively independent and complete business step or decision point. The sequence and dependency relationships between nodes are clarified. The in-degree and out-degree of the nodes are correctly configured. The events on which the node execution conditions depend are abstracted. The key attributes of the events are extracted. The condition weights are reasonably set. Existing process templates and standard event definitions are reused as much as possible to reduce repeated modeling work. The abnormal branches and compensation mechanisms of the process are fully considered to improve the robustness of the process.
[0180] Event standardization and queue entry: The original business events generated by each source system are pushed to the workflow engine in real time through predefined interfaces or adapters. The engine extracts event attributes and converts the original events into standard events based on preset standardization rules. The standardized events enter the conditional event queue and are optimized by the event distribution and consumption module using the event queue optimization queuing algorithm.
[0181] The core of event standardization is attribute extraction and conversion. The specific rules include extracting key attributes from event payloads based on regular expressions or parsers, converting attribute values into standardized enumeration values based on dictionary mapping or synonyms, converting attribute values into standardized data types based on data type conversion, and converting attribute values into standardized feature vectors based on feature engineering.
[0182] The core of the event queue optimization queuing algorithm is to dynamically adjust the queuing order of events according to the priority of the events and the characteristics of the consumers. Specific strategies include priority-based queuing to ensure that high-priority events are consumed first, queuing based on consumer feature matching to ensure that events that are highly relevant to the current node are consumed first, queuing based on event expiration time to ensure that long-waited events can be processed in time, and queuing based on queue sharding to ensure that events from different consumers can be processed in parallel.
[0183] Node judgment and execution, the event distribution and consumption module distributes the queued standard events to the corresponding nodes in the process instance. The node condition judgment module uses a complex event condition judgment algorithm to determine whether the execution conditions of the node are met. If so, the node execution is triggered, the execution result is output, and the process is driven to the next node according to the process definition; if not, the node continues to wait for subsequent events until the condition is met or the maximum waiting time is reached.
[0184] The core of the complex event condition judgment algorithm is to comprehensively evaluate the satisfaction of multiple conditions of a node. Specific strategies include weighted summation, multiplying the satisfaction of each condition by its weight, and then summing them to obtain the overall condition satisfaction of the node; logical combination, combining the satisfaction of each condition according to logical operation rules such as AND, OR, and NOT to obtain the final condition judgment result of the node; fuzzy reasoning, treating the satisfaction of each condition as the degree of membership, and calculating the executable degree of the node through fuzzy reasoning rules; machine learning, using historical node execution data as samples, training classification or regression models, and predicting the execution probability of the node.
[0185] The node execution process can be synchronous or asynchronous. Specific forms include: local method call, by registering the node processor in the engine, directly calling the local method corresponding to the node; remote service call, by configuring the service address corresponding to the node in the engine, using RPC or HTTP and other protocols to remotely call the node service; message queue driven, by configuring the message queue corresponding to the node in the engine, sending the node execution request to the queue, and listening to the execution results; manual task, by configuring the task form corresponding to the node in the engine, assigning the node execution request to the designated person, and waiting for the manual processing result.
[0186] The process is completed. When the process instance is executed to the end node and the end node is executed, the entire process instance is executed. The engine outputs the process execution results, including the output data, execution time, execution status, etc. of each node, and stores the results persistently in the database or file system. At the same time, the engine releases the memory, threads and other system resources occupied by the process instance for subsequent instances to use.
[0187] After the process is completed, the engine can also trigger subsequent business operations based on predefined rules, such as sending notification messages, such as sending process execution report emails to relevant personnel, updating business data, such as writing process execution results into the business database, calling external systems, such as calling the API interface of downstream systems, triggering subsequent business processes, and archiving process data, such as archiving process execution records into a historical database or data warehouse.
[0188] Process monitoring and optimization: managers can view and analyze the execution of processes in real time through the process monitoring interface provided by the workflow engine, including indicators such as progress, efficiency, and resource usage. For inefficient links or abnormal situations found, managers can dynamically optimize the process by adjusting process templates, modifying event definitions, and adjusting condition weights.
[0189] The process monitoring interface usually provides the following functions: process instance list, which displays all running or completed process instances, and supports filtering by process template, time range, execution status and other conditions; process execution statistics, which displays statistical indicators such as the number of process executions, average execution time, success rate, etc., and supports aggregation by dimensions such as time range and process template; process execution log, which displays detailed execution records of process instances, including the start time, end time, input and output data, exception information, etc. of each node, and supports query by node, time range and other conditions; process performance analysis, which displays the performance indicators of the entire process and each node, such as average waiting time, average execution time, resource utilization, etc., and supports comparison by dimensions such as time range and process template.
[0190] Process optimization measures include adjusting the process template, such as adding or deleting nodes, modifying node configuration, adjusting node order, etc., optimizing the structure of the process, modifying event definitions, such as adjusting event attributes, optimizing attribute mapping rules, updating condition weights, etc., optimizing the standardization effect of events, modifying node execution logic, such as optimizing the node processor algorithm, adjusting the node timeout period, adding a node retry mechanism, etc., optimizing the execution efficiency of the node, modifying the process instance strategy, such as adjusting the instance priority, increasing the instance parallelism, optimizing the instance caching mechanism, etc., optimizing the overall performance of the process.
[0191] After the above steps, the workflow engine can execute business processes efficiently, accurately and flexibly, and support real-time monitoring and dynamic optimization of processes, reducing the complexity of business process management and improving the operational efficiency of the enterprise.
[0192] This embodiment also provides an event processing method for the entire life cycle of a process, the method comprising the following steps:
[0193] Receive original events. The system receives original business events from various source systems through predefined event interfaces or adapters, such as order creation events, payment completion events, etc.
[0194] Event standardization, the system extracts event attributes according to preset standardization rules and converts original events into standard events. Standardization rules include attribute extraction rules and attribute conversion rules, which are used to extract key attributes from event payloads and convert attribute values into standard formats.
[0195] Event queuing: The system queues standardized events according to priority and consumer characteristics, giving priority to high-priority events and events that are highly matched with the current node. The queuing algorithm comprehensively considers multiple attributes of the event and the context information of the process instance, and dynamically adjusts the processing order of the event.
[0196] Event distribution: the system distributes queued events to the corresponding nodes in the process instance and updates the conditional status of the nodes. Event distribution methods can be direct delivery, subscription publishing, request response, etc., depending on the configuration and implementation of the node.
[0197] Node execution: The node determines whether the execution condition is met based on the condition status after the event update. If it is met, the node execution is triggered, the predefined processor or service is called, and the execution result is output; if it is not met, it continues to wait for subsequent events until the condition is met or timed out.
[0198] Process driven, the system drives the process to continue to advance according to the execution results of the nodes and the node dependencies in the process definition until the entire process is completed. The process driven process will continuously repeat event queuing, event distribution and node execution until the end node is executed.
[0199] Efficiency monitoring: The system continuously monitors the execution efficiency of the process, including overall execution time, waiting time and execution time of each node, resource utilization and other indicators. The monitoring results can be displayed in real time on the process monitoring interface and used for process optimization decisions.
[0200] Parameter optimization: managers or optimization algorithms dynamically adjust process templates, event attribute mapping, condition weights and other parameters according to the execution efficiency and quality of the process to continuously optimize the performance of the process. The optimization process can be done through manual intervention, rule engines, machine learning, etc., and the adaptability and efficiency of the process are continuously improved through closed-loop feedback.
[0201] The above steps constitute a complete and continuously optimized event-driven process processing closed loop. By integrating events throughout the entire life cycle of the process, real-time synchronization and dynamic interaction between process execution and business events are achieved, which improves the automation and intelligence level of process management and provides a solid technical foundation for the digital transformation of enterprise business processes.
[0202] In view of current practical needs, the above-mentioned implementation mode adopted in this application is not limited to the scope of protection. Various changes made within the knowledge scope of technical personnel in this field without departing from the concept of this application still fall within the scope of protection of the present invention.
Claims
1. A workflow engine algorithm based on event triggering, including a workflow engine and multiple business systems, characterized in that: The workflow engine includes a workflow engine interface, a conditional event queue, a conditional event distribution and consumption module, a conditional event configuration module, a conditional judgment module and a process template; The following steps are also included: S1. Standardized event configuration: converting the original event into a standard event through a standardized event configuration method, wherein the standard event includes priority and consumer feature information; S2, event queue optimization queuing, the conditional event queue receives and stores standard events, and uses the event queue optimization queuing algorithm to optimize the queue of standard events according to their priority and consumer feature information; S3, process instance generation, generating a process instance according to the process template and input parameters obtained from the workflow engine interface; S4, event distribution and node judgment, the conditional event distribution consumption module consumes standard events from the conditional event queue and distributes them to the process instance, and the conditional judgment module uses the complex event condition judgment algorithm to determine whether to trigger the node execution according to the event condition; The complex event condition judgment algorithm includes: Event attribute extraction, extracting attribute vectors and weights of standard events; Conditional initialization, the satisfaction degree of each condition of the initialization node is 0; Event matching, calculate the weighted similarity between each standard event attribute vector and the condition attribute vector as the matching degree between the event and the condition; Condition satisfaction update: update the satisfaction of each condition to the maximum matching degree of all events matching it; Condition satisfaction judgment, comparing the satisfaction of each condition with its threshold to determine whether the condition is met; Node execution decision, based on the Boolean expression of the node execution condition and the satisfaction of each condition, decides whether to trigger the node execution; the node execution condition is composed of a logical combination of standard events; S5, process completion and monitoring optimization. The end node execution completion represents the process execution completion. The process monitoring interface displays the process progress and efficiency for optimizing process templates and parameters. The original events include events generated within the system and events generated by tasks and subtasks of the external business system.
2. The event-triggered workflow engine algorithm according to claim 1, characterized in that: The standardized event configuration method comprises: Key attribute identification: identifying the most critical attribute subset for event judgment and processing from the original event attribute set; Attribute mapping, establishing the mapping relationship between key attributes and standard event attributes; Attribute value conversion: convert the values of each key attribute of the original event into the values of the corresponding standard event attributes.
3. The event-triggered workflow engine algorithm according to claim 1, characterized in that: The event queue optimization queuing algorithm includes: Feature extraction, extracting event priority and consumer feature vectors; Priority sorting, sorting events in descending order according to their priority; Grouping of events with the same priority: events with the same priority are divided into one group. Events within the group have the same priority, and events between groups have decreasing priorities. Consumer feature matching: calculate the similarity between each event and the consumer feature vector as the consumer feature matching degree of the event; In-group sorting: In each event group, events are sorted in descending order according to the matching degree of the event consumer characteristics; Event queue generation: The sorted event groups are spliced from high to low priority to form an optimized event queue.
4. The event-triggered workflow engine algorithm according to claim 1, characterized in that: The following steps are also included: Process template design: business analysts sort out business processes, divide process nodes, clarify node execution conditions, use standardized event configuration methods to define standard events, design process templates, and publish them to the engine; Event standardization and queue entry, standardized events are pushed to the conditional event queue, and the event distribution and consumption module uses the event queue optimization queuing algorithm to distribute events to process instances; Node judgment and execution, the condition judgment module uses the complex event condition judgment algorithm to judge whether the node condition is met. If it is met, the node execution is triggered, the result is output and the process is driven forward. If it is not met, it continues to wait for the event; The process is completed. When the terminal node is executed, it means the process is executed, the result is output, and the resources occupied by the instance are released. Process monitoring and optimization: managers can understand process progress and efficiency through the process monitoring interface, analyze inefficient links, adjust process templates, modify event definitions and condition weight parameters, and optimize processes.
5. The event-triggered workflow engine algorithm according to claim 1, characterized in that: The event queue optimization queuing algorithm also includes: Set the expiration time of the event to determine whether the waiting time of the event in the queue exceeds the preset expiration threshold. If it exceeds, the event will be removed from the queue; Queue sharding management divides the event queue into multiple sub-queues for different consumers according to their characteristics and load conditions, thus achieving parallel distribution and processing of events.
6. The event-triggered workflow engine algorithm according to claim 1, characterized in that: The standardized event configuration method also supports: Use expert knowledge base to define standard event attributes and mapping relationships; Use data mining algorithms to learn and optimize event attribute mapping rules from historical event data; Use online machine learning algorithms to optimize event attribute extraction, conversion, and mapping strategies in real time to improve the adaptability and accuracy of event standardization.
7. The event-triggered workflow engine algorithm according to claim 1, characterized in that: The complex event condition judgment algorithm also supports selecting one or more of the following steps as needed: Use multiple attribute similarity measurement functions to adapt to different types of event attributes; Introducing machine learning algorithms to dynamically adjust condition thresholds and improve flexibility in judgment; Supports customized conditional combination logic to meet personalized node execution control requirements.
8. The event-triggered workflow engine algorithm according to any one of claims 1 to 7, characterized in that: The following steps are involved: Receive original events, extract event attributes, and convert original events into standard events according to preset standardization rules; Standard events are queued according to priority and consumer characteristics, with high-priority events and events that are highly compatible with consumers being processed first; Distribute standard events to corresponding process instance nodes and update the conditional status of the nodes; Determine whether the node condition is met. If it is met, the node execution is triggered. If it is not met, wait for subsequent events. Output node execution results to drive the process forward until the process is completed; Monitor process execution efficiency, adjust process templates, event attribute mapping, condition weight parameters, and dynamically optimize processes.
