A business request processing method and medium based on a hybrid rule engine
By using a hybrid rule engine architecture and version management mechanism, the problems of inflexible and inefficient business request processing caused by a single rule engine are solved, and efficient and flexible business request processing and rule change tracking are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TAIPING FINANCIAL SERVICE CENT (SHANGHAI) CO LTD
- Filing Date
- 2026-04-29
- Publication Date
- 2026-05-29
AI Technical Summary
In existing technologies, the use of a single rule engine architecture leads to inflexible and inefficient processing of business requests, and lacks an effective rule version management mechanism, making it difficult to trace rule changes.
A hybrid rule engine architecture is adopted, which combines the SpEL rule engine and the Drools rule engine to automatically select the appropriate rule engine based on the complexity of business requests. The rules are pre-compiled and cached in the rule repository. Combined with version information synchronization and change monitoring mechanisms, rule version management and traceability are achieved.
It improves the flexibility and efficiency of business request processing, enables effective traceability of rule changes, and enhances the flexibility of rule management and the accuracy of business request processing.
Smart Images

Figure CN122111534A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing, and in particular to a business request processing method and medium based on a hybrid rule engine. Background Technology
[0002] In software system development, frequent changes to business rules make accurate business requests and efficient processing technologies that reduce the pressure on the rule engine processor crucial.
[0003] In the process of developing this invention, the inventors discovered the following shortcomings in the existing technology: Currently, although existing technologies employ rule engines to decouple business logic, the use of a single rule engine architecture leads to inflexible and inefficient business request processing. Furthermore, the lack of an effective rule version management mechanism makes it difficult to trace rule changes. Summary of the Invention
[0004] This invention provides a business request processing method and medium based on a hybrid rule engine, so as to improve the flexibility and efficiency of business request processing.
[0005] According to one aspect of the present invention, a business request processing method based on a hybrid rule engine is provided, comprising: After confirming that the business request processing system has completed initialization, the system acquires and parses the current business request to be processed in real time, and obtains the current encapsulated business request through the preset business parameter encapsulation method. The target rule engine is determined by analyzing and matching the currently encapsulated business request through a pre-set hybrid rule engine decision method. The target rule engine is either the SpEL rule engine or the Drools rule engine; In the preset rule repository, the currently encapsulated business request is processed according to the compiled rule execution paths corresponding to the target rule engine, and the target business request processing result is obtained.
[0006] According to another aspect of the present invention, a business request processing apparatus based on a hybrid rule engine is provided, comprising: The current encapsulated business request determination module is used to obtain and parse the current business request to be processed in real time after confirming that the business request processing system has completed initialization, and obtain the current encapsulated business request through the preset business parameter encapsulation method; The target rule engine determination module is used to analyze and match the currently encapsulated business request through a pre-set hybrid rule engine decision method to determine the target rule engine; The target rule engine is either the SpEL rule engine or the Drools rule engine; The target business request processing result determination module is used to obtain from a preset rule repository and process the currently encapsulated business request according to the execution paths of each rule that has been compiled and corresponds to the target rule engine, so as to obtain the target business request processing result.
[0007] According to another aspect of the present invention, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the business request processing method based on a hybrid rule engine as described in any embodiment of the present invention.
[0008] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions, the computer instructions being configured to cause a processor to execute and implement the business request processing method based on a hybrid rule engine as described in any embodiment of the present invention.
[0009] The technical solution of this invention, after confirming the completion of the business request processing system initialization, acquires and parses the current business request to be processed in real time, obtains the current encapsulated business request through a preset business parameter encapsulation method, and analyzes and matches the current encapsulated business request through a pre-set hybrid rule engine decision method to determine the target rule engine; wherein, the target rule engine is the SpEL rule engine or the Drools rule engine; in a preset rule repository, the current encapsulated business request is processed according to the compiled rule execution paths corresponding to the target rule engine to obtain the target business request processing result. This solves the problem of inflexible and inefficient business request processing caused by using a single rule engine architecture, improves the flexibility and efficiency of business request processing, and can effectively manage rule versions, enabling effective traceability when rules change.
[0010] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0011] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0012] Figure 1 This is a flowchart of a business request processing method based on a hybrid rule engine according to Embodiment 1 of the present invention; Figure 2 This is a schematic diagram of a business request processing device based on a hybrid rule engine according to Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of the structure of an electronic device provided according to Embodiment 3 of the present invention. Detailed Implementation
[0013] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0014] It should be noted that the terms "target," "current," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0015] It is worth noting that the information collected in the technical solution of this application is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data all comply with the relevant laws, regulations and standards of the relevant countries and regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entry points for users to choose to authorize or refuse; if the user chooses to refuse, the process will proceed to the expert decision-making process.
[0016] Example 1 Figure 1The flowchart of a business request processing method based on a hybrid rule engine is provided in Embodiment 1 of the present invention. This embodiment is applicable to the situation where different rule engines are selected for processing different business requests. The method can be executed by a business request processing device based on a hybrid rule engine, which can be implemented in hardware and / or software.
[0017] Correspondingly, such as Figure 1 As shown, the method includes: S110. After confirming that the business request processing system has completed initialization, the system acquires and parses the current business request to be processed in real time, and obtains the current encapsulated business request through the preset business parameter encapsulation method.
[0018] The business request processing system can be a system that processes different business requests. This system can connect the configuration parameters obtained from each calling business application system to a rule repository. The rule repository stores the configuration parameters for each of the calling business application systems and includes multiple version snapshots. The currently pending business request can be a request originating from different calling business application systems. The currently encapsulated business request can be a business request obtained by encapsulating the currently pending business request.
[0019] Optionally, the real-time acquisition and parsing of the current pending business request, and the obtaining of the current encapsulated business request through a preset business parameter encapsulation method, includes: parsing the real-time acquired current pending business request to obtain current business request parameters; acquiring the current context joint description information corresponding to the current pending business request; wherein the current context joint description information includes at least one of the following: information of the currently calling business application system, information of the current business request user, and current environment variable description information; encapsulating the current business request parameters into a fact object through the preset business parameter encapsulation method, and injecting the current context joint description information into the encapsulated current business request description parameters to obtain the current encapsulated business request.
[0020] In this embodiment, when a current pending business request is obtained, it is assumed that the current pending business request is business request 1 issued by calling business application system A. Therefore, it is necessary to parse the current pending business request 1 to obtain the current business request parameters. That is, the parameters of the current pending business request 1 are extracted to obtain the corresponding current business request parameters.
[0021] Furthermore, the current business request parameters need to be encapsulated into fact objects using a business parameter encapsulation method to obtain standard fact objects. This requires injecting contextual descriptions such as information about the calling business application system, the current business request user information, and current environment variable descriptions. Specifically, the information about the calling business application system can describe the current calling business application system. The current business request user information can be the specific user description information from the calling business application system that issued the business request. The current environment variable description information can be the information describing the environment variables corresponding to the business request. By encapsulating the current business request to be processed in this way, the complexity analysis of the request can be better achieved, allowing for the selection of a more suitable rule engine.
[0022] S120. The current encapsulated business request is analyzed and matched using a pre-set hybrid rule engine decision method to determine the target rule engine.
[0023] The target rule engine is either the SpEL (Spring Expression Language) rule engine or the Drools rule engine.
[0024] The hybrid rule engine decision-making method can be a method of analyzing business requests to determine the specific type of rule engine. The target rule engine can be the SpEL rule engine or the Drools rule engine. Specifically, for the SpEL rule engine, SpEL is one of the core technologies of the Spring Framework, which supports querying and manipulating object graphs at runtime. Although SpEL's expression engine is flexible and lightweight, it is difficult to efficiently handle business requests with large-scale rule chains with complex relationships; the SpEL rule engine is suitable for handling low-complexity business requests. The Drools rule engine (which has an open-source business rule engine that is easy to access, adjust, and manage, and is good at complex logic) is excelling, but its cumbersome nature, high learning cost, and potential conflicts and overriding issues between rules increase the difficulty of management and maintenance; the Drools rule engine is suitable for handling high-complexity business requests.
[0025] Optionally, the step of analyzing and matching the current encapsulated business request using a pre-set hybrid rule engine decision method to determine the target rule engine includes: obtaining the number of execution rule conditions, the complexity of execution rule logical operators, and the nesting depth of execution rules corresponding to the current encapsulated business request; calculating the complexity of the number of execution rule conditions, the complexity of execution rule logical operators, and the nesting depth of execution rules using a pre-set execution rule complexity analysis method to obtain the current execution rule complexity weight value; and determining the target rule engine corresponding to the current encapsulated business request based on the current execution rule complexity weight value using the hybrid rule engine decision method.
[0026] Specifically, determining the target rule engine corresponding to the current encapsulated business request based on the complexity weight value of the current execution rule, using the hybrid rule engine decision method, includes: obtaining a preset rule engine complexity weight value threshold; and using the hybrid rule engine decision method, if the complexity weight value of the current execution rule is less than the rule engine complexity weight value threshold, then determining the target rule engine corresponding to the current encapsulated business request as the SpEL rule engine; if the complexity weight value of the current execution rule is not less than the rule engine complexity weight value threshold, then determining the target rule engine corresponding to the current encapsulated business request as the Drools rule engine.
[0027] The execution rule complexity analysis method can be a method for analyzing the complexity of the execution rules corresponding to a business request. The number of execution rule conditions can describe the number of execution rule conditions contained in the business request. The execution rule logical operator complexity can describe the ease or difficulty of executing logical operators. The execution rule nesting depth can describe the depth of nesting of execution rules.
[0028] In this embodiment, the execution rule complexity analysis method is used to calculate the complexity of the number of execution rule conditions, the complexity of execution rule logical operators, and the nesting depth of execution rules. The corresponding complexity can be matched according to the size of the number of conditions, the size of the complexity of logical operators, and the size of the nesting depth of the execution rule, and then the corresponding current execution rule complexity weight value is determined by cumulative analysis.
[0029] The hybrid rule engine decision-making method can be a method that determines the specific rule engine based on the magnitude of the execution rule complexity weight value. The rule engine complexity weight value threshold can be a pre-set parameter used to judge the difficulty of business requests.
[0030] After calculating the complexity weight value of the current execution rule, it is necessary to obtain the rule engine complexity weight value threshold. Specifically, if the complexity weight value of the current execution rule is less than the rule engine complexity weight value threshold, it means that the complexity of the current business request is low, and the SpEL rule engine is suitable for handling business requests with low complexity. Therefore, the target rule engine corresponding to the current encapsulated business request can be determined to be the SpEL rule engine.
[0031] Additionally, if the complexity weight value of the current execution rule is not less than the threshold of the complexity weight value of the rule engine, it indicates that the complexity of the current business request is high, and the Drools rule engine is suitable for handling business requests with high complexity. Therefore, the target rule engine corresponding to the current encapsulated business request can be determined to be the Drools rule engine.
[0032] The advantage of this setup is that it automatically selects different types of rule engines to process business requests based on their complexity. This improves the flexibility and accuracy of business request processing, saves bandwidth resources for the engine, and increases the efficiency of business request processing.
[0033] S130. In the preset rule repository, obtain and process the current encapsulated business request according to the compiled rule execution paths corresponding to the target rule engine, and obtain the target business request processing result.
[0034] The result of the target business request processing can be the result obtained by processing the currently encapsulated business request using the rule execution path.
[0035] Optionally, before obtaining and parsing the current pending business request in real time after confirming that the business request processing system has completed initialization, and obtaining the currently encapsulated business request through a preset business parameter encapsulation method, the method further includes: initializing the expression parser corresponding to the SpEL rule engine and the KieSession session pool corresponding to the Drools rule engine in the target version snapshot of the rule repository in the business request processing system; wherein, the configuration parameters corresponding to each calling business application system are connected to the rule repository; each rule in the enabled state corresponding to the SpEL rule engine and the Drools rule engine is obtained, and each rule in the enabled state is compiled to obtain the execution path of each rule and stored, thereby completing the initialization operation of the business request processing system; wherein, the SpEL rule engine compiles each SpEL type rule into an executable Expression object to obtain the corresponding execution path of each rule; the Drools rule engine loads each Drools type rule into KieBase and compiles and creates KieSession instances corresponding to each rule.
[0036] In this embodiment, since the rule repository includes multiple version snapshots, it is necessary to first initialize the expression parser corresponding to the SpEL rule engine and the KieSession session pool corresponding to the Drools rule engine in the target version snapshot of the rule repository. Specifically, the application context is initialized, and the configuration parameters corresponding to each calling business application system are connected to the rule repository, which can be done by connecting to the database or configuration center corresponding to the rule repository.
[0037] Furthermore, since the SpEL and Drools rule engines can each contain multiple rules, each with an enabled or disabled state, it is necessary to obtain the enabled rules corresponding to the SpEL and Drools rule engines, and also to obtain the metadata (which may include version number and rule type parameters) for each rule. This allows for the compilation of each enabled rule, the generation and storage of its execution path, and ultimately, the initialization of the business request processing system.
[0038] Specifically, the SpEL rule engine compiles each SpEL-type rule into an executable Expression object, obtaining the corresponding execution path for each rule; the Drools rule engine loads each Drools-type rule into KieBase and compiles and creates a KieSession instance corresponding to each rule. Furthermore, a version information synchronization module can be used to record the current effective version number of each rule in the rule repository corresponding to the SpEL and Drools rule engines, and to create a snapshot of the current version.
[0039] The advantages of this setup are that it allows for pre-compilation and caching of rules in the enabled state, as well as the synchronization of version information. This improves the performance of the rule engine in processing business requests and better enables the maintenance of different version snapshots, thereby allowing for more flexible switching operations between different version snapshots.
[0040] Optionally, the step of obtaining and processing the current encapsulated business request from a preset rule repository based on the compiled rule execution paths corresponding to the target rule engine to obtain a target business request processing result includes: obtaining and determining at least one target rule execution path corresponding to the current encapsulated business request from a preset rule repository based on the compiled rule execution paths corresponding to the target rule engine; processing the current encapsulated business request sequentially using each target rule execution path to obtain an initial business request processing result; converting the initial business request processing result using a preset result standardization format conversion method to obtain a target business request processing result; and feeding back the target business request processing result to the target calling business application system.
[0041] In this embodiment, after determining the target rule engine, it is necessary to obtain the compiled rule execution paths corresponding to the target rule engine. Then, it is necessary to determine one or more target rule execution paths corresponding to the current encapsulated business request, and further use each target rule execution path to process the current encapsulated business request to obtain the initial business request processing result.
[0042] For example, assuming the target rule engine is the SpEL rule engine, pre-compiled SpEL rule execution paths can be retrieved from the cache, along with executable Expression objects corresponding to different rules. The EvaluationContext of the fact object corresponding to the currently encapsulated business request is then executed to generate the initial business request processing result. Alternatively, assuming the target rule engine is the Drools rule engine, pre-compiled Drools rule execution paths need to be retrieved from the cache. The fact object corresponding to the currently encapsulated business request can be inserted into the KieSession instance, and the fireAllRules() method can be called to trigger all matching rules. The executed results can then be retrieved from the session, thus generating the initial business request processing result.
[0043] Furthermore, regardless of whether the business request processing result returned by the SpEL rule engine or the business request processing result returned by the Drools rule engine, it is necessary to use the result standardization format conversion method to perform standard format conversion to obtain the target business request processing result. The target business request processing result needs to be fed back to the target calling business application system, that is, the obtained result needs to be fed back to the calling business application system A.
[0044] The advantage of this setup is that it solves the problem of inflexible and inefficient business request processing caused by using a single rules engine architecture, thereby improving the flexibility and efficiency of business request processing.
[0045] Optionally, the system further includes: a version information synchronization module for recording the current effective version number of each rule in the rule repository corresponding to the SpEL rule engine and the Drools rule engine, and establishing a current version snapshot; a change monitoring module for monitoring change information in the rule repository and switching to a new version snapshot through atomic operations when a change is detected; wherein, if a new rule has an anomaly in the current version snapshot, a version switch is performed based on at least one established historical version snapshot.
[0046] In this embodiment, a change monitoring module needs to be set up in the business request processing system to monitor changes in the rule repository, such as rule content updates and version releases. This system employs a double-buffering mechanism, loading and validating new rules in the background, and switching version references through atomic operations to achieve rule updates without restarting the service. If a new rule encounters an issue, it supports one-click rollback to any historical version. The system reloads the rule from the historical version snapshot based on the version number and applies it immediately.
[0047] Additionally, it includes lifecycle management and monitoring functions. Specifically, it can record all rule execution logs, change history, and version switching operations for auditing and troubleshooting. It can also monitor engine calls, performance, and rule hit rates, providing data support for optimization.
[0048] The advantage of this setup is that by configuring the version information synchronization module and the change monitoring and processing module, rule versions can be effectively managed, and traceability operations can be effectively implemented when rules change, thereby improving the flexibility and effectiveness of business request processing.
[0049] The technical solution of this invention, after confirming the completion of the business request processing system initialization, acquires and parses the current business request to be processed in real time, obtains the current encapsulated business request through a preset business parameter encapsulation method, and analyzes and matches the current encapsulated business request through a pre-set hybrid rule engine decision method to determine the target rule engine; wherein, the target rule engine is the SpEL rule engine or the Drools rule engine; in a preset rule repository, the current encapsulated business request is processed according to the compiled rule execution paths corresponding to the target rule engine to obtain the target business request processing result. This solves the problem of inflexible and inefficient business request processing caused by using a single rule engine architecture, improves the flexibility and efficiency of business request processing, and can effectively manage rule versions, enabling effective traceability when rules change.
[0050] Example 2 Figure 2 This is a schematic diagram of a business request processing device based on a hybrid rule engine, provided in Embodiment 2 of the present invention. The business request processing device based on a hybrid rule engine provided in this embodiment can be implemented through software and / or hardware, and can be configured in a terminal device or server to implement a business request processing method based on a hybrid rule engine according to an embodiment of the present invention. Figure 2 As shown, the device includes: a current encapsulated business request determination module 210, a target rule engine determination module 220, and a target business request processing result determination module 230.
[0051] Among them, the current encapsulated business request determination module 210 is used to obtain and parse the current business request to be processed in real time after confirming that the business request processing system has completed initialization, and obtain the current encapsulated business request through the preset business parameter encapsulation method. The target rule engine determination module 220 is used to analyze and match the currently encapsulated business request through a pre-set hybrid rule engine decision method to determine the target rule engine; The target rule engine is either the SpEL rule engine or the Drools rule engine; The target business request processing result determination module 230 is used to obtain from a preset rule repository and process the currently encapsulated business request according to the execution paths of each rule that has been compiled and corresponds to the target rule engine, so as to obtain the target business request processing result.
[0052] The technical solution of this invention, after confirming the completion of the business request processing system initialization, acquires and parses the current business request to be processed in real time, obtains the current encapsulated business request through a preset business parameter encapsulation method, and analyzes and matches the current encapsulated business request through a pre-set hybrid rule engine decision method to determine the target rule engine; wherein, the target rule engine is the SpEL rule engine or the Drools rule engine; in a preset rule repository, the current encapsulated business request is processed according to the compiled rule execution paths corresponding to the target rule engine to obtain the target business request processing result. This solves the problem of inflexible and inefficient business request processing caused by using a single rule engine architecture, improves the flexibility and efficiency of business request processing, and can effectively manage rule versions, enabling effective traceability when rules change.
[0053] Based on the above embodiments, the current encapsulated business request determination module 210 can be specifically used to: parse the currently pending business request obtained in real time to obtain current business request parameters; obtain current context joint description information corresponding to the current pending business request; wherein, the current context joint description information includes at least one of the following: information of the currently calling business application system, information of the current business request user, and description information of current environment variables; encapsulate the current business request parameters into a fact object using a preset business parameter encapsulation method, and inject the current context joint description information into the encapsulated current business request description parameters to obtain the current encapsulated business request.
[0054] Based on the above embodiments, the target rule engine determination module 220 can be specifically used to: obtain the number of execution rule conditions, the complexity of execution rule logical operators, and the nesting depth of execution rules corresponding to the current encapsulated business request; calculate the complexity of the number of execution rule conditions, the complexity of execution rule logical operators, and the nesting depth of execution rules using a preset execution rule complexity analysis method to obtain the current execution rule complexity weight value; and determine the target rule engine corresponding to the current encapsulated business request based on the current execution rule complexity weight value using the hybrid rule engine decision method.
[0055] Based on the above embodiments, the target rule engine determination module 220 can also be specifically used to: obtain a preset rule engine complexity weight value threshold; and through the hybrid rule engine decision method, if the complexity weight value of the currently executed rule is less than the rule engine complexity weight value threshold, determine the target rule engine corresponding to the currently encapsulated business request as the SpEL rule engine; if the complexity weight value of the currently executed rule is not less than the rule engine complexity weight value threshold, determine the target rule engine corresponding to the currently encapsulated business request as the Drools rule engine.
[0056] Based on the above embodiments, the system further includes a business request processing system initialization operation module, which can be specifically used to: after confirming that the business request processing system has completed initialization, before acquiring and parsing the current business request to be processed in real time, and obtaining the current encapsulated business request through a preset business parameter encapsulation method, initialize the expression parser corresponding to the SpEL rule engine and the KieSession session pool corresponding to the Drools rule engine in the target version snapshot of the rule repository in the business request processing system; wherein, the configuration parameters corresponding to each calling business application system are connected to the rule repository; each rule in the enabled state corresponding to the SpEL rule engine and the Drools rule engine is acquired, and each rule in the enabled state is compiled to obtain the execution path of each rule and stored, so as to complete the initialization operation of the business request processing system; wherein, the SpEL rule engine compiles each rule of type SpEL into an executable Expression object to obtain the corresponding execution path of each rule; the Drools rule engine loads each rule of type Drools into KieBase and compiles and creates KieSession instances corresponding to each rule.
[0057] Based on the above embodiments, the target business request processing result determination module 230 can be specifically used to: obtain from a preset rule repository and determine at least one target rule execution path corresponding to the current encapsulated business request based on the compiled rule execution paths corresponding to the target rule engine; process the current encapsulated business request sequentially using each target rule execution path to obtain an initial business request processing result; convert the initial business request processing result using a preset result standardization format conversion method to obtain a target business request processing result; and feed back the target business request processing result to the target calling business application system.
[0058] Based on the above embodiments, it can also be specifically used in the following ways: the business request processing system includes a version information synchronization module, which records the current effective version number of each rule in the rule repository corresponding to the SpEL rule engine and the Drools rule engine, and establishes a current version snapshot; the business request processing system includes a change monitoring processing module, which monitors change information in the rule repository, and when it is determined that change information has been monitored, switches to a new version snapshot through atomic operations; wherein, if there is an anomaly in the new rule in the current version snapshot, the version switch is performed based on at least one established historical version snapshot.
[0059] The business request processing device based on a hybrid rule engine provided in the embodiments of the present invention can execute the business request processing method based on a hybrid rule engine provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0060] Example 3 Figure 3 A schematic diagram of an electronic device 10, which can be used to implement Embodiment 3 of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0061] like Figure 3 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0062] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0063] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, central processing unit (CPU), graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 executes the various methods and processes described above, such as business request processing methods based on a hybrid rule engine.
[0064] In some embodiments, the hybrid rule engine-based business request processing method can be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the hybrid rule engine-based business request processing method described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to execute the hybrid rule engine-based business request processing method by any other suitable means (e.g., by means of firmware).
[0065] The method includes: after confirming that the business request processing system has completed initialization, acquiring and parsing the current business request to be processed in real time, obtaining the current encapsulated business request through a preset business parameter encapsulation method; analyzing and matching the current encapsulated business request through a preset hybrid rule engine decision method to determine the target rule engine; wherein the target rule engine is a SpEL rule engine or a Drools rule engine; acquiring and processing the current encapsulated business request in a preset rule repository according to the compiled rule execution paths corresponding to the target rule engine to obtain the target business request processing result.
[0066] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0067] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0068] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0069] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0070] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0071] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0072] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0073] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
[0074] Example 4 Embodiment 4 of the present invention also provides a computer-readable storage medium, wherein the computer-readable instructions, when executed by a computer processor, are used to execute a business request processing method based on a hybrid rule engine. The method includes: after confirming that the business request processing system has completed initialization, acquiring and parsing the current business request to be processed in real time; obtaining the current encapsulated business request through a preset business parameter encapsulation method; analyzing and matching the current encapsulated business request through a preset hybrid rule engine decision method to determine the target rule engine; wherein the target rule engine is a SpEL rule engine or a Drools rule engine; acquiring and processing the current encapsulated business request in a preset rule repository according to the compiled rule execution paths corresponding to the target rule engine to obtain the target business request processing result.
[0075] Of course, the computer-executable instructions provided in the embodiments of the present invention, which include a computer-readable storage medium, are not limited to the method operations described above, but can also execute related operations in the business request processing method based on a hybrid rule engine provided in any embodiment of the present invention.
[0076] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This 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, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0077] It is worth noting that in the above embodiments of the business request processing method based on the hybrid rule engine, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.
[0078] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A business request processing method based on a hybrid rule engine, characterized in that, include: After confirming that the business request processing system has completed initialization, the system acquires and parses the current business request to be processed in real time, and obtains the current encapsulated business request through the preset business parameter encapsulation method. The target rule engine is determined by analyzing and matching the currently encapsulated business request through a pre-set hybrid rule engine decision method. The target rule engine is either the SpEL rule engine or the Drools rule engine; In the preset rule repository, the currently encapsulated business request is processed according to the compiled rule execution paths corresponding to the target rule engine, and the target business request processing result is obtained.
2. The method according to claim 1, characterized in that, The real-time acquisition and parsing of the current pending business request, and the obtaining of the current encapsulated business request through a preset business parameter encapsulation method, includes: The currently pending business requests, which are obtained in real time, are parsed to obtain the current business request parameters; Obtain the current context joint description information corresponding to the current pending business request; wherein, the current context joint description information includes at least one of the following: information of the current calling business application system, information of the current business requesting user, and current environment variable description information; The current business request parameters are encapsulated into a fact object using a preset business parameter encapsulation method, and the current context joint description information is injected into the encapsulated current business request description parameters to obtain the current encapsulated business request.
3. The method according to claim 2, characterized in that, The step of analyzing and matching the currently encapsulated business request using a pre-set hybrid rule engine decision-making method to determine the target rule engine includes: Obtain the number of execution rule conditions, the complexity of execution rule logical operators, and the nesting depth of execution rules corresponding to the current encapsulated business request; By using a preset execution rule complexity analysis method, the complexity of the number of execution rule conditions, the complexity of execution rule logical operators, and the nesting depth of execution rules are calculated to obtain the current execution rule complexity weight value. Based on the complexity weight value of the current execution rule, the target rule engine corresponding to the current encapsulated business request is determined through the hybrid rule engine decision method.
4. The method according to claim 3, characterized in that, The step of determining the target rule engine corresponding to the currently encapsulated business request based on the complexity weight value of the current execution rule, through the hybrid rule engine decision method, includes: Obtain the preset threshold value for the complexity weight of the rule engine; Using the hybrid rule engine decision method, if the complexity weight value of the currently executed rule is less than the rule engine complexity weight value threshold, then the target rule engine corresponding to the currently encapsulated business request is determined to be the SpEL rule engine. If the complexity weight value of the current execution rule is not less than the complexity weight value threshold of the rule engine, then the target rule engine corresponding to the current encapsulated business request is determined to be the Drools rule engine.
5. The method according to claim 1 or 4, characterized in that, Before the process of acquiring and parsing the current pending business request in real time after confirming that the business request processing system has completed initialization, and obtaining the currently encapsulated business request through a preset business parameter encapsulation method, the process further includes: In the business request processing system, the expression parser corresponding to the SpEL rule engine in the target version snapshot in the rule repository and the KieSession session pool corresponding to the Drools rule engine are initialized respectively. The configuration parameters corresponding to each calling business application system are obtained and then connected to the rule repository. The system retrieves the rules that are enabled for the SpEL rule engine and the Drools rule engine, compiles each enabled rule, obtains the execution path of each rule, and stores it to complete the initialization operation of the business request processing system. Specifically, the SpEL rule engine compiles each SpEL type rule into an executable Expression object to obtain the corresponding rule execution path; the Drools rule engine loads each Drools type rule into KieBase and compiles and creates KieSession instances corresponding to each rule.
6. The method according to claim 5, characterized in that, The step of retrieving and processing the currently encapsulated business request from a preset rule repository, based on the compiled rule execution paths corresponding to the target rule engine, to obtain the target business request processing result includes: In the preset rule repository, obtain and determine at least one target rule execution path corresponding to the currently encapsulated business request based on the compiled rule execution paths corresponding to the target rule engine; The current encapsulated business request is processed sequentially using each target rule execution path to obtain the initial business request processing result; The initial business request processing result is converted using a preset result standardization format conversion method to obtain the target business request processing result; The processing result of the target business request is fed back to the target calling business application system.
7. The method according to claim 6, characterized in that, Also includes: The business request processing system includes a version information synchronization module, which is used to record the current effective version number of each rule in the rule repository corresponding to the SpEL rule engine and the Drools rule engine respectively, and to establish a current version snapshot; The business request processing system includes a change monitoring module, which is used to monitor change information in the rule repository and, upon detecting a change, switch to a new version snapshot through atomic operations. Specifically, if there are any anomalies in the new rules in the current version snapshot, the version will be switched based on at least one historical version snapshot.
8. A business request processing device based on a hybrid rule engine, characterized in that, include: The current encapsulated business request determination module is used to obtain and parse the current business request to be processed in real time after confirming that the business request processing system has completed initialization, and obtain the current encapsulated business request through the preset business parameter encapsulation method; The target rule engine determination module is used to analyze and match the currently encapsulated business request through a pre-set hybrid rule engine decision method to determine the target rule engine; The target rule engine is either the SpEL rule engine or the Drools rule engine; The target business request processing result determination module is used to obtain from a preset rule repository and process the currently encapsulated business request according to the execution paths of each rule that has been compiled and corresponds to the target rule engine, so as to obtain the target business request processing result.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements a business request processing method based on a hybrid rule engine as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute a business request processing method based on a hybrid rule engine as described in any one of claims 1-7.
Citation Information
Patent Citations
Service rule matching processing method and device and processing equipment
CN108628947A
Rule engine implementation method and system based on JIT real-time compiling
CN111930366A
Engineering practice rule management method and device and readable storage medium
CN117132223A
Configuration and application method and device of user decision engine, medium and program product
CN118535246A
Data anomaly analysis method for equipment providing edge computing service
CN119363555A