August 15, 2023

Creating the DRL rules – Docs for ESB 6.x

Creating the DRL rules

  1. In the Outputs table, click in the
    Rule column and then click the
    […] button of the
    Paris schema.

    use_case-trules_drl11.png

  2. In the open dialog box, select one of the options as the following:

    Select

    To…

    Edit Rules

    open the rule in the rule editor in the
    workspace.

    Create a rule with
    guide

    open a dialog box where you can define a rule in the
    rule template.

    select a rule from
    repository

    select a predefined rule from the rule template
    created and stored in the Repository tree view.

    In this example, select the Create a rule with
    guide
    option.
  3. In the open dialog box, use the Drools syntax to set the condition of the
    “Paris” rule as the following: zipCode
    matches "75\d{3}"
    , and then click OK.

    use_case-trules_drl12.png

    The new “Paris” rule is generated and displayed in
    the Rule column. This rule retrieves from
    the Paris schema all zip codes that start with 75 and
    the three figures that follow.
  4. Click in the Rule column and then click
    the three-dot button of the “Paris” rule.

    The rule template is opened in the rule editor in the workspace.
    use_case-trules_drl13.png

  5. In the “Paris” rule, add the code
    output.CityName = "Paris" to output
    Paris as the city name in the first output
    flow.
  6. Repeat the above steps to create a “Suresnes” rule
    and set its condition as the following zipCode ==
    "92150"
    .

    use_case-trules_drl14.png

    The new rule is displayed in the Rule
    column. This rule retrieves from the Suresnes schema
    all zip codes that are equal to 92150.
  7. In the “Suresnes” rule, add the code
    output.CityName = "Suresnes" to output
    Suresnes as the city name in the second output
    flow.
  8. In the design workspace, double-click each of the tLogRow components to define its properties.

    For more information, see tLogRow.
  9. Save your Job and press F6 to execute
    it.

    use_case-trules_drl15.png

    The Run console displays two output flows
    with zip codes and city names.
    In the first output flow, the “Paris” rule retrieves
    all zip codes that start with 75 and writes the city name as
    Paris.
    In the second output flow, the “Suresnes” rule retrieves all zip
    codes that are equal to 92150 and writes the city name as
    Suresnes.

Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x