A rule engine configuration method, device, equipment and storage medium

By publishing preset rule engine file packages in the project warehouse and configuring database rule tables, the difficulty of real-time viewing and maintenance of the rule engine is solved, and the rapid response and flexible management of the rule engine are achieved to adapt to project changes.

CN113204540BActive Publication Date: 2025-08-29CHINA CONSTRUCTION BANK
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110590432.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-28
Publication Date
2025-08-29
Estimated Expiration
2041-05-28

AI Technical Summary

Technical Problem

In the prior art, the rule engine is closely coupled with the application system, which makes business rules inconvenient to view and maintain in real time, difficult to maintain projects, and slow response speed.

Method used

By publishing the preset rule engine public file package to the project repository, user configuration rules are written to the database rule table, user configured rules engines are generated, and rules are supported to add, modify and delete rules, and flexible management of the rule engine is realized.

Benefits of technology

It realizes the fast response and flexible configuration of the rule engine, solves the problems of project maintenance difficulties and slow response speed, and adapts to the needs of project changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113204540B_ABST
    Figure CN113204540B_ABST
Patent Text Reader

Abstract

Embodiments of the present invention disclose a rule engine configuration method, apparatus, device, and storage medium, relating to the field of automated programming. The method comprises: publishing a preset rule engine public file package to a preset project repository; in response to a rule engine file package pull operation, pulling the corresponding preset rule engine public file package from the preset project repository; and in response to a rule configuration operation, writing user-configured rules into a preset database rule table in the preset rule engine public file package to generate a user-configured rule engine. The technical solutions of the embodiments of the present invention facilitate the configuration and management of business rules in the rule engine, enabling rapid response to project changes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to automatic programming technology, and more particularly to a rule engine configuration method, apparatus, device and storage medium. Background Art

[0002] A rule engine, also known as a business rule management system (BRMS), is an application component that separates business decision-making statements from application code and embeds them into the program.

[0003] Rule engines use predefined semantic modules to write business decisions, known as business rules, which are then configured and managed by users or developers as needed. Large enterprises, especially those in the banking and financial sectors, have a wide variety of complex business rules, making configuration cumbersome. Existing rule engines typically use Java-based rule engines, such as Drools. Drools is a heavyweight rule engine component with low execution efficiency and lacks support for dynamic configuration.

[0004] In real-world applications, projects often change, so the rule engine needs to be configured based on business needs. However, due to the tight coupling between business rules and the application system's Java code in existing technologies, pre-configured business rules are difficult to view and maintain in real time, resulting in difficult project maintenance and slow response times. Summary of the Invention

[0005] Embodiments of the present invention provide a rule engine configuration method, apparatus, device, and storage medium to facilitate configuration and management of business rules in a rule engine.

[0006] In a first aspect, an embodiment of the present invention provides a rule engine configuration method, including:

[0007] Publish the preset rule engine public file package to the preset project repository;

[0008] In response to the rule engine file package pulling operation, pulling the corresponding preset rule engine public file package from the preset project warehouse;

[0009] In response to the rule configuration operation, the user-configured rules are written into the preset database rule table in the preset rule engine public file package to generate a user-configured rule engine.

[0010] In a second aspect, an embodiment of the present invention further provides a rule engine configuration device, comprising:

[0011] The rule file package publishing module is used to publish the preset rule engine public file package to the preset project warehouse;

[0012] A rule file package pulling module, configured to pull the corresponding preset rule engine public file package from the preset project repository in response to a rule engine file package pulling operation;

[0013] The rule engine generation module is used to write the user-configured rules into the preset database rule table in the preset rule engine public file package in response to the rule configuration operation, and generate the user-configured rule engine.

[0014] In a third aspect, an embodiment of the present invention further provides a rule engine configuration device, the rule engine configuration device comprising:

[0015] one or more processors;

[0016] a memory for storing one or more programs;

[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the rule engine configuration method provided by any embodiment of the present invention.

[0018] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer-executable instructions, which, when executed by a computer processor, are used to execute the rule engine configuration method provided by any embodiment of the present invention.

[0019] The embodiment of the present invention distributes the preset rule engine public file package to the preset project warehouse, writes business rules according to the user's configuration operations, and generates a rule engine, thereby solving the problems of difficult project maintenance and slow response speed caused by the inconvenience of real-time viewing and maintenance of business rules, and achieving the effect of convenient configuration and management of business rules in the rule engine and rapid response to project changes. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 This is a flowchart of a rule engine configuration method in Embodiment 1 of the present invention;

[0021] Figure 2 This is a flowchart of a rule engine configuration method in Embodiment 2 of the present invention;

[0022] Figure 3 This is a flowchart of a rule engine configuration method in Embodiment 3 of the present invention;

[0023] Figure 4 This is a schematic structural diagram of a rule engine configuration device in a fourth embodiment of the present invention;

[0024] Figure 5 This is a structural diagram of a rule engine configuration device in Example 5 of the present invention. DETAILED DESCRIPTION

[0025] The present invention will be further described in detail below with reference to the accompanying drawings and examples. It will be understood that the specific embodiments described herein are intended only to illustrate the present invention and are not intended to limit the present invention. It should also be noted that, for ease of description, the accompanying drawings only illustrate portions relevant to the present invention, not all structures.

[0026] Example 1

[0027] Figure 1 This is a flowchart of a rule engine configuration method provided in the first embodiment of the present invention. This embodiment is applicable to situations where an enterprise configures a rule engine based on business needs, such as establishing a rule engine for a banking or financial enterprise. The method can be performed by a rule engine configuration device, which can be implemented by hardware and / or software and can generally be integrated into a rule engine configuration device, such as a server. The method specifically includes:

[0028] Step 110: Publish the preset rule engine public file package to the preset project repository;

[0029] The preset rule engine public file package can be a jar package, which can include a preset database rule table for recording user-configured business rules. The rule engine management platform can publish the preset rule engine public file package to a preset project repository, such as a Maven repository. The Maven repository helps us manage artifacts and is where all jar files are stored.

[0030] Optionally, before publishing the preset rule engine public file package to the preset project warehouse, the method further includes: compiling and generating the preset rule engine public file package; wherein the preset rule engine public file package is a jar package.

[0031] Step 120: In response to the rule engine file package pulling operation, pull the corresponding preset rule engine public file package from the preset project warehouse;

[0032] Among them, users who need to configure the rule engine can request the rule engine management platform to pull the preset rule engine public file package from the preset project warehouse.

[0033] Step 130: In response to the rule configuration operation, the user-configured rules are written into the preset database rule table in the preset rule engine public file package to generate a user-configured rule engine.

[0034] Users generate different rules based on the business needs of their enterprise systems and their business-related data. After obtaining the preset rule engine public file package, they write their own business rules into the preset database rule table within the preset rule engine public file package, thereby generating a rule engine configured by the user based on their business needs. The user-configured rule engine can include at least two rules, which can be modified and deleted, and of course, new rules can also be added to the preset database rule table.

[0035] The technical solution of this embodiment distributes the preset rule engine public file package to the preset project warehouse, writes business rules according to the user's configuration operations, and generates a rule engine, thereby solving the problems of difficult project maintenance and slow response speed caused by the inconvenience of real-time viewing and maintenance of business rules, and achieving the effect of convenient configuration and management of business rules in the rule engine and rapid response to project changes.

[0036] Example 2

[0037] Figure 2 This is a flowchart of a rule engine configuration method provided in Example 2 of the present invention. This embodiment further refines the above technical solution. Specifically, the user-configured rules may include rule conditions, rule actions, and priorities. The method specifically includes:

[0038] Step 210: Publish the preset rule engine public file package to the preset project repository;

[0039] Step 220: In response to the rule engine file package pulling operation, pull the corresponding preset rule engine public file package from the preset project warehouse;

[0040] Step 230: In response to the rule configuration operation, the user-configured rules are written into the preset database rule table in the preset rule engine public file package to generate a user-configured rule engine.

[0041] Step 240: In response to the rule adding operation, add at least one rule to the rule engine;

[0042] Step 250: In response to the rule modification operation, modify at least one of the rule condition, rule action, and priority of the rule engine accordingly;

[0043] Step 260: In response to the rule deletion operation, delete the current rules in the rule engine.

[0044] When users configure rules, they must also configure their priority. Since a user-configured rule engine can include at least two rules, a corresponding priority is set for each rule. After generating the rule engine, the rule management system provides online maintenance services, including performing at least one of the following operations on the rules in the rule engine: adding, modifying, and deleting. In other words, steps 240, 250, and 260 are executed based on the user's requested operation. For adding new rules, the rule conditions, rule actions, and priority levels must be set. For deleting rules, either a single rule or a group of rules can be deleted. Optionally, at least one rule set is configured in the pre-set database rule table, and a rule set can contain at least one rule. If a rule set contains multiple rules, the rule set identification number can be searched and the searched rule set can be deleted. For modifying rules, the rules within the rule set can be modified in batches based on the rule set identification number. Individual rules within a rule set can also be modified based on the rule identification number.

[0045] The technical solution of this embodiment can manage the rules in the preset database rule table, facilitate the review of the rules recorded therein, and also facilitate the addition, modification and deletion of rules in the rule engine, so as to conveniently adjust the rule engine to adapt to changes in the project.

[0046] Example 3

[0047] Figure 3 This is a flowchart of a rule engine configuration method provided in the third embodiment of the present invention. This embodiment further refines the above technical solution. Specifically, in response to the rule configuration operation, the user-configured rules are written into the preset database rule table in the preset rule engine public file package to generate a user-configured rule engine. The method specifically includes:

[0048] Step 310: Publish the preset rule engine public file package to the preset project repository;

[0049] Step 320: In response to the rule engine file package pulling operation, pull the corresponding preset rule engine public file package from the preset project warehouse;

[0050] Step 330: In response to the rule configuration operation, configure at least one rule set in the preset database rule table, and configure at least one rule in the rule set;

[0051] The preset database rule table can use the rule set identification number, i.e. ruleset_id, as the primary key. Multiple rules can be set under a rule set. Each rule corresponds to a rule identification number, i.e. rule_id. Each rule has its own rule condition, rule action, and priority.

[0052] Step 340: Set a set priority for the rule set and set a rule priority for the rule;

[0053] Once configured in the database, the rule engine reads the rule conditions configured in the preset database rule table, parses the rule execution conditions using MVEL (MVFLEX Expression Language), and executes the corresponding rule actions. Priorities are divided into rule set priority (rulesetPriority) and rule priority (rulePriority). The rule engine first executes the rule set actions based on the rule set priority. Within the same rule set, the actions of each rule are executed based on the rule priority.

[0054] Step 350: Configure the rule condition and the rule action for each rule, and set the working status of each rule.

[0055] Among them, the rule status rule_status of the rule can also be set in the preset database rule table, that is, whether the rule is enabled in the rule engine. In this way, rules that are not needed temporarily can be set to disabled, and the rules will not be directly deleted from the rule engine, which is convenient for flexible adjustment of the rules enabled in the rule engine according to business needs.

[0056] Optionally, after configuring at least one rule in the rule set, the method further includes:

[0057] A rule description is set for each rule. In the preset database rule table, a rule description rule_dsc is also set. With the rule description, the function of the rule can be intuitively understood, which is convenient for subsequent development and management.

[0058] Optionally, the preset database rule table includes an Oracle database rule table and an HBase database rule table. That is, when the user configures the rule engine, it supports writing rules into the Oracle rule table or supports writing rules into the HBase rule table.

[0059] Optionally, the rule engine may support multiple rules and multiple rule actions, including: ElasticsearchAction, HBaseAction, and InvokeAction.

[0060] Among them, for ElasticsearchAction, Elasticsearch is a real-time distributed search and analysis engine. The rule engine can provide Elasticsearch retrieval, providing rule engine users with more action execution methods. For HBaseAction, HBase is a distributed, column-oriented open source NoSQL database. This rule engine execution action provides query, add, modify, and delete functions based on HBase. For InvokeAction, InvokeAction is an execution action class called based on the Java reflection mechanism. The rule engine user enters the class name, method name, and parameters required by the method to be reflected and invoked. Through InvokeAction, the method under the class can be executed to implement the action execution.

[0061] The technical solution provided by this embodiment can set up multiple rule sets in a preset database rule table for systems with multiple and complex rules. Each rule set contains multiple rules, and actions are executed according to different conditions and priorities. Moreover, it can adapt to the caller's needs for multiple invocation methods. The rule engine supports multiple reading and writing requirements such as HBase and Elasticsearch, and also supports reflective invocation of Invoke. The rules configured in this embodiment support more complex and diverse rule logic, are more flexible and efficient, and meet the complex and changing business needs of the caller.

[0062] Example 4

[0063] Figure 4 A schematic diagram of a rule engine configuration device provided in the fourth embodiment of the present invention is shown in FIG. Figure 4 As shown, the rule engine configuration device includes: a rule file package publishing module 410, a rule file package pulling module 420 and a rule engine generating module 430.

[0064] A rule file package publishing module 410 is used to publish a preset rule engine public file package to a preset project repository;

[0065] A rule file package pulling module 420 is configured to pull the corresponding preset rule engine public file package from the preset project repository in response to a rule engine file package pulling operation;

[0066] The rule engine generation module 430 is configured to write the user-configured rules into the preset database rule table in the preset rule engine public file package in response to the rule configuration operation, and generate a user-configured rule engine.

[0067] The technical solution of this embodiment distributes the preset rule engine public file package to the preset project warehouse, writes business rules according to the user's configuration operations, and generates a rule engine, thereby solving the problems of difficult project maintenance and slow response speed caused by the inconvenience of real-time viewing and maintenance of business rules, and achieving the effect of convenient configuration and management of business rules in the rule engine and rapid response to project changes.

[0068] Optionally, the rule engine configuration device further includes:

[0069] The rule file package generation module is used to compile and generate the preset rule engine public file package before publishing the preset rule engine public file package to the preset project warehouse; wherein, the preset rule engine public file package is a jar package.

[0070] Optionally, the user-configured rule includes a rule condition, a rule action, and a priority.

[0071] Optionally, the rule engine configuration device further includes at least one of the following:

[0072] a rule adding module configured to write the user-configured rules into a preset database rule table in the preset rule engine public file package in response to the rule configuration operation, and after generating the user-configured rule engine, add at least one of the rules in response to the rule adding operation to the rule engine;

[0073] a rule modification module configured to, after writing the user-configured rule into a preset database rule table in the preset rule engine public file package in response to the rule configuration operation to generate the user-configured rule engine, and then, in response to the rule modification operation, modify at least one of the rule conditions, rule actions, and priorities of the rule engine accordingly;

[0074] The rule deletion module is used to write the user-configured rules into the preset database rule table in the preset rule engine public file package in response to the rule configuration operation, generate the user-configured rule engine, and then delete the currently existing rules in the rule engine in response to the rule deletion operation.

[0075] Optionally, the rule engine generation module includes:

[0076] a rule set configuration unit, configured to configure at least one rule set in the preset database rule table and configure at least one rule in the rule set in response to the rule configuration operation;

[0077] a priority setting unit, configured to set a set priority for the rule set and set a rule priority for the rule;

[0078] The rule setting unit is used to configure the rule condition and the rule action for each rule, and set the working status of each rule.

[0079] Optionally, the rule engine generation module further includes:

[0080] The rule description setting unit is configured to set a rule description for each rule after configuring at least one rule in the rule set.

[0081] Optionally, the rule action includes: ElasticsearchAction, HBaseAction, and InvokeAction.

[0082] Optionally, the preset database rule table includes an Oracle database rule table and an HBase database rule table.

[0083] The rule engine configuration device provided in the embodiment of the present invention can execute the rule engine configuration method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0084] Example 5

