Data processing method and device based on rule engine and electronic equipment

By generating a candidate rule script set with data flow indication information and analyzing the target rule object set, the existing rule engine's inefficiency and complex configuration during data processing is solved, real-time rule determination and efficient processing of high-speed data flow are realized .

CN119046329APending Publication Date: 2024-11-29BEIJING JINGDONG YUANSHENG TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411237721.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-04
Publication Date
2024-11-29

AI Technical Summary

Technical Problem

The existing rule engines are inefficient in data processing and insufficient throughput, which cannot meet the real-time rule determination requirements under high-speed data flows. The rule configuration is complex and the threshold is high.

Method used

By generating a candidate rule script set, each script has data flow indication information, determines the target rule script set based on the indicator information of the target data flow, and parses it to process the target data flow, real-time rule determination is realized.

Benefits of technology

It reduces the workload of rule configuration and changes, improves operational efficiency, and can process high-speed data flows in real time, meeting the processing needs of massive real-time data flows.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119046329A_ABST
    Figure CN119046329A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, in particular to a data processing method and device based on a rule engine, a computer program product and electronic equipment. The data processing method based on the rule engine comprises the steps that configuration operation on rule configuration items is responded, a candidate rule script set is generated, and each candidate rule script in the candidate rule script set has corresponding data flow indication information; determining a target rule script set from the candidate rule script set according to data stream indication information of the target data stream, and analyzing candidate rule scripts in the target rule script set to determine a target rule object set according to an analysis result; and processing the target data stream based on the target rule object set. The data processing efficiency based on the rule engine can be improved, and the operation threshold is lowered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and more specifically, to a data processing method based on a rule engine, a data processing device based on a rule engine, a computer program product, and an electronic device. Background Art

[0002] With the development of computer technology, rule engine technology has emerged. The rule engine is developed from the reasoning engine. It is a component embedded in the application, which separates business decisions from the application code and uses predefined semantic modules to write business decisions. It accepts data input, interprets business rules, and makes business decisions based on business rules. Rule engines are widely used in Internet products, especially on operation management platforms, such as configuring real-time risk control management solutions, tag mining rules, commodity discount solutions, product rating rules, etc.

[0003] At present, most rule engines are generally built using existing rule engine frameworks or tools. Usually, it is necessary to write complex rule files or use special rule editing tools to configure rules. The rule configuration is complex and has a high threshold for use. In addition, the existing rule engines have low efficiency and insufficient throughput when processing data, and cannot meet the real-time rule judgment requirements under high-speed data streams.

[0004] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0005] The purpose of the present disclosure is to provide a data processing method and device based on a rule engine, a computer program product and an electronic device, thereby improving the data processing efficiency based on the rule engine at least to a certain extent and lowering the operation threshold.

[0006] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.

[0007] According to one aspect of the present disclosure, a data processing method based on a rule engine is provided, comprising: generating a candidate rule script set in response to a configuration operation on a rule configuration item, each candidate rule script in the candidate rule script set having corresponding data flow indication information; determining a target rule script set from the candidate rule script set according to the data flow indication information of the target data flow, and parsing the candidate rule scripts in the target rule script set to determine a target rule object set according to the parsing results; and processing the target data flow based on the target rule object set.

[0008] In an exemplary embodiment of the present disclosure, the response to the configuration operation on the rule configuration item generates a candidate rule script set, including: in response to the configuration operation on the first configuration item, obtaining data flow metadata information, and determining the data flow indication information corresponding to the data flow metadata information; in response to the configuration operation on the second configuration item based on the data flow indication information corresponding to the data flow metadata information, generating a candidate rule script, so that the candidate rule script is associated with the data flow metadata information through the data flow indication information corresponding to the data flow metadata information; and determining the candidate rule script set based on all the obtained candidate rule scripts.

[0009] In an exemplary embodiment of the present disclosure, the response to the configuration operation on the second configuration item based on the data flow indication information corresponding to the data flow metadata information generates a candidate rule script, including: in response to the configuration operation on the second configuration item based on the data flow indication information corresponding to the data flow metadata information, obtaining the hierarchical relationship between the configured unit items and the unit items; generating a logical operation expression according to the hierarchical relationship between the unit items and the unit items; and generating the candidate rule script based on the logical operation expression.

[0010] In an exemplary embodiment of the present disclosure, associating the candidate rule script with the data flow metadata information through the data flow indication information corresponding to the data flow metadata information includes: adding the data flow indication information corresponding to the data flow metadata information in the candidate rule script.

[0011] In an exemplary embodiment of the present disclosure, the response to the configuration operation of the rule configuration item generates a candidate rule script set, and also includes: determining the correspondence between the data flow indication information and the candidate rule script according to each of the candidate rule scripts and the data flow indication information corresponding to the candidate rule script; determining the target rule script set from the candidate rule script set according to the data flow indication information of the target data flow includes: based on the correspondence between the data flow indication information and the candidate rule script, obtaining the target rule script set corresponding to the data flow indication information of the target data flow from the candidate rule script set.

[0012] In an exemplary embodiment of the present disclosure, parsing the candidate rule scripts in the target rule script set to determine the target rule object set according to the parsing results includes: parsing the candidate rule scripts in the target rule script set to obtain the target rule object set; and caching the target rule objects in the target rule object set.

[0013] In an exemplary embodiment of the present disclosure, the method includes multiple parallel sub-tasks, and the target data flow is distributed among the sub-tasks; the processing of the target data flow based on the target rule object set includes: each of the sub-tasks separately calls the cached target rule object set to process the allocated target data flow to obtain the corresponding data processing results.

[0014] In an exemplary embodiment of the present disclosure, the method also includes: monitoring the candidate rule script set; responding to an update operation in the candidate rule script set, updating the correspondence between the data flow indication information and the candidate rule script according to the update rule script corresponding to the update operation; parsing the update rule script to obtain a target rule object corresponding to the update rule script, and updating the cached target rule object set based on the target rule object corresponding to the update rule script.

[0015] In an exemplary embodiment of the present disclosure, the processing of the target data stream based on the target rule object set includes: performing rule matching on the target data stream with each target rule object in the target rule object set; and in response to the target data stream matching at least one of the target rule objects, triggering a target event corresponding to the at least one target rule object.

[0016] According to one aspect of the present disclosure, there is provided a data processing device based on a rule engine, comprising: a first management module, for generating a candidate rule script set in response to a configuration operation on a rule configuration item, each candidate rule script in the candidate rule script set having corresponding data flow indication information; a second management module, for determining a target rule script set from the candidate rule script set according to the data flow indication information of the target data flow, and parsing the candidate rule scripts in the target rule script set to determine a target rule object set according to the parsing result; and a rule execution module, for processing the target data flow based on the target rule object set.

[0017] According to one aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, any one of the methods described above is implemented.

[0018] According to one aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned methods by executing the executable instructions.

[0019] The data processing method based on the rule engine in the exemplary embodiment of the present disclosure, on the one hand, can directly respond to the configuration operation of the rule configuration item to generate a candidate rule script set, and the user only needs to configure the configuration item to obtain the candidate rule script set, which reduces the workload of configuring and changing the rules and lowers the operation threshold. On the other hand, since each candidate rule script in the candidate rule script set has corresponding data flow indication information, after accessing the target data flow, the required target rule script set can be obtained from the candidate rule script according to the data flow indication information of the target data flow, and the target rule script set is parsed to obtain the target rule object set, so as to process the target data flow based on the target rule object set. In this process, according to the real-time target data flow, the target rule object set required for processing the target data flow can be obtained in real time and in a targeted manner, which can realize the real-time rule determination requirements under high-speed data flow and improve the processing efficiency of massive real-time data flow.

[0020] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the following detailed description with reference to the accompanying drawings, in which several embodiments of the present disclosure are shown in an exemplary and non-limiting manner.

[0022] Figure 1 An application environment according to an exemplary embodiment of the present disclosure is shown.

[0023] Figure 2 A flow chart of a data processing method based on a rule engine according to an exemplary embodiment of the present disclosure is shown.

[0024] Figure 3 A flowchart of an implementation method for generating a candidate rule script set according to an exemplary embodiment of the present disclosure is shown.

[0025] Figure 4 A schematic diagram of a configuration form interaction interface for performing a configuration operation on a first configuration item according to an exemplary embodiment of the present disclosure is shown.

[0026] Figure 5 A schematic diagram of a configuration form interaction interface for performing a configuration operation on a second configuration item according to an exemplary embodiment of the present disclosure is shown.

[0027] Figure 6 A flowchart of an implementation method for generating candidate rule scripts according to an exemplary embodiment of the present disclosure is shown.

[0028] Figure 7A flowchart of an implementation method of a cache target rule object set according to an exemplary embodiment of the present disclosure is shown.

[0029] Figure 8 A flow chart showing a method for implementing rule updating according to an exemplary embodiment of the present disclosure is shown.

[0030] Fig. 9 A complete flow chart of a data processing method based on a rule engine according to an exemplary embodiment of the present disclosure is shown.

[0031] Fig.10 A schematic diagram of a rule matching process according to an exemplary embodiment of the present disclosure is shown.

[0032] Fig.11 A schematic diagram of the composition of a data processing device based on a rule engine according to an exemplary embodiment of the present disclosure is shown.

[0033] Fig.12 A block diagram of an electronic device according to an exemplary embodiment of the present disclosure is shown.

[0034] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts. DETAILED DESCRIPTION

[0035] The exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the present disclosure will be more comprehensive and complete and the concepts of the exemplary embodiments will be fully conveyed to those skilled in the art. The same reference numerals in the figures represent the same or similar structures, and thus their detailed description will be omitted.

[0036] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known structures, methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.

[0037] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or these functional entities or parts of functional entities may be implemented in one or more software hardened modules, or these functional entities may be implemented in different networks and / or processor devices and / or microcontroller devices.

[0038] The data processing method based on the rule engine provided by the exemplary embodiment of the present disclosure can be applied to Figure 1 In the application environment shown, the terminal 101 communicates with the server 102 via a network. The data storage system can store data that the server 102 needs to process. The data storage system can be integrated on the server 102, or placed on the cloud or other network servers.

[0039] In an exemplary embodiment, the data processing method based on the rule engine provided by the exemplary embodiment of the present disclosure may be executed by the server 102, and the corresponding data processing device based on the rule engine is arranged in the server 102. Correspondingly, in this mode of execution by the server 102, the server 102 may start to execute the steps in the technical solution of the exemplary embodiment of the present disclosure in response to a trigger command, wherein the trigger command may be sent by a terminal used by a user, or may be triggered locally by the server in response to some automation events.

[0040] The server 102 can generate a candidate rule script set in response to a configuration operation on a rule configuration item, each candidate rule script in the candidate rule script set having corresponding data flow indication information; then determine a target rule script set from the candidate rule script set according to the data flow indication information of the target data flow, and parse the candidate rule scripts in the target rule script set to determine a target rule object set according to the parsing results; finally, process the target data flow based on the target rule object set.

[0041] The server 102 may be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server 102 may perform background tasks.

[0042] Furthermore, in another exemplary embodiment, the terminal 101 may also have similar functions to the server 102 , so as to execute the data processing method based on the rule engine provided by the exemplary embodiment of the present disclosure.

[0043] The terminal 101 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, an IoT device, and a portable wearable device. The IoT device may be a smart speaker, a smart TV, a smart air conditioner, and a smart vehicle-mounted device, etc. The portable wearable device may be a smart watch, a smart bracelet, a head-mounted device, etc. The terminal 101 may also be referred to as a mobile terminal, a terminal device, a mobile device, etc. The exemplary embodiments of the present disclosure do not limit the type of the terminal 101.

[0044] In addition, the technical solution of the exemplary embodiment of the present disclosure can also be executed collaboratively by the terminal 101 and the server 102. In this mode of collaborative execution by the terminal 101 and the server 102, some steps in the technical solution provided by the exemplary embodiment of the present disclosure are executed by the terminal 101, while other steps are executed by the server 102. For example, the server 102 generates a candidate rule script set in response to a configuration operation on a rule configuration item, determines a target rule script set from the candidate rule script set according to the data flow indication information of the target data flow, and parses the candidate rule scripts in the target rule script set to determine a target rule object set according to the parsing result, and the terminal 101 processes the target data flow based on the target rule object set.

