Centralizing Embedded Rules (Drools)

Talend ESB Studio User Guide

EnrichVersion
6.4
EnrichProdName
Talend ESB
task
Design and Development
EnrichPlatform
Talend Studio

Talend Studio provides the basis for storing and managing business rules through the integration of the Drools Business Rule Management System (BRMS). It supports the dynamic addition and removal of business rules which you can later execute in defined Jobs.

Note

Drools Guvnor, a web based business rules governance system, has been integrated in Talend Studio. With Drools Guvnor, non-technical users can quickly and easily create and modify complex business logic directly, via the Guvnor interface. For more information, see Talend Administration Center User Guide.

Through the Rules folder in the Metadata node of the Repository tree view, you can create your own personalized rules or access a file that holds predefined rules. Then you can use the tRule component to apply the encoded rules in one or more of your job designs.

For more information about using rules with the tRules component, see tRules at https://help.talend.com.

To start setting up an embedded rule, do the following:

Defining the general properties

  1. In the Repository tree view, expand the Metadata node and the Rules Management node.

  2. Right-click the Embedded Rules folder.

  3. In the contextual menu, select Create Rules to display the [New Rule...] wizard that will guide you through the steps of creating or selecting the business rules you want to use.

    Note

    The Embedded Rules files are either Drools or Excel files of .drl or .xls formats, respectively.

  4. In the [New Rule...] wizard, fill in schema generic information, such as Name and Description and click Next to open a new view on the wizard.

    For further information, see Setting up a database connection.

Uploading or creating a file

Through the [New Rule...] wizard, you can either:

  • create a rule file of Drools format in which you can store the newly created rules, or

  • connect to an existing rule file of Drools or Excel format.

Warning

When you connect to an Excel file, make sure that all occurrences of project and job names on top of the file correspond to the project you launch the Studio on and to the Job you want to use the rules in.

To create a rule file, do the following:

  1. Select the Create option to create the rule file of Drools format.

  2. In the Type of rule resource list, select the format of the file you want to create: New DRL (rule package).

  3. Click Finish to validate the operation and close the wizard. A rule editor opens in the design workspace, in which you must manually define the rules you want to use in simplified Drools language.

    The figure below shows an example of a defined rule.

To connect to an existing rule file, do the following:

  1. Select the Select option. The DRL/XSL field displays.

  2. In the Type of rule resource field, select New DRL (rule package) or New XLS (Excel) depending on the file format you want to set the path to.

  3. Click the Browse button next to the field to set the path to the rule file you want to use.

  4. Click Finish to close the wizard and open in the Studio the rule file you set the connection to.

    Note

    If you want to modify any of the rules held in the rule files, do the following:

    -For a Drools file, open the file in Talend Studio and modify the rules directly in the open file.

    -For an Excel file, open the file locally and carry out necessary modifications. Then in the Repository tree view and under Rules, right-click the file connection and select Update Xls file in the contextual menu.

    Warning

    If you modify a rule, you must close the Job using the rule and reopen it to take into accounts the new modifications.