[0085] Figure 5 A schematic diagram of a rule engine configuration device provided in the fifth embodiment of the present invention is shown in FIG. Figure 5 As shown, the rule engine configuration device includes a processor 510, a memory 520, an input device 530 and an output device 540; the number of the processor 510 in the rule engine configuration device can be one or more. Figure 5 In the example, a processor 510 is used; the processor 510, the memory 520, the input device 530 and the output device 540 in the rule engine configuration device can be connected via a bus or other means. Figure 5 The bus connection is taken as an example.

[0086] The memory 520, as a computer-readable storage medium, can be used to store software programs, computer executable programs, and modules, such as the program instructions / modules corresponding to the rule engine configuration method in the embodiments of the present invention (for example, the rule file package publishing module 410, the rule file package pulling module 420, and the rule engine generation module 430 in the rule engine configuration device). The processor 510 executes the software programs, instructions, and modules stored in the memory 520 to execute the various functional applications and data processing of the rule engine configuration device, thereby implementing the above-mentioned rule engine configuration method.

[0087] The memory 520 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created based on the use of the terminal, etc. In addition, the memory 520 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 520 may further include a memory remotely located relative to the processor 510, and these remote memories may be connected to the rule engine configuration device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0088] The input device 530 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the rule engine configuration device. The output device 540 may include a display device such as a display screen.