[0045] It should be noted that in this mode of collaborative execution by the terminal 101 and the server 102, the steps respectively executed by the terminal 101 and the server 102 can be dynamically adjusted according to actual conditions, and there is no special restriction on this.

[0046] The terminal 101 and the server 102 may be connected directly or indirectly via wireless communication, and the exemplary embodiments of the present disclosure do not impose any special limitation thereto.

[0047] The rule engine is used to separate business rules from applications, providing a flexible way to define, manage, and execute these business rules, thereby improving business flexibility and efficiency.

[0048] Most current rule engines are implemented using existing rule engine frameworks or tools. These engine tools usually require the configuration of rules by writing complex rule files or using specialized rule editing tools. It is very difficult for non-technical personnel to configure or modify rules. At the same time, current rule engines are highly coupled with business systems, and have low processing efficiency for massive real-time data streams, insufficient throughput, and poor scalability, and cannot meet the real-time rule determination requirements under high-speed data streams.

[0049] In an exemplary embodiment of the present disclosure, in order to solve one or more of the above problems, a data processing method based on a rule engine is provided. The method can be run on a server or a terminal. Figure 1 The server 102 in FIG. 1 is used as an example for explanation.

[0050] refer to Figure 2 FIG. 1 is a flow chart of a data processing method based on a rule engine according to an exemplary embodiment of the present disclosure. Figure 2 As shown, the data processing method based on the rule engine includes steps S210 to S230, which are specifically as follows:

[0051] In step S210, in response to the configuration operation on the rule configuration item, a candidate rule script set is generated, and each candidate rule script in the candidate rule script set has corresponding data flow indication information.

[0052] In the exemplary embodiments of the present disclosure, a rule configuration item refers to a configuration item in the rule configuration interactive interface for performing rule configuration. The rule configuration item may be a selection item or an input item, and there is no limitation on this. For example, in response to a trigger operation on a selection item, multiple options corresponding to the selection item are provided for the user to select. For another example, in response to a trigger operation on an input item, the input item is rendered editable, and the user may enter relevant configuration information in the input item.

[0053] Among them, the rule configuration items may also include configuration items for configuring the hierarchical relationship between various configuration items, such as the rule configuration items include logical operators such as "and", "or", "not" or nested relationships between logical operators, such as the various configuration items connected by logical operators support operators such as "greater than", "greater than or equal to", "less than", "less than or equal to", "not equal to", "in", "notin", etc. Users can select logical operators from the rule configuration items according to their needs to establish a hierarchical relationship between different configuration items.

[0054] The candidate rule script set is a collection of candidate rule scripts. The candidate rule script is a script file used to perform rule matching processing on the data stream, which describes the rule content for processing the data stream. Among them, the candidate rule script can be a script file that conforms to the programming syntax, such as a script file that conforms to the Groovy syntax, a script file that conforms to the Aviator syntax, etc. Among them, Groovy is a dynamic programming language based on the Java platform, which has the ability to dynamically parse scripts or expressions. Aviator is also a lightweight dynamic language based on the Java platform. The corresponding programming language can be selected according to the needs. The exemplary embodiments of the present disclosure include but are not limited to the above-mentioned programming languages.

[0055] The data flow indication information is the unique identification information of the data flow (it can also be the data flow metadata information). Each candidate rule script has at least one corresponding data flow indication information. That is to say, a candidate rule script can be effective for at least one data flow. Of course, there can be multiple effective candidate rule scripts corresponding to a data flow. The exemplary embodiment of the present disclosure can determine that the data flow indication information corresponding to the candidate rule script is one or more according to actual needs, and there is no limitation on this.

[0056] It should be understood that when multiple data streams are accessed simultaneously, each candidate rule script only performs rule judgment processing on the corresponding data stream.

[0057] The user can perform configuration operations on the rule configuration items according to the requirements, and then generate a candidate rule script set in response to the configuration operation. Among them, one candidate rule script can be generated each time according to the configuration operation, and the candidate rule script set is determined according to the candidate rule scripts obtained by multiple configuration operations. Alternatively, multiple candidate rule scripts can be generated at one time according to the configuration operation to obtain a candidate rule script set, which can be flexibly selected according to the actual configuration requirements, and there is no restriction on this.

[0058] In step S220, a target rule script set is determined from the candidate rule script set according to the data flow indication information of the target data flow, and the candidate rule scripts in the target rule script set are parsed to determine a target rule object set according to the parsing result.

[0059] In an exemplary embodiment of the present disclosure, the target data stream refers to the data stream that currently needs to be processed by rule matching. The target data stream may be one or more. Usually, in a high concurrency scenario, the amount of data in the target data stream may be very large, such as order information, transportation data, logistics tracking data, etc.

[0060] The data flow indication information of the target data flow is the indication information carried by the data flow to be processed currently, and is used to uniquely identify the target data flow. Since each candidate rule script in the candidate rule script set has corresponding data flow indication information, through the matching process of the data flow indication information, the target rule script that matches the data flow indication information can be determined from the candidate rule script set to form a target rule script set, thereby filtering out unnecessary candidate rule scripts and reducing the service resources consumed in subsequent processing.

[0061] The target rule object obtained by parsing the candidate rule script is used to perform rule matching on events in the data stream. It can be understood that the target rule object is a rule matching template, and the rule matching on the data stream is performed by calling the rule matching template.

[0062] The candidate rule scripts in the target rule script set can be dynamically parsed by the class loader to obtain the corresponding target rule object set for subsequent calling when processing the data stream. The exemplary embodiment of the present disclosure does not impose specific restrictions on the parsing method of the candidate rule scripts, and any method that can implement script parsing can be adapted.

[0063] In step S230, the target data flow is processed based on the target rule object set.

[0064] In an exemplary embodiment of the present disclosure, rule matching processing may be performed on the target data flow according to the target rule object in the target rule object set to obtain a processing result.

[0065] The rule matching process is to use the target rule object to match the events in the target data flow to determine whether the target data flow hits at least one target rule object, so as to make business decisions based on the hit target rule object.

