Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for service processing based on a rule engine, where an object entity instance is input to the rule engine to match a rule file including an execution function of a service processing proxy class, and the execution function of the rule file is called to obtain a service processing object, so as to perform service logic processing on the service input object. In the embodiment, only the execution function of the service processing agent class is reserved in the rule file, and part of service processing logic is decoupled from the rule file into the service processing object, so that the writing quantity of the rule file is reduced, and the readability and maintainability of the rule file are improved.
To achieve the above object, according to an aspect of the embodiments of the present invention, a method for processing a service based on a rule engine is provided.
The business processing method based on the rule engine comprises the following steps: sending an object entity instance having a business input object, a business output object, and a business processing proxy object to the rules engine; matching corresponding rule files from the rule file set of the rule engine according to the object entity instance; wherein, the rule file comprises an execution function of a service processing agent class; and calling an execution function of the rule file to obtain a service processing object, performing corresponding service logic processing on the service input object through the service processing object, and packaging a service logic processing result into the service output object.
Optionally, the method further comprises: defining the service processing proxy class, the service processing encapsulation class and the service processing class; the first parameter of the execution function of the service processing proxy class is the class name of the service processing class, and the rest parameters comprise the service input object and the service output object; the parameters of the executive function of the service processing encapsulation class are aligned with the second parameters of the service processing proxy class; the service processing class is an implementation subclass of the service processing encapsulation class.
Optionally, the invoking an execution function of the rule file to obtain a service processing object includes: calling an execution function of the service processing proxy class of the rule file to obtain parameters of the execution function, wherein the first parameter is a class name of the service processing class; and acquiring the service processing object of the service processing class through a reflection mechanism according to the class name of the service processing class.
Optionally, the performing, by the service processing object, corresponding service logic processing on the service input object includes: and inputting the service input object into an execution function of the service processing object so as to perform corresponding service logic processing on the service input object.
Optionally, the method further comprises: and monitoring the update of the rule file in the rule file set through a polling mechanism so as to manage the rule file in the cache.
To achieve the above object, according to another aspect of the embodiments of the present invention, a business processing apparatus based on a rule engine is provided.
The business processing device based on the rule engine of the embodiment of the invention comprises: a sending module, configured to send an object entity instance having a service input object, a service output object, and a service processing proxy object to the rule engine; the matching module is used for matching a corresponding rule file from the rule file set of the rule engine according to the object entity instance; wherein, the rule file comprises an execution function of a service processing agent class; and the processing module is used for calling the execution function of the rule file to obtain a service processing object, performing corresponding service logic processing on the service input object through the service processing object, and packaging a service logic processing result into the service output object.
Optionally, the apparatus further comprises: the defining module is used for defining the service processing proxy class, the service processing encapsulation class and the service processing class; the first parameter of the execution function of the service processing proxy class is the class name of the service processing class, and the rest parameters comprise the service input object and the service output object; the parameters of the executive function of the service processing encapsulation class are aligned with the second parameters of the service processing proxy class; the service processing class is an implementation subclass of the service processing encapsulation class.
Optionally, the processing module is further configured to: calling an execution function of the service processing proxy class of the rule file to obtain parameters of the execution function, wherein the first parameter is a class name of the service processing class; and acquiring the service processing object of the service processing class through a reflection mechanism according to the class name of the service processing class.
Optionally, the processing module is further configured to: and inputting the service input object into an execution function of the service processing object so as to perform corresponding service logic processing on the service input object.
Optionally, the apparatus further comprises: and the monitoring module is used for monitoring the update of the rule file in the rule file set through a polling mechanism so as to manage the rule file in the cache.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided an electronic apparatus.
An electronic device of an embodiment of the present invention includes: one or more processors; the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize the business processing method based on the rule engine.
To achieve the above object, according to still another aspect of embodiments of the present invention, there is provided a computer-readable medium.
A computer-readable medium of an embodiment of the present invention stores thereon a computer program, which, when executed by a processor, implements a rule engine-based business processing method of an embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: by declaring an execution function of a business processing agent class in the rule file, part of business processing logic is transferred from the rule file to a business processing object for execution, the rule file is light and simple, the writing quantity of the rule file is reduced, and the readability and maintainability of the rule file are improved; the definition of classes and the service execution logic of the execution function are realized through a native development language (namely a programming language used when the whole system is developed), so that a developer can quickly start; the service logic is executed through the execution function of the service processing object, so that the universality can be extracted, and the repeated work can be reduced; and the updating of the rule file is monitored, so that the rule file is conveniently managed.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of main steps of a business processing method based on a rule engine according to an embodiment of the present invention. As shown in fig. 1, the method for processing a service based on a rule engine according to the embodiment of the present invention mainly includes the following steps:
step S101: and sending the object entity instance with the business input object, the business output object and the business processing proxy object to the rule engine. Different service types, such as data cleaning, data screening, etc., have different data structures of service input objects, and in order to achieve a certain commonality, the service input object and the service output object may be stored in the form of a Map Key-Value pair (Key-Value). In this step, the service input object is original service data, the service output object is a null object, and the service processing proxy object needs to be predefined according to the service type. And taking the business input object, the business output object and the business processing proxy object as object entity instances and sending the object entity instances to the rule engine.
Step S102: and matching a corresponding rule file from the rule file set of the rule engine according to the object entity instance, wherein the rule file comprises an execution function of a service processing agent class. The writing principle of the rule file in the rule file set is as follows: and filling an execution function of the service processing agent class in the rule file, and writing parameters needing to be transmitted into the rule file through the execution function without managing other service logics. The executive function of the service processing proxy class comprises a service input object and a service output object, the executive function of the service processing proxy class is called by using a rule file subsequently, parameters with variable quantity and variable data structure are transmitted, and specific service logic is defined in the service processing class due to the fact that the transmitted first parameter is the class name of the service processing class, and further specific service logic processing can be achieved through the service processing object of the service processing class. When matching the object entity instance with the rule file is realized, any one of the following modes can be adopted: and (3) directly accessing rule engines such as Drools, Easy-rules and the like by using a matching algorithm such as Rete, Tread and the like and a rule matching method written by the user.
Step S103: and calling an execution function of the rule file to obtain a service processing object, performing corresponding service logic processing on the service input object through the service processing object, and packaging a service logic processing result into the service output object. The step is that the class name of the service processing class is obtained according to the service processing proxy class in the rule file; then, according to the class name of the service processing class, acquiring a service processing object of the service processing class through a reflection mechanism; inputting the service input object into an execution function of the service processing object so as to perform corresponding service logic processing on the service input object; and packaging the obtained service logic processing result into a service output object for output.
Fig. 2 is a schematic main flow diagram of a business processing method based on a rule engine according to an embodiment of the present invention. As shown in fig. 2, the method for processing a service based on a rule engine according to an embodiment of the present invention mainly includes the following steps:
step S201: defining a service processing proxy class, a service processing encapsulation class and a service processing class, wherein the service processing class is an implementation subclass of the service processing encapsulation class. The definition of the three classes in the step is written by using a native language, such as Java language, and the method has no hand difficulty. The parameters of the execution function of the service processing proxy class comprise an input object instance and an output object instance, and are used for performing declaration filling in a rule file. The business processing encapsulation class defines an execution function comprising an input object instance and an output object instance, and the parameters of the execution function of the business processing encapsulation class are aligned with the second parameters of the business processing proxy class to transparently transmit all business parameters. And the service processing class is used for processing the service access parameter and the access parameter in the rule file to complete a specific service processing logic.
The execution function of the service processing proxy class is as follows: execute (Object … objects). The execution function is a parameter variable length function, and parameters with variable quantity and variable data structure can be transmitted through the calling of the execution function of the service processing proxy class in the rule file. The first bit of the parameter list of the execution function is a reserved bit of the class name of the service handling class.
The execution function of the service processing encapsulation class is as follows: execute (Object … objects). The parameters of the execution function are aligned with the second parameters of the service processing proxy class, i.e. if there are n parameters in the service processing proxy class, the parameters transmitted into the service processing encapsulation class are the last n-1, and the first parameter is not transmitted.
The service processing class is a subclass of the service processing encapsulation class, and according to different service logics, the implementation logics are different, the number of the service processing classes is not fixed, the cutting granularity (namely, one service logic is completed in several steps) is not fixed, but both the input parameter and the output parameter of an execution function (execute) are specified, and developers can complete the development of the service processing class according to specific service types.
In a preferred embodiment, better generality can be achieved among the service processing proxy class, the service processing encapsulation class and the service processing class through a universal cache design, a tool function and the like. Wherein the universal cache design is a singleton schema in the design module.
Fig. 3 is a schematic diagram of a relationship between a service processing proxy class, a service processing encapsulation class, and a service processing class according to an embodiment of the present invention. As shown in fig. 3, a service processing proxy class is called by using a class name of a service processing class indicated in a rule file, and a service processing object of the service processing class is obtained through a Java reflection mechanism; parameters in the business processing proxy class except the first parameter are then transmitted into an execution function of the business processing object.
In data mining, it is usually necessary to perform data preprocessing on original service data to obtain information more effectively, and the data preprocessing includes multiple services. Taking data cleaning service as an example, the service includes service types such as OneHot expansion, data standardization and the like, wherein OneHot is a coding mode. Taking data standardization as an example, the implementation code of the execution function (execute) of the service processing object may be:
step S202: and constructing a rule file set with the execution function of the business processing proxy class. The writing principle of the rule file in the rule file set is as follows: and filling an execution function of the service processing agent class in the rule file, and writing parameters needing to be transmitted into the rule file through the execution function without managing other service logics. The file format of the rule file may be a DSL file, an XML file, a YML file, or the like. Where the YML file is in a file format written in YAML (YAML Ain't Markup Language) which is a foreign Language abbreviation for "YAML is not a Markup Language".
Still taking the data cleansing service as an example, the rule file may be written in the following code:
in the above example, the file format of the rule file is a YML file, and the first 5 rows thereof are respectively a rule name, a rule description, priority information, condition information, and rule execution information. The priority information defines the priority level of the rule file, and when a plurality of rule files are matched for the target entity instance in the step, the rule files can be executed in sequence according to the priority level. The condition information defines a namespace of rnn for the input data. The class of service handling agent in the rule file is rulesExecutorUser. The execution function of the service processing proxy class includes 5 parameters, which are in turn: "com.jd.find.vector.astroboy.rule.executive.matrix.inloop.executive.normallizeexecutive \", \\ tempCurrentHostCount \ 10, 50 and "normalzecurrenthostcount \ the first parameter is the class name of the service handling class. Starting from actions to the end of the execution part of the rule file, the meaning is: and performing data standardization processing with the upper limit and the lower limit of [10, 50] on the field "tempCurrentHostCount" by using an execution function of a service processing object (namely, an object corresponding to a first parameter of the rule file). Wherein the data normalization is to scale the data to fall within a small specified interval. In an embodiment, the data normalization may be implemented by min-max normalization, and the specific formula is as follows:
y=((x-MinValue)/(MaxValue-MinValue))(new_MaxValue-new_MinValue)+new_minValue
equation 1
In the formula, y is a result after data cleaning, x is original service data, MinValue is a minimum value of the original service data, MaxValue is a maximum value of the original service data, new _ MaxValue is an upper limit of the data cleaning, and new _ MinValue is a lower limit of the data cleaning.
Step S203: and sending an object entity instance to a rule engine, wherein the object entity instance comprises a business input object, a business output object and a business processing proxy object. The rules engine in an embodiment is an Easy-rules engine. In order to achieve a certain generality, in the embodiment, the service input Object is stored in a Key-Value form, where Key is a parameter name (corresponding to \ tempCurrentHostCount \ in a rule file code), a data type of the Key is, for example, a String and a Json (JavaScript Object notification, which is a lightweight data exchange format) String, Value is a parameter Value, and a data type of the Value is a common parent Object class of Java objects. Also in consideration of generality, the service output object is also stored in a form of Key-Value, the Key (corresponding to \ normalized currenthostcount \ in the rule file code) of the service output object is derived from the parameter definition in the rule file, and the Value is derived from the subsequent service logic processing result. And the empty object of the business output object, namely the business output object sent to the rule engine, is empty.
Still taking the data cleansing service as an example, the service input object is original service data, such as original service data in Json format or String format. And finally outputting the service output object which is the field after data cleaning.
Step S204: and matching a corresponding rule file from the rule file set of the rule engine according to the object entity instance. In the embodiment, the matching of the object entity instance and the rule file is realized by directly accessing an Easy-rules rule engine. Of course, matching between the object entity instance and the rule file can be realized by using a matching algorithm and a self-written rule matching method.
The following is an implementation code of the rule matching method:
step S205: and calling an execution function of the rule file to obtain a service processing object, performing corresponding service logic processing on the service input object through the service processing object, and packaging a service logic processing result into the service output object. Calling an execution function of the service processing proxy class by using a rule file to obtain a parameter of the execution function; and acquiring the first parameter to obtain the class name of the service processing class, and then acquiring the service processing object through a reflection mechanism. Still taking the data cleaning service as an example, the implementation code for obtaining the service processing object according to the class name to perform corresponding service logic processing on the service input object through the service processing object may be:
in the above code, through a first parameter of an execution function (execute) of a service processing proxy class (ruleexecuuter user corresponding to a rule file code) in a rule file, that is, a class name of a service processing class, a service processing object (ruleexecuuter corresponding to the code in this step) of the service processing class is acquired by using a Java reflection mechanism, and the execution function (execute) of the service processing object is called to implement service logic. The specific service logic needs to be implemented by an execution function (execute) of the service processing object, that is, the data cleansing service of this embodiment needs to be implemented by the execution function (execute).
In a preferred embodiment, the rule files in the rule file set are stored in a rule cache, and the update of the rule files in the rule cache is monitored through a long connection, so that the rule files are managed conveniently. Storing the rule file in the rule cache can better receive data with larger data size or streaming data. In another preferred embodiment, the business processing object is stored, and the update of the business processing object is monitored, so as to facilitate dynamic loading.
Fig. 4 is a schematic diagram illustrating an implementation principle of a business processing method based on a rule engine according to an embodiment of the present invention. As shown in fig. 4, the implementation principle of the rule engine-based service processing method according to the embodiment of the present invention is as follows: abstracting the service logic to obtain an object entity instance and at least one rule file; inputting the object entity instance and at least one rule file into a rule engine for pattern matching; and calling the execution function of the service processing proxy class by using the matched rule file to obtain a service processing object, performing corresponding service logic processing by using the execution function of the service processing object, and packaging a service logic processing result into the service output object for output. Wherein the object entity instance, the rule file, the business process proxy class, the execution function, and the business process object are defined as described above.
According to the business processing method based on the rule engine, disclosed by the embodiment of the invention, the execution function of the business processing agent class is declared in the rule file, and part of business processing logic is transferred from the rule file to the business processing object for execution, so that the rule file is light and simple, the compiling quantity of the rule file is reduced, and the readability and maintainability of the rule file are improved; the definition of classes and the service execution logic of the execution function are realized through the native development language, so that developers can quickly get the right; the service logic is executed through the execution function of the service processing object, so that the universality can be extracted, and the repeated work can be reduced; and the updating of the rule file is monitored, so that the rule file is conveniently managed.
Fig. 5 is a schematic diagram of main modules of a business processing apparatus based on a rule engine according to an embodiment of the present invention. As shown in fig. 5, a business processing apparatus 400 based on a rule engine according to an embodiment of the present invention mainly includes:
a sending module 501, configured to send an object entity instance having a service input object, a service output object, and a service processing proxy object to the rule engine. Different service types, such as data cleaning, data screening, and the like, and different data structures of service input objects, in order to achieve a certain commonality, a Map Key Value pair (Key-Value) form may be used to store the service input object and the service output object. In the module, the service input object is original service data, the service output object is a null object, and the service processing proxy object needs to be abstracted according to a service type. And taking the business input object, the business output object and the business processing proxy object as object entity instances and sending the object entity instances to the rule engine.
A matching module 502, configured to match a corresponding rule file from a rule file set of the rule engine according to the object entity instance; wherein, the rule file comprises an execution function of the service processing agent class. The writing principle of the rule file in the rule file set is as follows: and filling an execution function of the service processing agent class in the rule file, and writing parameters needing to be transmitted into the rule file through the execution function without managing other service logics. The executive function of the service processing proxy class comprises a service input object and a service output object, the executive function of the service processing proxy class is called by using a rule file subsequently, parameters with variable quantity and variable data structure are transmitted, and specific service logic is defined in the service processing class due to the fact that the transmitted first parameter is the class name of the service processing class, and further specific service logic processing can be achieved through the service processing object of the service processing class. When matching the object entity instance with the rule file is realized, any one of the following modes can be adopted: and (3) directly accessing rule engines such as Drools, Easy-rules and the like by using a matching algorithm such as Rete, Tread and the like and a rule matching method written by the user.
The processing module 503 is configured to call an execution function of the rule file to obtain a service processing object, perform corresponding service logic processing on the service input object through the service processing object, and package a service logic processing result into the service output object. The module obtains the class name of the service processing class according to the service processing proxy class in the rule file; then, according to the class name of the service processing class, acquiring a service processing object of the service processing class through a reflection mechanism; inputting the service input object into an execution function of the service processing object so as to perform corresponding service logic processing on the service input object; and packaging the obtained service logic processing result into a service output object for output.
In addition, the rule engine-based service processing apparatus 500 according to the embodiment of the present invention may further include: a definition module and a monitoring module (not shown in fig. 5), wherein the definition module is configured to define the service processing proxy class, the service processing encapsulation class, and the service processing class according to a service type; the first parameter of the execution function of the service processing proxy class is the class name of the service processing class; the parameters of the executive function of the service processing encapsulation class are aligned with the second parameters of the service processing proxy class; the service processing class is an implementation subclass of the service processing encapsulation class. And the monitoring module is used for monitoring the update of the rule file in the rule file set through a polling mechanism so as to manage the rule file in the cache.
Fig. 6 is a schematic structural diagram of a business processing apparatus based on a rule engine according to an embodiment of the present invention. As shown in fig. 6, in the service processing apparatus based on the rule engine according to the embodiment of the present invention, the service processing module includes a service processing proxy class, a service processing encapsulation class, and a service processing class. The definition of the service processing agent class, the service processing encapsulation class and the service processing class is as described above, the module is a service logic decoupled from the engine rules, and the universality of the service processing module can be extracted along with the accumulation of development projects, so that the repeated work is reduced.
The object entity instance comprises a business processing proxy object of a business input object, a business output object and a business processing proxy class. The service input object and the service output object are jointly used as parameters of the service processing module to be transmitted, but are not generated in the service processing module, so that the service processing modules of different services can process the same data instance, and the operation of putting in/taking out the data instance for multiple times is avoided.
The rule engine comprises a rule engine instance and a rule engine agent; the rule engine instance realizes the matching of the rule instance and the object entity instance; the rule engine agent directly interacts with a data user and needs two memory examples, namely a rule example and an object entity example, on one hand, the rule engine agent encapsulates different changes caused by using the rule engine example at the bottom layer, and provides a unified calling interface for the outside at the layer; and on the other hand, the life cycle of the rule engine instance is managed, and the rule engine instance is prevented from being repeatedly established for many times. The rule engine can realize the business logic only by processing three objects in the object entity instance, and does not need to carry out additional rule definition, thereby reducing the complexity of the rule file, and increasing the readability and the maintainability of the rule file.
The rule examples comprise rule files and rule caches; the rule file can be put into storage media such as a database and the like, so that the management of the business processing device is facilitated; the rule cache is used for storing rule files so as to better receive data with larger data size or streaming data.
The cache management module comprises rule cache monitoring, rule cache management and service processing module cache; the rule cache monitoring realizes a long connection, and when a rule file in a database is updated, the rule cache monitoring informs rule cache management to carry out corresponding operation; the service processing module caches data used for storing the service processing module, and monitors updating of the module to support the requirement of dynamic loading of the data.
As can be seen from the above description, by declaring the execution function of the service processing proxy class in the rule file, part of the service processing logic is transferred from the rule file to the service processing object for execution, the rule file is light and simple, the writing quantity of the rule file is reduced, and the readability and maintainability of the rule file are increased; the definition of classes and the service execution logic of the execution function are realized through the native development language, so that developers can quickly get the right; the service logic is executed through the execution function of the service processing object, so that the universality can be extracted, and the repeated work can be reduced; and the updating of the rule file is monitored, so that the rule file is conveniently managed.
Fig. 7 illustrates an exemplary system architecture 700 of a rules engine based business process method or a rules engine based business process apparatus to which embodiments of the invention may be applied.
As shown in fig. 7, the system architecture 700 may include terminal devices 701, 702, 703, a network 704, and a server 705. The network 704 serves to provide a medium for communication links between the terminal devices 701, 702, 703 and the server 705. Network 704 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 701, 702, 703 to interact with a server 705 over a network 704, to receive or send messages or the like. Various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, and the like, may be installed on the terminal devices 701, 702, and 703.
The terminal devices 701, 702, 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 705 may be a server that provides various services, such as a background management server that processes raw service data obtained by an administrator using the terminal devices 701, 702, and 703. The background management server may perform data cleaning and other processing on the received original service data, and feed back a processing result (e.g., a data cleaning result) to the terminal device.
It should be noted that the rule engine based service processing method provided in the embodiment of the present application is generally executed by the server 705, and accordingly, the rule engine based service processing apparatus is generally disposed in the server 705.
It should be understood that the number of terminal devices, networks, and servers in fig. 7 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
The invention also provides an electronic device and a computer readable medium according to the embodiment of the invention.
The electronic device of the present invention includes: one or more processors; the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize the business processing method based on the rule engine.
The computer readable medium of the present invention stores thereon a computer program, which when executed by a processor implements a rules engine based business processing method of an embodiment of the present invention.
Referring now to FIG. 8, shown is a block diagram of a computer system 800 suitable for use in implementing an electronic device of an embodiment of the present invention. The electronic device shown in fig. 8 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 8, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the computer system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, the processes described above with respect to the main step diagrams may be implemented as computer software programs, according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program containing program code for performing the method illustrated in the main step diagram. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program executes the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 801.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a sending module, a matching module, and a processing module. Where the names of these modules do not in some cases constitute a limitation on the modules themselves, for example, a sending module may also be described as a module that sends an object entity instance having a business input object, a business output object, and a business process proxy object to the rules engine.
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: sending an object entity instance having a business input object, a business output object, and a business processing proxy object to the rules engine; matching corresponding rule files from the rule file set of the rule engine according to the object entity instance; wherein, the rule file comprises an execution function of a service processing agent class; and calling an execution function of the rule file to obtain a service processing object, performing corresponding service logic processing on the service input object through the service processing object, and packaging a service logic processing result into the service output object.
As can be seen from the above description, by declaring the execution function of the service processing proxy class in the rule file, part of the service processing logic is transferred from the rule file to the service processing object for execution, the rule file is light and simple, the writing quantity of the rule file is reduced, and the readability and maintainability of the rule file are increased; the definition of classes and the service execution logic of the execution function are realized through the native development language, so that developers can quickly get the right; the service logic is executed through the execution function of the service processing object, so that the universality can be extracted, and the repeated work can be reduced; and the updating of the rule file is monitored, so that the rule file is conveniently managed.
The product can execute the method provided by the embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method. For technical details that are not described in detail in this embodiment, reference may be made to the method provided by the embodiment of the present invention.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.