[0089] Example 6

[0090] Embodiment 6 of the present invention further provides a storage medium containing computer-executable instructions. When the computer-executable instructions are executed by a computer processor, they are used to perform a rule engine configuration method. The method includes:

[0091] Publish the preset rule engine public file package to the preset project repository;

[0092] In response to the rule engine file package pulling operation, pulling the corresponding preset rule engine public file package from the preset project warehouse;

[0093] In response to the rule configuration operation, the user-configured rules are written into the preset database rule table in the preset rule engine public file package to generate a user-configured rule engine.

[0094] Of course, the computer executable instructions of a storage medium containing computer executable instructions provided by an embodiment of the present invention are not limited to the operations of the method described above, and can also execute related operations in the rule engine configuration method provided by any embodiment of the present invention.

[0095] Through the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented with the help of software and necessary general-purpose hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment of the present invention.

[0096] It is worth noting that in the embodiment of the above-mentioned rule engine configuration device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.

[0097] Note that the above are only preferred embodiments of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments, and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments and may include many other equivalent embodiments without departing from the concept of the present invention. The scope of the present invention is determined by the scope of the appended claims.

Claims

1. A rule engine configuration method, characterized in that: include: Compile and generate a preset rule engine public file package; wherein the preset rule engine public file package is a jar package; the preset rule engine public file package includes a preset database rule table for recording user-configured business rules; Publishing the preset rule engine public file package to the preset project warehouse; wherein the preset project warehouse is a Maven warehouse; In response to the rule engine file package pulling operation, pulling the corresponding preset rule engine public file package from the preset project warehouse; In response to the rule configuration operation, at least one rule set is configured in the preset database rule table, and at least one rule is configured in the rule set; wherein the preset database rule table uses the identification number of the rule set as a primary key; and each rule corresponds to a rule identification number; Setting a set priority for the rule set and setting a rule priority for the rule; wherein the priority is divided into rule set priority rulesetPriority and rule priority rulePriority; Configure the rule condition and the rule action for each rule, and set the working status of each rule; wherein the working status of the rule is whether the rule is enabled; the user-configured rule includes the rule condition, rule action, and priority; the preset database rule table includes the Oracle database rule table and the HBase database rule table; the rule actions include: ElasticsearchAction, HBaseAction, and InvokeAction; After configuring at least one rule in the rule set, the method further includes: Setting a rule description for each of said rules; The method further comprises at least one of the following: In response to a rule adding operation, adding at least one of the rules in the rule engine; In response to the rule modification operation, modifying at least one of the rule condition, rule action, and priority of the rule engine accordingly; In response to the rule deletion operation, at least one rule currently existing in the rule engine is deleted.

2. A rule engine configuration device, characterized in that: include: A rule file package generation module is used to compile and generate a preset rule engine public file package; wherein, the preset rule engine public file package is a jar package; the preset rule engine public file package includes a preset database rule table for recording user-configured business rules; A rule file package publishing module is used to publish the preset rule engine public file package to a preset project warehouse; wherein the preset project warehouse is a Maven warehouse; A rule file package pulling module, configured to pull the corresponding preset rule engine public file package from the preset project repository in response to a rule engine file package pulling operation; Rule engine generation module, including: a rule set configuration unit, configured to configure at least one rule set in the preset database rule table and at least one rule in the rule set in response to the rule configuration operation; wherein the preset database rule table uses the identification number of the rule set as a primary key; and each rule corresponds to a rule identification number; A priority setting unit, configured to set a set priority for the rule set and set a rule priority for the rule; wherein the priority is divided into a rule set priority rulesetPriority and a rule priority rulePriority; A rule setting unit is configured to configure the rule condition and the rule action for each rule, and set the working status of each rule; wherein the working status of the rule is whether the rule is enabled; the user-configured rule includes a rule condition, a rule action, and a priority; the preset database rule table includes an Oracle database rule table and an HBase database rule table; the rule actions include: ElasticsearchAction, HBaseAction, and InvokeAction; The rule engine generation module further includes: a rule description setting unit, configured to set a rule description for each rule after configuring at least one rule in the rule set; The device further comprises at least one of the following: a rule adding module configured to write the user-configured rules into a preset database rule table in the preset rule engine public file package in response to the rule configuration operation, and after generating the user-configured rule engine, add at least one of the rules in response to the rule adding operation to the rule engine; a rule modification module configured to, after writing the user-configured rule into a preset database rule table in the preset rule engine public file package in response to the rule configuration operation to generate the user-configured rule engine, and then, in response to the rule modification operation, modify at least one of the rule conditions, rule actions, and priorities of the rule engine accordingly; The rule deletion module is used to write the user-configured rules into the preset database rule table in the preset rule engine public file package in response to the rule configuration operation, generate the user-configured rule engine, and then delete the currently existing rules in the rule engine in response to the rule deletion operation.

3. A rule engine configuration device, characterized in that: The rule engine configuration device includes: one or more processors; a memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the rule engine configuration method as claimed in claim 1.

4. A storage medium containing computer-executable instructions, characterized in that: When the computer executable instructions are executed by a computer processor, they are used to perform the rule engine configuration method as claimed in claim 1.

Citation Information

Patent Citations

  • Business processing method and system based on rule engine

    CN105630617A