[0066] The data processing method based on the rule engine in the exemplary embodiment of the present disclosure, on the one hand, can directly respond to the configuration operation of the rule configuration item to generate a candidate rule script set, and the user only needs to configure the configuration item to obtain the candidate rule script set, which reduces the workload of configuring and changing the rules and lowers the operation threshold. On the other hand, since each candidate rule script in the candidate rule script set has corresponding data flow indication information, after accessing the target data flow, the required target rule script set can be obtained from the candidate rule script according to the data flow indication information of the target data flow, and the target rule script set is parsed to obtain the target rule object set, so as to process the target data flow based on the target rule object set. In this process, according to the real-time target data flow, the target rule object set required for processing the target data flow can be obtained in real time and in a targeted manner, which can realize the real-time rule determination requirements under high-speed data flow and improve the processing efficiency of massive real-time data flow.

[0067] In an exemplary embodiment, a method for generating a candidate rule script set is provided. Figure 3 As shown, in response to the configuration operation of the rule configuration item, generating a candidate rule script set may include:

[0068] Step S310: In response to the configuration operation on the first configuration item, data flow metadata information is obtained, and data flow indication information corresponding to the data flow metadata information is determined.

[0069] The first configuration item is a configuration item in the rule configuration interactive interface for configuring data flow information. The first configuration item can be a selection item, an input item, or a configuration form, without limitation. Configuring data flow information may include, but is not limited to, data flow indication information configuration, field configuration, etc., wherein field configuration includes, but is not limited to, field encoding configuration, field name configuration, field type (such as INT, LONG, DOUBLE, STRING, BOOLEAN, etc.) configuration, etc. The exemplary embodiment of the present disclosure can flexibly adjust the configuration items of the first configuration item according to actual needs, without limitation.

[0070] The configuration operation process of the rule configuration item can be performed in response to a human configuration operation. In other words, the configuration operation of the rule configuration item is implemented based on human operation and can be configured according to different rule requirements. Specifically, in response to the configuration operation of the first configuration item, data flow metadata information can be obtained, and data flow indication information corresponding to the data flow metadata information can be determined.

[0071] As an example, Figure 4 A configuration form interactive interface for performing configuration operations on a first configuration item is shown, which can be used, for example, Figure 4 The configuration operation of the first configuration item is implemented through the interactive interface. It should be noted that all adjustable or configurable parameters can be configured in the interactive interface and can be viewed and modified by means of a slider. Figure 4 The possible configurations of the interactive interface are only illustrated for exemplary purposes, and the present disclosure does not limit this.

[0072] It should be understood that each data flow connected to the real-time rule engine can be understood as a real-time data model, and then through the configuration operation of the first configuration item, that is, the metadata configuration of the real-time data model, the data flow metadata information of the data flow can be obtained through the configuration operation of the first configuration item.

[0073] The data stream metadata information is acquired through the configuration operation of the first configuration item, and the data stream indication information corresponding to the data stream metadata information is determined from the data stream metadata information.

[0074] Step S320: In response to the configuration operation on the second configuration item based on the data flow indication information corresponding to the data flow metadata information, a candidate rule script is generated, and the candidate rule script is associated with the data flow metadata information through the data flow indication information corresponding to the data flow metadata information.

[0075] After configuring the data flow metadata information, the second configuration item can be configured based on the data flow metadata information. The second configuration item is a configuration item in the rule configuration interaction interface, which is used to configure the rule content. The second configuration item can be a selection item, an input item, or a configuration form, and there is no restriction on this. The candidate rule script is associated with the data flow metadata information through the data flow indication information corresponding to the data flow metadata information. It can be understood that a corresponding relationship is formed between the data flow metadata and the candidate rule script based on the data flow indication information, that is, each candidate rule script has corresponding data flow indication information. Among them, the configuration operation of the second configuration item includes at least rule name configuration, rule content configuration, etc., and there is no restriction on this.

[0076] Similarly, the configuration operation process of the second configuration item can also be performed in response to a human configuration operation. In other words, the configuration operation of the second configuration item is implemented based on human operation and can be configured according to different rule requirements. Specifically, a candidate rule script can be generated in response to the configuration operation of the second configuration item based on the data flow indication information corresponding to the data flow metadata information, so that the candidate rule script is associated with the data flow metadata information through the data flow indication information corresponding to the data flow metadata information.

[0077] As an example, Figure 5 A configuration form interactive interface for performing configuration operations on the second configuration item is shown, which can be used, for example, Figure 5 The configuration operation of the second configuration item is implemented through the interactive interface. Among them, the configuration content of the second configuration item includes not only configuration items, but also logical operators such as "and", "or", "not" or nested relationships between logical operators. For example, each configuration item connected by a logical operator supports operators such as "greater than", "greater than or equal to", "less than", "less than or equal to", "not equal to", "in", "not in", etc. Of course, the configuration content of the second configuration item can also be expanded according to configuration requirements, and there is no specific restriction on this.

[0078] It should be noted that all adjustable or configurable parameters can be configured in the interactive interface and viewed and modified by means of a slider. Figure 5 The possible configurations of the interactive interface are only illustrated for exemplary purposes, and the present disclosure does not limit this.

[0079] In an exemplary embodiment, associating the candidate rule script with the data flow metadata information through the data flow indication information corresponding to the data flow metadata information includes: adding the data flow indication information corresponding to the data flow metadata information to the candidate rule script.

[0080] Among them, during the configuration operation of the second configuration item, the configuration content may include but is not limited to the rule content, the data flow indication information corresponding to the data flow metadata information, whether to enable the function item, etc. The rule content is used to describe the specific logic of the rule batch; the candidate rule script is associated with the data flow metadata information through the data flow indication information corresponding to the data flow metadata information, that is, it is used to distinguish which real-time data model the candidate rule script is effective for; whether to enable the function item configures whether the candidate rule script is enabled to control whether the candidate rule script is effective.

[0081] It is worth understanding that the rules configured through the interactive interface are highly readable, and the rules can be packaged into a rule structured file and then passed to the rule manager for parsing to obtain candidate rule scripts that conform to the required syntax (eg, conform to Groovy syntax).

