CN113568610B - Method for implementing business rule engine library system of electric power marketing system - Google Patents

Method for implementing business rule engine library system of electric power marketing system Download PDF

Info

Publication number
CN113568610B
CN113568610B CN202111139281.5A CN202111139281A CN113568610B CN 113568610 B CN113568610 B CN 113568610B CN 202111139281 A CN202111139281 A CN 202111139281A CN 113568610 B CN113568610 B CN 113568610B
Authority
CN
China
Prior art keywords
rule
engine
service
business
execution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111139281.5A
Other languages
Chinese (zh)
Other versions
CN113568610A (en
Inventor
唐文升
丁晓
许道强
方学民
邓君华
左强
殷勇
李志新
丁泽诚
周红勇
赵双双
朱妍
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
State Grid Jiangsu Electric Power Co ltd Marketing Service Center
State Grid Corp of China SGCC
State Grid Jiangsu Electric Power Co Ltd
Original Assignee
State Grid Jiangsu Electric Power Co ltd Marketing Service Center
State Grid Corp of China SGCC
State Grid Jiangsu Electric Power Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by State Grid Jiangsu Electric Power Co ltd Marketing Service Center, State Grid Corp of China SGCC, State Grid Jiangsu Electric Power Co Ltd filed Critical State Grid Jiangsu Electric Power Co ltd Marketing Service Center
Priority to CN202111139281.5A priority Critical patent/CN113568610B/en
Publication of CN113568610A publication Critical patent/CN113568610A/en
Application granted granted Critical
Publication of CN113568610B publication Critical patent/CN113568610B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/544Remote
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

A method for realizing a business rule engine library system of a power marketing system comprises the steps of collecting a business data object of the power marketing system and configuring an authority model; designing a rule engine based on a Drools framework; classifying the rules in the rule base according to the service types, and designing and configuring interfaces of the rule base; execution of a rules engine; and packaging the components of the rule engine into each micro-service component to realize the distributed deployment and independent operation calling of the rule engine. A rule engine and a task micro-service are loaded in a program package, a workflow engine calls the task micro-service and transmits service data, a memory of the micro-service loads the service data and calls a corresponding rule engine, and the rule engine calls a rule set in a rule base and executes a rule expression by combining the service data; the workflow engine and the rule engine are unified, so that the code reuse rate is obviously improved, the channel operation efficiency is improved, the investment is reduced, and the cost is saved.

Description

Method for implementing business rule engine library system of electric power marketing system
Technical Field
The invention belongs to the technical field of computer application, relates to a micro-service architecture, a rule base, a rule engine and a service arrangement visualization technology, and particularly relates to an implementation method of a business rule engine base system of an electric power marketing system.
Background
The current marketing system has planned and realized an automatic operation model, a service rule base and the like on the premise of fully considering marketing service characteristics and technical realization requirements, and is applied to service scenes such as electric charge calculation and distribution process automation, financial fund pipelining automatic blending and the like according to design assumption. However, each product is subjected to special processing in consideration of non-functional requirements during specific implementation, such as high performance of electricity charge calculation, so that the design and implementation general capability of the rule engine is limited. In addition, the business rule verification of the business expansion product is realized by adopting a static business rule class, so that the problems of code dispersion, insufficient dynamic regulation capability of the rule and the like exist. These problems also highlight the problems of the rule engine base technology, such as insufficient general adaptability and weak system automation processing capability, and in order to better improve the high availability, high reusability and operation stability of the marketing system, the rule engine base technology is improved by adopting a micro-service architecture.
The rule engine is a component embedded in the application program, and realizes the separation of business decisions from the application program code and the writing of business decisions by using predefined semantic modules. And receiving data input, interpreting business rules, and making business decisions according to the business rules. The rule engine is a process from the business design of the business rules to the technical scheme design of the business rules to the realization of the information of the specific software.
The micro-service is an emerging software architecture style, and in a micro-service system structure, the application can be decomposed into a plurality of services with smaller granularity, and each service can be independently developed and deployed by different teams in parallel. When a system adopts a micro-service architecture, the original service may not change, but the system is already split into a plurality of new micro-services, and compared with the traditional architecture, the micro-service architecture is more dependent on the cooperation among the micro-services to realize a complete service flow.
Disclosure of Invention
In order to solve the defects in the prior art, the invention aims to provide a method for realizing a business rule engine library system of an electric power marketing system, which aims to reduce code redundancy and simplify code logic for program coding, improve business rule arrangement flexibility, simplify product development, realize coding difficulty and the like, sort and optimize early-stage rule engine design results, and unify workflow engines and business rule engine codes into one engine design for realization.
The invention adopts the following technical scheme.
A method for realizing a business rule engine library system of a power marketing system comprises the following steps:
step 1, acquiring a service data object of a power marketing system and configuring a permission model;
step 2, designing a rule engine based on a Drools framework; classifying the rules in the rule base according to the service types, and designing and configuring interfaces of the rule base;
step 3, executing a rule engine;
and 4, packaging the components of the rule engine into each micro-service component to realize distributed deployment and independent operation and calling of the rule engine.
Preferably, in step 1, the service data of the power marketing system includes user information, service information and cost information;
the permission model is realized through an Oracle database, and the configuration permission model comprises a configuration permission parameter table, a role permission relation table, a personnel permission relation table and a permission application table.
Preferably, step 2 comprises:
step 2.1, designing a rule engine and a rule base based on a Drools framework, and classifying rules in the rule base according to business types;
2.2, designing an application program interface of the rule base by adopting JSR94 standard;
step 2.2, configuring the service data object in the rule base, namely configuring the Java object as a static service data object, and configuring an object generated by dynamic construction after acquiring data by calling interfaces of other micro services as a dynamic service data object;
step 2.3, configuring the service rule factors in the rule base, namely configuring the combination of the service data object and the logic judgment as service comparison rule factors, and configuring the service execution rule factors as the execution state of the service execution rule factors is completed when the state flags of all the mandatory required preposed service execution rule factors are completed;
and 2.4, configuring the execution scene text description, the business rule factors and the execution sequence of the business rules into the scene rules in the rule base through a front-end framework of the rule editor.
Preferably, step 3 comprises:
step 3.1, loading the rule set in the rule base into an engine actuator by using a rule loader, and analyzing each rule;
step 3.2, matching the business data object with the existing rules in the rule base, finding data which accord with the inference mechanism of the rule set from the business data object, and activating the successfully matched rules;
3.3, generating a rule execution instance by using the activated rule, and putting the instance into a rule schedule to be executed; if the activated rule has branches, putting the corresponding instances into a rule schedule according to the activation sequence;
step 3.4, executing the rule execution examples one by one according to the priority sequence in the rule schedule;
and 3.5, if the exception occurs in the execution process, ending the execution process according to a set return mode.
Further, the rule execution instance generated in step 3.3 includes: the rule execution instance for data generation conforming to the inference mechanism originally does not conform to the inference mechanism, but conforms to the rule execution instance for data generation conforming to the inference mechanism after the preamble rule is executed.
Further, step 3.3 also includes, revoking the failed rule execution instance from the rule execution queue; the failed rule execution instance is a rule execution instance of data generation which originally conforms to the inference mechanism but does not conform to the inference mechanism after the preamble rule is executed.
Further, in step 3.5, the set return mode includes: merging and actively throwing out, merging and not throwing out, unfixing and actively throwing out, unfixing and not throwing out;
merging means that output results of all business rule factors are output in a merged form, and the merge includes: all pass, part pass;
the throwing refers to throwing the executed result in a form of business exception when the execution result of the business rule factor is true, and interrupting the execution of the current scene.
Preferably, step 4 comprises:
step 4.1, packaging the components of the rule engine into each micro-service component to realize that the rule engine and the micro-service are loaded in a program package;
step 4.2, deploying the rule base on a cloud platform;
4.3, the workflow engine calls the microservice and transmits the business data object through a remote procedure call protocol;
step 4.4, the JVM memory of the microservice loads the business data object and calls a rule engine;
and 4.5, the rule engine calls a rule base deployed on the cloud platform through a remote procedure call protocol and executes a rule expression in combination with the service data object.
Compared with the prior art, the method has the advantages of obviously improving the code reuse rate, improving the channel operation efficiency, reducing unnecessary investment of manpower, material resources and the like, and saving more development and operation cost for enterprises.
Drawings
FIG. 1 is a schematic structural diagram of a business rule engine library system of an electric power marketing system according to the present invention;
fig. 2 is a block diagram illustrating steps of a method for implementing a business rule engine library system of a power marketing system according to the present invention.
Detailed Description
The present application is further described below with reference to the accompanying drawings. The following examples are only for illustrating the technical solutions of the present invention more clearly, and the protection scope of the present application is not limited thereby.
Referring to fig. 1, a business rules engine library system of a power marketing system includes: the system comprises a task micro-service, a workflow engine, a rule base, a rule engine API bus, a rule visual editor and a workflow visual editor;
the task micro-service is connected with the rule base through a rule engine API bus by a rule engine, and the rule visual editor is connected with the rule base through the rule engine API bus; the workflow visualization editor is connected with the workflow engine through a rule engine API bus, and the workflow engine is respectively connected with each task microservice through the rule engine API bus;
a rule engine and a task micro-service are loaded in a program package, a workflow engine calls the task micro-service and transmits service data, a memory of the micro-service loads the service data and calls a corresponding rule engine, and the rule engine calls a rule set in a rule base and executes a rule expression by combining the service data; wherein, the workflow engine and the rule engine are unified into one engine.
The task micro-service is used for completing a single task in the business process; each task microserver faces JVM memory object, service data object and service activity object.
In the preferred embodiment of the present invention, a JVM memory object refers to an object loaded into a memory by a microservice during operation, and mainly comes from input of a front-end interface and transmission data between the microservices; the JVM memory object mainly includes a service data object and a service activity object, the service data object refers to data generated in a service process, and the service activity object refers to operation records of a service, such as whether to confirm or not to pass, and the like.
And the workflow engine is used for driving the micro-services to run according to a set flow, transmitting business data among the task micro-services and controlling the running state of the micro-services based on a remote procedure call protocol.
In the preferred embodiment of the present invention, the workflow engine is a program that drives the workflow model to run according to a predetermined flow, and is responsible for information transfer and control between microservices. The functions of the method include arranging the calling relation of each micro service, transmitting information, monitoring the state of a workflow, providing a mechanism for processing service failure and the like. The workflow engine framework is realized by adopting a Flowable framework, and the cooperation relationship among the microservices is configured through an XML file. Each microservice has a unique id, which is used as a unique identifier in the XML file to operate the microservice. The Remote Procedure Call Protocol (RPC) calls are made between microservices using the FlowableRestfulAPI. An interface triggers an event to form a scene, and the interface transmits data in an interface service data object to the micro-service through an event interface; after receiving the data, splitting the data according to the service object; after the splitting is finished, executing interface calling according to an Api-Flows affair member program sequence; before the interface is called, mapping data in the corresponding service data object to a middle API (application programming interface), and realizing data transmission at the back end; and finally returning the result to the front-end interface after the Flow execution node returns. Because the Flowable self-contained flow establishing frame Modeler is compiled by Angular. js, and the transformation difficulty is high, the front-end interface adopts a bpmn. js frame, the flow is designed by a visual interface, xml is exported, and then the xml is transmitted to a flow engine to execute configuration. Once the process is started and executed, the object is used as a context parameter, each micro-service needs to realize an IPprocessor interface, a rollback () method is designed at the IPprocessor interface, and when an exception occurs in the processing process of one node of a task in the process, the service which needs to be called rolls back, so that an exception handling mechanism is realized.
The workflow model adopts a micro-service architecture, the realization of tasks and the cooperation relation of the tasks are separated, each task is independently deployed into one micro-service, and only the atomic logic code of the micro-service is realized. When the new logic needs to multiplex the existing task nodes, only the calling sequence of the microservice needs to be adjusted, and the existing codes do not need to be modified. The business arrangement of the workflow model adopts an Orestration mode, so a workflow engine is needed to provide a flow control service.
The workflow visualization editor is used for configuring the workflow; the workflow file exported from the workflow visualization editor is passed to the workflow engine for execution.
The rule visualization editor comprises a rule editor and a rule debugging tool; the rule editor is used for designing business rule factors and scene rules and writing the business rule factors and the scene rules into the rule base, the rule debugging tool is used for changing the existing business rule factors and the existing scene rules in the rule base, and the changing operation comprises the following steps: addition, deletion and modification.
In a preferred embodiment of the present invention, the rule visualization editor is a front-end program that visually combines rule logic and passes the combined result to the rule engine for execution. The rule visualization editor is implemented using a Guvnor framework.
And the rule base is deployed at the cloud end and used for storing the business rule factors and the scene rules.
The rule engine includes: the rule loader, the engine executor and the rule inference machine; the rule loader loads scene rules in the rule base into the engine actuator based on a remote procedure call protocol, and the rule inference machine responds to the engine actuator to perform rule inference;
the engine executor comprises a rule transaction processor and a rule transaction buffer; the rule transaction processor is used for obtaining the calculation result of the rule expression, and the rule transaction buffer is used for storing the rule to be executed after the pre-rule is completed.
In the preferred embodiment of the present invention, the rule event processing is performed by: the rule library, the rule engine API bus and the rule visualization editor component.
And the data which is input by user operation and generated by automatic system processing in a service scene needs to be subjected to service rule verification before the data falls into a database. The business requirements, data constraint rules and the like in the business operation process are extracted from the business logic, the business behavior is expressed by structured business rule data and logic expressions, the business rules are stored in a rule base in a centralized mode, the rules in the rule base can be created, updated and debugged in real time, and the complex logic relationship among the business rules is processed by a rule engine. And the rule engine is a program that combines rules in the business rule base into business decisions. The rule engine accepts data input, interprets and executes the business rules, and makes decision-making judgment according to the business rules.
In the preferred embodiment of the invention, the rule engine APIs bus is responsible for information transmission among the rule base, the rule engine, the rule visualization editor and the external program and is realized by adopting the RESTful API standard based on HTTP.
As shown in fig. 2, an implementation method of a business rule engine library system of a power marketing system includes:
step 1, acquiring a service data object of a power marketing system and configuring a permission model;
step 2, designing a rule engine based on a Drools framework; classifying the rules in the rule base according to the service types, and designing and configuring interfaces of the rule base;
step 3, executing a rule engine;
and 4, packaging the components of the rule engine into each micro-service component to realize distributed deployment and independent operation and calling of the rule engine.
Specifically, in step 1, the service data of the power marketing system includes user information, service information and cost information;
the permission model is realized through an Oracle database, and the configuration permission model comprises a configuration permission parameter table, a role permission relation table, a personnel permission relation table and a permission application table. The authority model comprises role authority and personnel authority, user positions, role and authority adjustment and configurability are realized, and the content and rule range of subsequent workflow are limited.
Specifically, step 2 comprises:
step 2.1, designing a rule engine and a rule base based on a Drools framework, and classifying rules in the rule base according to business types;
2.2, designing an application program interface of the rule base by adopting JSR94 standard;
step 2.2, configuring the service data object in the rule base, namely configuring the Java object as a static service data object, and configuring an object generated by dynamic construction after acquiring data by calling interfaces of other micro services as a dynamic service data object;
wherein, the business data object includes but is not limited to: user information, service information, fee information, etc., such as a personal mobile phone number, an identification number, contract capacity, and a charge amount.
Step 2.3, configuring the service rule factors in the rule base, namely configuring the combination of the service data object and the logic judgment as service comparison rule factors, and configuring the service execution rule factors as the execution state of the service execution rule factors is completed when the state flags of all the mandatory required preposed service execution rule factors are completed;
and 2.4, configuring the execution scene text description, the business rule factors and the execution sequence of the business rules into the scene rules in the rule base through a front-end framework of the rule editor.
The step 3 comprises the following steps:
and 3.1, loading the rule set in the rule base into an engine executor by using a rule loader, and analyzing each rule.
And 3.2, matching the business data object with the existing rules in the rule base, finding data which accord with the inference mechanism of the rule set from the business data object, and activating the rules which are successfully matched.
The rule set can be understood as a scene rule, and is a set of all rules of a scene to be checked.
In the preferred embodiment of the present invention, for rule matching, the following is generally defined:
conditioning section, also known as LHS (left-hand side)
Fact part, also called RHS (right-hand side)
Assuming that there are N rules in the system, there are P patterns in the conditional part of each rule on average, and there are M facts to be processed at a certain point. The matter to be done for rule matching is: for each rule r, it is determined whether the current fact o satisfies lhs (r) = True, and if so, the instance r (o) of the rule r, i.e., rule + fact that satisfies the rule, is added to the conflict set to wait for processing.
The following procedure is generally adopted:
1. taking one r out of N rules;
2. taking a combination c of P facts from the M facts;
3. testing LHS (r) with c, and if LHS (r (c)) = True, adding RHS (r (c)) to the queue;
if there are M facts other combinations c, goto 3;
taking out the next rule r, goto 2;
3.3, generating a rule execution instance by using the activated rule, and putting the instance into a rule schedule to be executed; if the activated rule has branches, putting the corresponding instances into a rule schedule according to the activation sequence;
and 3.4, executing the rule execution examples one by one according to the priority sequence in the rule schedule.
Further, the rule execution instance generated in step 3.3 includes: the rule execution instance for data generation conforming to the inference mechanism originally does not conform to the inference mechanism, but conforms to the rule execution instance for data generation conforming to the inference mechanism after the preamble rule is executed.
Further, step 3.3 also includes, revoking the failed rule execution instance from the rule execution queue; the failed rule execution instance is a rule execution instance of data generation which originally conforms to the inference mechanism but does not conform to the inference mechanism after the preamble rule is executed.
And 3.5, if the exception occurs in the execution process, ending the execution process according to a set return mode.
Further, in step 3.5, the set return mode includes: merging and actively throwing out, merging and not throwing out, unfixing and actively throwing out, unfixing and not throwing out;
merging means that output results of all business rule factors are output in a merged form, and the merge includes: all pass, part pass;
the throwing refers to throwing the executed result in a form of business exception when the execution result of the business rule factor is true, and interrupting the execution of the current scene.
Specifically, step 4 includes:
step 4.1, packaging the components of the rule engine into each micro-service component to realize that the rule engine and the micro-service are loaded in a program package;
step 4.2, deploying the rule base on a cloud platform;
4.3, the workflow engine calls the microservice and transmits the business data object through a remote procedure call protocol;
step 4.4, the JVM memory of the microservice loads the business data object and calls a rule engine;
and 4.5, the rule engine calls a rule base deployed on the cloud platform through a remote procedure call protocol and executes a rule expression in combination with the service data object.
Example 1.
The high-voltage new-installation capacity increasing is that when a customer puts forward new installation electricity, increases the power consumption capacity agreed by contracts and finally the voltage grade reaches 10 (6) kV or above, the power supply enterprise establishes or changes an electricity customer file through the work of business acceptance, scheme establishment, measurement equipment assembly and disassembly, acceptance and power transmission and the like, and the business expansion and installation business developed by the customer for obtaining the electric power is realized.
When a business person operates the electric power marketing system, the authority model can firstly judge whether the business person and the role thereof have the authority of high-voltage new installation and capacity increase. The flow engine will then initiate the relevant microservice, for example: uploading client information, submitting client requirements, informing an application acceptance unit for transacting the call, and the like. And triggering a rule engine in each micro service, calling and executing relevant scene rules, and interrupting the flow if an error exists. For example, customer information upload microservices require verification of the system for customer profile information, ensuring one-to-one profiles. Verifying whether the arrearage is present before submitting the customer requirements, clearing the arrearage by the customer, and judging whether the incoming service application form is correct according to the customer requirements;
if the rule factor is added, the operation in the visual interface can be directly performed, for example, the client age is required to be more than 18 years old or the client score is required to be more than 1000, the user age and the user score of the business data object are selected, the judgment condition is respectively more than 18 and more than 1000, and the condition connection relationship is set as or. The rule factor may then be stored in a rule base, and the scene rules requiring the rule factor may all add the rule factor.
The present applicant has described and illustrated embodiments of the present invention in detail with reference to the accompanying drawings, but it should be understood by those skilled in the art that the above embodiments are merely preferred embodiments of the present invention, and the detailed description is only for the purpose of helping the reader to better understand the spirit of the present invention, and not for limiting the scope of the present invention, and on the contrary, any improvement or modification made based on the spirit of the present invention should fall within the scope of the present invention.

Claims (8)

1. A method for realizing a business rule engine library system of a power marketing system is characterized in that,
the method comprises the following steps:
step 1, acquiring a service data object of a power marketing system and configuring a permission model; defining the content and rule range of the workflow through a rights model;
step 2, designing a rule engine based on a Drools framework; classifying the rules in the rule base according to the service types, and designing and configuring interfaces of the rule base;
step 3, delivering the rule visualization combination result in the rule base to a rule engine for execution;
step 4, packaging the components of the rule engine into each micro-service component; the workflow engine calls task micro-services and transmits business data based on a remote process call protocol, the memory of the micro-services loads the business data and calls a corresponding rule engine, the rule engine calls a rule set in a rule base and executes a rule expression by combining the business data, and distributed deployment and independent operation call of the rule engine are realized.
2. The method of claim 1, wherein the business rules engine library system of the power marketing system,
in the step 1, the service data of the power marketing system comprises user information, service information and cost information;
the permission model is realized through an Oracle database, and the configuration permission model comprises a configuration permission parameter table, a role permission relation table, a personnel permission relation table and a permission application table.
3. The method of claim 1, wherein the business rules engine library system of the power marketing system,
the step 2 comprises the following steps:
step 2.1, designing a rule engine and a rule base based on a Drools framework, and classifying rules in the rule base according to business types;
2.2, designing an application program interface of the rule base by adopting JSR94 standard;
step 2.2, configuring the service data object in the rule base, namely configuring the Java object as a static service data object, and configuring an object generated by dynamic construction after acquiring data by calling interfaces of other micro services as a dynamic service data object;
step 2.3, configuring the service rule factors in the rule base, namely configuring the combination of the service data object and the logic judgment as service comparison rule factors, and configuring the service execution rule factors as the execution state of the service execution rule factors is completed when the state flags of all the mandatory required preposed service execution rule factors are completed;
and 2.4, configuring the execution scene text description, the business rule factors and the execution sequence of the business rules into the scene rules in the rule base through a front-end framework of the rule editor.
4. The method of claim 1, wherein the business rules engine library system of the power marketing system,
the step 3 comprises the following steps:
step 3.1, loading the rule set in the rule base into an engine actuator by using a rule loader, and analyzing each rule;
step 3.2, matching the business data object with the existing rules in the rule base, finding data which accord with the inference mechanism of the rule set from the business data object, and activating the successfully matched rules;
3.3, generating a rule execution instance by using the activated rule, and putting the instance into a rule schedule to be executed; if the activated rule has branches, putting the corresponding instances into a rule schedule according to the activation sequence;
step 3.4, executing the rule execution examples one by one according to the priority sequence in the rule schedule;
and 3.5, if the exception occurs in the execution process, ending the execution process according to a set return mode.
5. The method of claim 4, wherein the business rules engine library system of the power marketing system,
the rule execution instance generated in step 3.3 includes: the rule execution instance for data generation conforming to the inference mechanism originally does not conform to the inference mechanism, but conforms to the rule execution instance for data generation conforming to the inference mechanism after the preamble rule is executed.
6. The method of claim 4, wherein the business rules engine library system of the power marketing system,
step 3.3 further comprises, revoking the failed rule execution instance from the rule execution queue; the failed rule execution instance is a rule execution instance generated by data which originally accords with the inference mechanism but does not accord with the inference mechanism after the preamble rule is executed.
7. The method of claim 4, wherein the business rules engine library system of the power marketing system,
in step 3.5, the set return mode includes: merging and actively throwing out, merging and not throwing out, unfixing and actively throwing out, unfixing and not throwing out;
the merging refers to outputting the output results of all the business rule factors in a merged form, and includes: all pass, part pass;
the throwing refers to throwing the executed result in a form of business exception and interrupting the execution of the current scene when the execution result of the business rule factor is true.
8. The method for implementing the business rules engine library system of the electricity marketing system according to any one of claims 1 to 4,
step 4 comprises the following steps:
step 4.1, packaging the components of the rule engine into each micro-service component to realize that the rule engine and the micro-service are loaded in a program package;
step 4.2, deploying the rule base on a cloud platform;
4.3, the workflow engine calls the microservice and transmits the business data object through a remote procedure call protocol;
step 4.4, the JVM memory of the microservice loads the business data object and calls a rule engine;
and 4.5, the rule engine calls a rule base deployed on the cloud platform through a remote procedure call protocol and executes a rule expression in combination with the service data object.
CN202111139281.5A 2021-09-28 2021-09-28 Method for implementing business rule engine library system of electric power marketing system Active CN113568610B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111139281.5A CN113568610B (en) 2021-09-28 2021-09-28 Method for implementing business rule engine library system of electric power marketing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111139281.5A CN113568610B (en) 2021-09-28 2021-09-28 Method for implementing business rule engine library system of electric power marketing system

Publications (2)

Publication Number Publication Date
CN113568610A CN113568610A (en) 2021-10-29
CN113568610B true CN113568610B (en) 2022-02-25

Family

ID=78174858

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111139281.5A Active CN113568610B (en) 2021-09-28 2021-09-28 Method for implementing business rule engine library system of electric power marketing system

Country Status (1)

Country Link
CN (1) CN113568610B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115809762A (en) * 2023-02-09 2023-03-17 北京至臻云智能科技有限公司 Method and system for managing in-engineering control compliance based on rule engine

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140122396A1 (en) * 2012-10-29 2014-05-01 Qualcomm Incorporated Rules engine as a platform for mobile applications
US9575869B2 (en) * 2015-02-25 2017-02-21 Red Hat, Inc. Service implementation based debugger for service oriented architecture projects
CN107330580A (en) * 2017-05-27 2017-11-07 国家电网公司 Power marketing Base data platform construction method
US10628152B2 (en) * 2017-06-19 2020-04-21 Accenture Global Solutions Limited Automatic generation of microservices based on technical description of legacy code
CN107943963A (en) * 2017-11-27 2018-04-20 上海交通大学 Mass data distributed rule engine operation system based on cloud platform
CN109656688B (en) * 2018-12-07 2021-03-30 京东数字科技控股有限公司 Method, system and server for realizing distributed business rules
CN110048883B (en) * 2019-04-03 2022-06-07 国网福建省电力有限公司 Method for realizing comprehensive network management based on micro-service cloud architecture
CN110618820A (en) * 2019-09-20 2019-12-27 国网浙江省电力有限公司 Power dispatching system
CN111694638A (en) * 2020-05-28 2020-09-22 中国平安人寿保险股份有限公司 Rule package loading method, rule package executing method and terminal equipment
CN113395311A (en) * 2020-09-08 2021-09-14 重庆高新技术产业研究院有限责任公司 Method for constructing rule engine based on SOA and distributed deployment
CN113254061B (en) * 2021-06-02 2021-11-09 深圳前海大道金融服务有限公司 Business decision method, system and storage medium based on rule engine

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
一文读懂微服务编排利器—Zeebe;lancetang;《https://www.sohu.com/a/461025979_187948》;20210415;1-24 *
微服务架构下规则平台方案与规则迁移方法;池炜成;《现代计算机》;20210625;第142-145页 *

Also Published As

Publication number Publication date
CN113568610A (en) 2021-10-29

Similar Documents

Publication Publication Date Title
CN111147555B (en) Heterogeneous resource mixed arrangement method
CN103279840B (en) Workflow engine implement method based on dynamic language and event processing mechanism
CN101252471B (en) Distributed automatization test system and method
CN102456185B (en) Distributed workflow processing method and distributed workflow engine system
CN101201753A (en) Method for configuring and managing multimode machine supervising engine
CN113568610B (en) Method for implementing business rule engine library system of electric power marketing system
CN105678522A (en) Workflow engine and project management system based on workflow
CN110611707A (en) Task scheduling method and device
CN103164774A (en) Automobile complete vehicle development system based on workflow
CN113052696A (en) Financial business task processing method and device, computer equipment and storage medium
CN115860451A (en) Flow operation method and device, electronic equipment and storage medium
CN106897060A (en) Based on patterned data processing method and device
Rukoz et al. Faceta*: Checkpointing for transactional composite web service execution based on petri-nets
US20100042661A1 (en) Rehosting Method Which Convert Mainframe System into Open System
CN116661978A (en) Distributed flow processing method and device and distributed business flow engine
CN103971225A (en) Workflow dynamic expanding method and system
CN111130955B (en) Distributed link monitoring method based on internet credit system
CN115056234A (en) RPA controller scheduling method and system based on event driving and infinite state machine
CN115328446A (en) Method, device, equipment and medium for arranging scene flow and processing service request
CN110633077B (en) Quick development system and method based on modularization
CN115687054A (en) Self-adaptive test method and device based on service segmentation and restoration
CN102469118B (en) A kind of method and device realizing information exploitation
CN112686391A (en) Modeling method and device based on federal learning, equipment and storage medium
CN114416126B (en) Dolphinscheduler-based deployment method for intelligent recommendation training service
CN114115816A (en) Groovy dynamic script language based method for realizing dynamic layout of capability

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20220208

Address after: 210019 No.9 Aoti street, Jianye District, Nanjing City, Jiangsu Province

Applicant after: State Grid Jiangsu Electric Power Co.,Ltd. Marketing Service Center

Applicant after: STATE GRID JIANGSU ELECTRIC POWER Co.,Ltd.

Applicant after: STATE GRID CORPORATION OF CHINA

Address before: 210019 No.9 Aoti street, Jianye District, Nanjing City, Jiangsu Province

Applicant before: State Grid Jiangsu Electric Power Co.,Ltd. Marketing Service Center

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant