![]() |
![]() |
External Rules |
|
|
|
|
|
Rules defined in Database, Java, GUI, and custom Data Sources |
|
|
|
|
With external rules you may keep the business parts of your rules in any external source while the technical part (Java snippets) will remain in an Excel-based template, depending on which actual rules will be created by the OpenRulesEngine. For example, you may keep your rules in a regular database table as long as its structure corresponds to the columns (conditions and actions) of an Excel template. Thus, the standard DB management tools, or even your own GUI that maintains these DB-based rule tables, become your de-facto rules management environment. The external rules may also support a preferred distribution of responsibilities between technical and business people. The business rules can be kept and maintained in a database or other external source by business analysts while developers can continue to use Excel and Eclipse to maintain rule templates and related software interfaces. Starting with the release 5.3 OpenRules provides a generic Java API for adding business rules defined in different external sources. There is a special constructor
that has an additional parameter of the predefined Java type ExternalRules. You may create an object of this type such as
and then add different rule tables using the method:
The complete API is described at OpenRules API. This simple interface gives a developer the ability to bring rules from any external source and add them to OpenRulesEngine as regular Java objects. If the rules in the external source are changed, a developer may notify the ExternalRules object about this fact by using the method
Then during the next rule engine's run, all rules will be dynamically reloaded. OpenRules provides 5 sample projects that demonstrate how to use External Rules:
These projects can be found in the standard OpenRules installation under the section "External Rules". Click to the proper links above to read step-by-step instructions about these projects. External rules can be invoked from regular rules described in Excel files. Because these external rules are not known until run-time, OpenRules' Validator will produce warnings about the as yet unknown rules, but the OpenRulesEngine will still execute them without problems. To suppress the warnings and to keep track of all participating rules, you may fill out a newly introduced optional table of the type "ExternalRules" that lists names of all external rules along with their templates as in the following example:
|
|
|||||||||||||||||||||||||||
| Copyright © 2004-2010 OpenRules, Inc. All rights reserved | ||||||||||||||||||||||||||||||