[0082] Among them, structured files specifically refer to files composed of structured data. Structured data generally refers to data that can be represented and stored using a relational database and can be logically expressed using a two-dimensional table. The general characteristics of structured data are: data is in rows, a row of data represents the information of an entity, and the attributes of each row of data are the same and stored in the database; it can be represented by data or a unified structure, such as numbers and symbols; it can be logically expressed using a two-dimensional table structure, including attributes and tuples, such as: a transcript is an attribute, and 90 points is its corresponding tuple. In an exemplary embodiment of the present disclosure, the format of rules can be unified through a rule structured file to facilitate subsequent rule parsing and processing.

[0083] As an example, the rule structured file can be implemented in the form of a JSON (JavaScript Object Notation) structure. The rule structured file can be parsed with the help of a class loader, etc. The exemplary embodiment of the present disclosure does not specifically limit the parsing process.

[0084] Step S330: Determine a candidate rule script set according to all obtained candidate rule scripts.

[0085] After obtaining the candidate rule scripts and the corresponding relationship between the candidate rule scripts and the data stream metadata information, a rule script set is constructed according to all the candidate rule scripts so as to be called when actually processing the data stream.

[0086] The exemplary embodiments of the present disclosure can implement the configuration of data flow information and rule content with the help of an interactive interface, and then generate candidate rule scripts in response to user configuration operations, thereby reducing the workload of rule configuration and change and lowering the operational threshold for configuring rules.

[0087] In an exemplary embodiment, after the candidate rule script set is obtained, it can also be saved in a database for persistence to facilitate the management and maintenance of the rules.

[0088] In an exemplary embodiment, a method for generating a candidate rule script is also provided. Figure 6 In response to a configuration operation on a second configuration item based on the data flow indication information corresponding to the data flow metadata information, generating a candidate rule script may include:

[0089] Step S610: In response to a configuration operation on a second configuration item based on the data flow indication information corresponding to the data flow metadata information, a hierarchical relationship between configured unit items and unit items is obtained.

[0090] Step S620: Generate a logical operation expression according to the hierarchical relationship between unit items.

[0091] Among them, unit items are also configuration items, and the hierarchical relationship between unit items refers to the combination of numbers, operators, number grouping symbols (brackets), free variables and bound variables in a meaningful arrangement method that can obtain numerical values. Among them, expressions refer to meaningful formulas that connect the same type of data (such as constants, variables, functions, etc.) with operation symbols according to certain rules. By combining different unit items based on logical operators, corresponding logical operation expressions can be generated, so as to realize the generation of corresponding rules through logical operation expressions.

[0092] Step S630: Generate a candidate rule script based on the logical operation expression.

[0093] The exemplary embodiment of the present disclosure can respond to the configuration operation of the second configuration item, obtain the hierarchical relationship between the unit items and the unit items to generate a logical operation expression. For the user, it is only necessary to use the interactive interface to complete the configuration of the logical expression according to business needs to complete the rule configuration, thereby realizing structured expressions of different complexity and making the rule configuration operation simple and easy to understand.

[0094] In an exemplary embodiment, generating a candidate rule script set in response to a configuration operation on a rule configuration item further includes: determining a correspondence between the data flow indication information and the candidate rule script according to each candidate rule script and the data flow indication information corresponding to the candidate rule script.

[0095] Specifically, the correspondence between the data flow indication information and the candidate rule scripts can be maintained in the memory, such as <data flow indication information, candidate rule script identification list>, which is used to describe the candidate rule script corresponding to each data flow indication information (ie, real-time data model).

[0096] Furthermore, according to the data flow indication information of the target data flow, determining the target rule script set from the candidate rule script set may include: based on the correspondence between the data flow indication information and the candidate rule scripts, obtaining the target rule script set corresponding to the data flow indication information of the target data flow from the candidate rule script set. That is, after a data flow is accessed, which candidate rule scripts need to be matched by the data flow can be directly determined according to the correspondence, thereby improving the efficiency and accuracy of rule matching for real-time data flows.

[0097] In an exemplary embodiment, a method for implementing a cache target rule object set is also provided. Figure 7 As shown, parsing the candidate rule scripts in the target rule script set to determine the target rule object set according to the parsing result may include:

[0098] Step S710: Parse the candidate rule scripts in the target rule script set to obtain a target rule object set.

[0099] When the target data stream needs to be processed, the target rule script set can be loaded into the rule engine, and then the target rule script in the target rule script set is parsed, such as dynamically parsed by a class loader, to obtain a target rule object set. For example, after the target rule script set is read into the engine, it is dynamically parsed by a class loader (such as a Groovy Class Loader) to parse the target rule script into a target rule object (such as a Groovy object), which can be used to perform rule matching on events in the target data stream.

[0100] Step S720: Cache the target rule objects in the target rule object set.

[0101] The target rule object can be cached in memory in the form of key-value storage, that is,<key,value> The key is the data flow indication information and the value is the target rule object (such as a Groovy object).

[0102] After obtaining the target rule object set, the target rule objects in the target rule object set can be cached to the content, so that when executing the data processing process, they can be directly called from the memory to provide timeliness of rule matching.

[0103] In an exemplary embodiment, the method of the exemplary embodiment of the present disclosure may include multiple parallel subtasks, and the target data flow is distributed among the subtasks to achieve load balancing and avoid data skew.

[0104] Furthermore, processing the target data flow according to the target rule object set may include: each subtask respectively calls the cached target rule object set to process the assigned target data flow to obtain respective corresponding data processing results.

[0105] As an example, multiple parallel subtasks can be multiple task managers (TaskManager) in Flink. Flink is an open source, distributed, high-performance, fault-tolerant stream processing framework that provides low-latency event-driven real-time computing capabilities. Therefore, caching the target rule objects in the target rule object set can be cached in the memory of each parallel subtask of the Flink job, which is called by the Flink operator to achieve parallel computing, and the degree of parallelism can be adjusted according to the amount of data, so that the rule engine has the characteristics of high throughput, low latency, and easy scalability.

[0106] After each task of each task manager receives the assigned target data stream, it can call the target rule object set cached in the memory to process the data, so as to realize parallel execution of tasks and improve data processing efficiency.

[0107] Of course, any stream processing framework that can provide parallel subtasks can be applied to the exemplary embodiments of the present disclosure, and no specific limitation is made to this.

[0108] In an exemplary embodiment, a method for implementing rule updating is also provided. Figure 8 , the exemplary embodiments of the present disclosure further include:

