How to import rules into Drools Guvnor from an xml file
TAC (Talend Administration Center) incorporates the Drools Guvnor web application which enables business experts to easily and quickly build and change complex business rules directly via this Guvnor interface.
Drools Guvnor is a BRMS (Business Rule Management System) used to define, deploy, execute, monitor and maintain the variety and complexity of business rules. For detailed Drools documentation, see http://www.jboss.org/drools/documentation.html.
Drools Guvnor incorporated within TAC allows you to use graphical editors to create and edit business rules.
An alternative is to import rules from an existing xml file. Once the rules are imported, you can still customize or test them, and apply them to data flows in Talend Jobs.
The following introduces how to import rules defined in an xml file into Drools Guvnor in TAC.Environment
This article is applicable to:
- Talend Studio from v5.0.1 to v5.6 (inclusive)
- Talend Administration Center from v5.0.1 to v5.6 with Drools installed
1) Log into TAC. Note that only users that have the role and rights of Operation manager or Designer can access the Drools Guvnor from TAC.
2) Expand the Settings node from the Menu tree and click Configuration to open the Configuration page on the right side. Then, expand Talend suite and configure the Guvnor URL which is in the format of http://<host>:<port>/drools-guvnor/.
3) From the Menu tree, click Drools to open its web page. Make sure that Guvnor URL is correctly set on the Configuration page and your license allows the application.
Note: If you access Drools web page for the first time, you can choose to import a deposit containing sample rules. Here, No thanks is clicked.
4) On the Drools web page, expand the Administration node. Click Import Export to open its page.
5) Click Browse... to open the File Upload dialog box. Browse to the file which stores the rules to be imported into Drools Guvnor. Here, it is repository_export.xml. Click Open to close the dialog box.
6) Click Import. A dialog box appears which prompts you to confirm the import. Click OK.
7) Finally, a dialog box appears which indicates that the import is successful. Click OK to close the dialog box.
8) On the Drools web page, expand the Knowledge Bases node. Click Packages -> org -> talend -> bank. Then, click Business rule assets. You can see that all the business rules defined in the xml file (repository_export.xml) are imported.
9) Click Open to view the details of each rule. For example, CheckOldAge.
Now that the rules are imported, a Job using the tBRMS component (see the attached file tBRMS_scenario.zip) can apply the business rules to the data flow processed.Related Components
- tBRMS allows you to apply Drools business rules to an incoming flow and write the output data to an XML file.
- tRules allows you to apply business rules defined in a Drools file of .xls or .drl format on a data flow in order to filter data.
- tRuleSurvivorship creates the single representation of an entity according to business rules. This representation is called a "survivor".