[0109] Step S810: monitoring the candidate rule script set.

[0110] By monitoring the candidate rule script set, the addition, modification or deletion of rules can be monitored in real time.

[0111] The monitoring of the candidate rule script set can be achieved by scanning the latest change time of the rule at a scheduled time, or by monitoring the log file. If a MySQL database is used, it can be achieved by monitoring the change log binlog. There is no special limitation on the monitoring method. For new or changed rules, reload them into the rule engine.

[0112] Step S820: In response to an update operation in the candidate rule script set, the corresponding relationship between the data flow indication information and the candidate rule script is updated according to the update rule script corresponding to the update operation.

[0113] There are updates in the candidate rule script set. In order to accurately process the real-time data stream that is connected later, the correspondence between the data stream indication information and the candidate rule script needs to be updated in a timely manner.

[0114] As an example, in memory<key,value> For example, the key is the data flow indication information, and the value is the Groovy object. If there is a rule change, the corresponding value can be reset through the data flow indication information. Of course, if there is a new rule, the corresponding content is directly added to the corresponding relationship. If there is a deletion rule, the corresponding content in the corresponding relationship can be deleted.

[0115] Step S830: Parse the update rule script to obtain the target rule object corresponding to the update rule script, and update the cached target rule object set based on the target rule object corresponding to the update rule script.

[0116] When there is an update in the candidate rule script set, in addition to adjusting the corresponding content in the correspondence, the cached target rule object needs to be updated so that when the target rule object is called according to the correspondence, the updated target rule object can be called in a timely and accurate manner.

[0117] By monitoring the candidate rule script set, the correspondence between the data flow indication information and the candidate rule script and the cached target rule object set are updated according to the monitoring results, so that accurate real-time rule judgment can be achieved when the real-time data flow connected is processed later, thereby improving the accuracy and timeliness of rule judgment.

[0118] In an exemplary embodiment, an implementation method for processing a target data stream is provided. Processing the target data stream based on a target rule object set may include:

[0119] The target data flow is matched against each target rule object in the target rule object set.

[0120] In response to the target data flow matching the at least one target rule object, a target event corresponding to the at least one target rule object is triggered.

[0121] Among them, the target event is an operation event corresponding to the target rule object and has corresponding operation logic. If the target data flow matches at least one target rule object, that is, the target data flow hits at least one target rule object, then the target event corresponding to at least one target rule object can be triggered to trigger other operations. For example, in real-time risk control business, the risk control business logic is directly triggered for the data that hits the risk control rule. Alternatively, the data processing results can be encapsulated and output so that subsequent business analysis or business logic can be performed based on the data processing results.

[0122] By matching the target data stream accessed in real time with the target rule object set parsed in real time, judgment can be made on massive data, thus improving the efficiency and timeliness of data processing.

[0123] In combination with specific application scenarios, the data processing method based on the rule engine of the exemplary embodiment of the present disclosure is described below by taking the workflow of the real-time rule engine for logistics risk control as an example, combined with the Flink framework and Groovy.

[0124] Fig. 9 The figure is a complete flow chart of a data processing method based on a rule engine, wherein a user interface is used to add or modify a candidate rule script set, including rule names, matching conditions, and processing logic, etc. The user interface can update the candidate rule script set in the database by interacting with the rule manager in the rule engine.

[0125] Among them, the real-time data access end is the event stream (data stream) that needs to be judged by real-time rules. It is carried by a message queue (such as JDQ, JMQ, etc.) and is responsible for connecting the data stream to the real-time rule engine, including order information, transportation data, logistics tracking data, etc. The rule manager is responsible for the configuration, update, loading and other management of rules. It responds to configuration operations on rule configuration items, parses them into candidate rule script sets and saves the candidate rule script sets to the database. It is also responsible for loading the target rule script set into the engine, parsing it into a target rule object set and caching it into the memory of each task manager Task Manager in the Flink cluster. The rule executor is mainly each Task Manager in the Flink cluster, which is responsible for real-time processing of each received data stream and performing rule judgment by calling the target rule object set in its cache. Specifically:

[0126] First, in response to the configuration operation of the rule configuration item, the configuration result is parsed into a Groovy script file through the rule manager, stored in the database, and a candidate rule script set is obtained.

[0127] Secondly, the rule executor performs load balancing on the incoming data stream, which can be achieved through Flink's rebalance operators to evenly distribute the data to each Task Manager.

[0128] Next, the rule manager determines a target rule script set from the candidate rule script set according to the data flow indication information of the target data flow.

[0129] Among them, Fig.10 A schematic diagram of a rule matching process is shown. After each Task of each Task Manager receives data, it first obtains its corresponding target rule script set from the <data flow indication information, candidate rule script identification list> cache through the data flow indication information of the data.

[0130] Furthermore, the rule manager parses the candidate rule scripts in the target rule script set to determine the target rule object set according to the parsing result.

[0131] The rule manager parses the candidate rule scripts in the target rule script set and caches them in the corresponding memory of each Task Manager.

[0132] In addition, the rule manager can monitor the candidate rule script set of the database based on the rule monitoring module. If there is a change in the candidate rule script set, the rule manager will notify the rule loader to read the update rule script corresponding to the update operation into the rule engine, and parse the update rule script to obtain the corresponding target rule object.

[0133] Finally, the target data flow is processed based on the target rule object set.

[0134] The rule executor processes the target data flow based on the target rule object set, that is, each data flow indication information is matched by the corresponding target rule object in the cache.

[0135] If the target data flow matches at least one target rule object, the rule executor may trigger a target event corresponding to at least one target rule object or encapsulate and output the processing result in response to the target data flow matching at least one target rule object. If the target data flow does not match any target rule object in the target rule object set, no special processing is performed.

[0136] In the real-time risk control business of logistics, risk strategies can be defined for user behaviors and front-line operations based on the real-time rules engine of logistics risk control, and monitored through the rules engine. Risky behaviors can be identified and intervened in a timely manner to reduce losses.

[0137] By combining the Flink real-time computing framework with the Groovy dynamic language, a real-time rule engine that can meet real-time, high throughput, high performance, and easy scalability is implemented. Compared with existing solutions (such as rule engines based on Drools, URule, EasyRule, etc.), this combination has greatly improved the ease of use and real-time data processing capabilities of the rule engine, from rule configuration efficiency to throughput and latency.

[0138] It should be noted that the specific details involved in each step have been recorded in the above exemplary embodiments and will not be repeated here.

[0139] The data processing method based on the rule engine in the exemplary embodiment of the present disclosure, on the one hand, can directly respond to the configuration operation of the rule configuration item to generate a candidate rule script set, and the user only needs to configure the configuration item to obtain the candidate rule script set, which reduces the workload of configuring and changing the rules and lowers the operation threshold. On the other hand, since each candidate rule script in the candidate rule script set has corresponding data flow indication information, after accessing the target data flow, the required target rule script set can be obtained from the candidate rule script according to the data flow indication information of the target data flow, and the target rule script set is parsed to obtain the target rule object set, so as to process the target data flow based on the target rule object set. In this process, according to the real-time target data flow, the target rule object set required for processing the target data flow can be obtained in real time and in a targeted manner, which can realize the real-time rule determination requirements under high-speed data flow and improve the processing efficiency of massive real-time data flow.

[0140] In an exemplary embodiment of the present disclosure, a data processing device based on a rule engine is also provided. Fig.11 As shown, the data processing device 1100 based on the rule engine may include a first management module 1110, a second management module 1120 and a rule execution module 1130. Specifically:

[0141] The first management module 1110 is used to generate a candidate rule script set in response to a configuration operation on a rule configuration item, each candidate rule script in the candidate rule script set having corresponding data flow indication information; the second management module 1120 is used to determine a target rule script set from the candidate rule script set according to the data flow indication information of the target data flow, and parse the candidate rule scripts in the target rule script set to determine a target rule object set according to the parsing results; the rule execution module 1130 is used to process the target data flow based on the target rule object set.

[0142] In an exemplary embodiment of the present disclosure, the first management module 1110 is configured to perform: in response to a configuration operation on a first configuration item, obtain data flow metadata information, and determine data flow indication information corresponding to the data flow metadata information; in response to a configuration operation on a second configuration item based on the data flow indication information corresponding to the data flow metadata information, generate a candidate rule script, and associate the candidate rule script with the data flow metadata information through the data flow indication information corresponding to the data flow metadata information; and determine the candidate rule script set based on all the obtained candidate rule scripts.

[0143] In an exemplary embodiment of the present disclosure, the first management module 1110 is configured to perform: in response to a configuration operation on a second configuration item based on data flow indication information corresponding to the data flow metadata information, obtaining a hierarchical relationship between configured unit items and the unit items; generating a logical operation expression based on the hierarchical relationship between the unit items and the unit items; and generating the candidate rule script based on the logical operation expression.

[0144] In an exemplary embodiment of the present disclosure, the first management module 1110 is configured to execute: adding data flow indication information corresponding to the data flow metadata information to the candidate rule script.

[0145] In an exemplary embodiment of the present disclosure, the first management module 1110 is further configured to execute: determining a correspondence between the data flow indication information and the candidate rule script according to each of the candidate rule scripts and the data flow indication information corresponding to the candidate rule script;

[0146] In an exemplary embodiment of the present disclosure, the second management module 1120 is configured to execute: based on the correspondence between the data flow indication information and the candidate rule scripts, obtaining the target rule script set corresponding to the data flow indication information of the target data flow from the candidate rule script set.

[0147] In an exemplary embodiment of the present disclosure, the second management module 1120 is configured to execute: parsing the candidate rule scripts in the target rule script set to obtain the target rule object set; and caching the target rule objects in the target rule object set.

[0148] In an exemplary embodiment of the present disclosure, there are multiple parallel sub-tasks, and the target data flow is distributed among each of the sub-tasks; the rule execution module 1130 is configured to execute: each of the sub-tasks respectively calls the cached target rule object set to process the allocated target data flow to obtain the corresponding data processing results.

[0149] In an exemplary embodiment of the present disclosure, the rule execution module 1130 is also configured to execute: monitoring the candidate rule script set; responding to an update operation in the candidate rule script set, updating the correspondence between the data flow indication information and the candidate rule script according to the update rule script corresponding to the update operation; parsing the update rule script to obtain the target rule object corresponding to the update rule script, and updating the cached target rule object set based on the target rule object corresponding to the update rule script.

[0150] In an exemplary embodiment of the present disclosure, the rule execution module 1130 is also configured to execute: rule matching the target data flow with each target rule object in the target rule object set; in response to the target data flow matching at least one of the target rule objects, triggering a target event corresponding to the at least one target rule object.

[0151] Since the details of the various functional modules of the rule-engine-based data processing device of the exemplary embodiment of the present disclosure have been recorded in the exemplary embodiment of the rule-engine-based data processing method described above, they will not be repeated here.

[0152] It should be noted that, although several modules or units of a data processing device based on a rule engine are mentioned in the above detailed description, this division is not mandatory. In fact, according to an embodiment of the present disclosure, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be concretized.

[0153] The exemplary embodiments of the present disclosure also provide a computer program product, which includes a computer program, and when the computer program is executed by a processor, the above-mentioned data processing method based on a rule engine is implemented.

[0154] In one embodiment, the computer program product may be a tangible product containing a computer program, such as a computer-readable storage medium storing a computer program. The readable storage medium may be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to: random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory (Flash), mechanical hard disk (HDD), solid-state drive (SSD), and the like. Exemplarily, the computer program product may be implemented as a non-volatile storage medium storing a computer program, such as a read-only memory, a NAND flash memory, and the like.

[0155] In one embodiment, the computer program product may be an intangible product including a computer program. Exemplarily, the computer program product may be implemented as a virtual digital product, such as a digital file storing an executable file, an installation package, etc. of the computer program.

[0156] The code of the computer program can be written in one or more programming languages. Programming languages ​​such as C language, Java, C++, etc. The program code can be executed entirely on the user computing device, or partially on the user computing device, or as a separate software package, or partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, such as a local area network (LAN), a wide area network (WAN), etc., or can be connected to an external computing device (e.g., an Internet connection provided by an operator).

[0157] The computer program may be carried or transmitted via electrical, magnetic, optical, electromagnetic, infrared, or other signals. The electronic device may convert the signal carrying the computer program into a digital signal, thereby running the computer program. When the computer program is run on an electronic device, its code is used to enable the electronic device to execute (more specifically, the processor of the electronic device may execute) the method steps of various exemplary embodiments of the present disclosure, such as the data processing method based on the rule engine described above.

[0158] In addition, in an exemplary embodiment of the present disclosure, an electronic device capable of implementing the above method is also provided. It will be appreciated by those skilled in the art that various aspects of the present disclosure may be implemented as a system, method, or program product. Therefore, various aspects of the present disclosure may be specifically implemented in the following forms, namely: a complete hardware embodiment, a complete software embodiment (including firmware, microcode, etc.), or an embodiment combining hardware and software aspects, which may be collectively referred to herein as a "circuit", "module", or "system".

[0159] Refer to the following Fig.12 1200 according to this embodiment of the present disclosure is described. Fig.12 The electronic device 1200 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0160] like Fig.12 As shown, the electronic device 1200 is in the form of a general computing device. The components of the electronic device 1200 may include, but are not limited to: the at least one processing unit 1210, the at least one storage unit 1220, a bus 1230 connecting different system components (including the storage unit 1220 and the processing unit 1210), and a display unit 1240.

[0161] The storage unit stores a program code, and the program code can be executed by the processing unit 1210, so that the processing unit 1210 performs the steps according to various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification. For example, the processing unit 1210 can perform the data processing method based on the rule engine shown in the exemplary embodiment of the present disclosure.

[0162] The storage unit 1220 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 1221 and / or a cache memory unit 1222 , and may further include a read-only memory unit (ROM) 1223 .

[0163] The storage unit 1220 may also include a program / utility 1224 having a set (at least one) of program modules 1225, such program modules 1225 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0164] Bus 1230 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0165] The electronic device 1200 may also communicate with one or more external devices 1300 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1200, and / or communicate with any device that enables the electronic device 1200 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1250. In addition, the electronic device 1200 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1260. As shown, the network adapter 1260 communicates with other modules of the electronic device 1200 via a bus 1230. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0166] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiment of the present disclosure.

[0167] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0168] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

Claims

1. A data processing method based on a rule engine, characterized in that: include: In response to a configuration operation on a rule configuration item, a candidate rule script set is generated, each candidate rule script in the candidate rule script set having corresponding data flow indication information; Determining a target rule script set from the candidate rule script set according to the data flow indication information of the target data flow, and parsing the candidate rule scripts in the target rule script set to determine a target rule object set according to the parsing result; The target data flow is processed based on the target rule object set.

2. The method according to claim 1, characterized in that The response to the configuration operation of the rule configuration item generates a candidate rule script set, including: In response to the configuration operation on the first configuration item, acquiring data flow metadata information, and determining data flow indication information corresponding to the data flow metadata information; In response to a configuration operation on a second configuration item based on the data flow indication information corresponding to the data flow metadata information, a candidate rule script is generated, so that the candidate rule script is associated with the data flow metadata information through the data flow indication information corresponding to the data flow metadata information; The candidate rule script set is determined according to all obtained candidate rule scripts.

3. The method according to claim 2, characterized in that The response generates a candidate rule script based on the configuration operation of the second configuration item based on the data flow indication information corresponding to the data flow metadata information, including: In response to a configuration operation on a second configuration item based on the data flow indication information corresponding to the data flow metadata information, acquiring a configured unit item and a hierarchical relationship between the unit items; Generate a logical operation expression according to the hierarchical relationship between the unit items and the unit items; The candidate rule script is generated based on the logical operation expression.

4. The method according to claim 2, characterized in that: The step of associating the candidate rule script with the data flow metadata information through the data flow indication information corresponding to the data flow metadata information includes: The data flow indication information corresponding to the data flow metadata information is added to the candidate rule script.

5. The method according to claim 1, characterized in that The response to the configuration operation of the rule configuration item generates a candidate rule script set, and also includes: Determine the corresponding relationship between the data flow indication information and the candidate rule script according to each of the candidate rule scripts and the data flow indication information corresponding to the candidate rule script; The step of determining the target rule script set from the candidate rule script set according to the data flow indication information of the target data flow comprises: Based on the correspondence between the data flow indication information and the candidate rule scripts, the target rule script set corresponding to the data flow indication information of the target data flow is obtained from the candidate rule script set.

6. The method according to claim 5, characterized in that The step of parsing the candidate rule scripts in the target rule script set to determine the target rule object set according to the parsing result includes: Parsing the candidate rule scripts in the target rule script set to obtain the target rule object set; The target rule objects in the target rule object set are cached.

7. The method according to claim 6, characterized in that The method comprises a plurality of parallel subtasks, wherein the target data stream is distributed among the subtasks; The processing of the target data flow based on the target rule object set includes: Each of the subtasks respectively calls the cached target rule object set to process the assigned target data flow to obtain the corresponding data processing results.

8. The method according to claim 6, characterized in that The method further comprises: Monitoring the candidate rule script set; In response to an update operation in the candidate rule script set, the corresponding relationship between the data flow indication information and the candidate rule script is updated according to the update rule script corresponding to the update operation; The update rule script is parsed to obtain a target rule object corresponding to the update rule script, and the cached target rule object set is updated based on the target rule object corresponding to the update rule script.

9. The method according to any one of claims 1 to 8, characterized in that The processing of the target data flow based on the target rule object set includes: Performing rule matching on the target data flow and each target rule object in the target rule object set; In response to the target data flow matching at least one of the target rule objects, a target event corresponding to the at least one target rule object is triggered.

10. A data processing device based on a rule engine, characterized in that: The device comprises: A first management module, configured to generate a candidate rule script set in response to a configuration operation on a rule configuration item, wherein each candidate rule script in the candidate rule script set has corresponding data flow indication information; A second management module is used to determine a target rule script set from the candidate rule script set according to the data flow indication information of the target data flow, and parse the candidate rule scripts in the target rule script set to determine a target rule object set according to the parsing result; A rule execution module is used to process the target data flow based on the target rule object set.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.

12. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 9 by executing the executable instructions.

Citation Information

Cited By

  • Data processing method and device, electronic equipment and storage medium

    CN120197955A