< Previous | Next >

Task 2: Orchestrating

You create a ruleflow to set the sequence in which the rules run.

About this task

The ruleflow provides a way to set the order in which the rule engine processes rules. In Rule Designer, you use a ruleflow to orchestrate rules.

Diagram shows the use of a ruleflow to orchestrate rules.

Step 1: Creating rule packages

About this task

Before you define a ruleflow, you must organize your rules into packages that contain related rules. In this step, you create two rule packages, and then define the ruleflow for the packages.

Procedure

  1. In the Operation Map of Rule Designer, click Add rule package.
    Tip: You can also right-click the my decision service/rules folder in the Rule Explorer and click New > Rule Package.
  2. In the New Rule Package wizard, enter validation in the Package field, and then click Finish.

    The validation rule package opens in the Rule Explorer.

  3. Repeat steps 1 and 2 to create an eligibility rule package.

Results

Your rule project now contains two rule packages in which you can store rules.

Image shows the new rule packages in the Rule Explorer

Step 2: Creating the ruleflow diagram

About this task

You now design a ruleflow that creates a logical connection between the validation and eligibility rule packages. A ruleflow is a diagram that consists of several rule tasks that are connected by logical links. A ruleflow shows the sequence for running business rules.

Procedure

  1. In the Operation Map view, click Add ruleflow.
    Tip: You can also right-click the my decision service/rules folder in the Rule Explorer and click New > Ruleflow.
  2. In the New Ruleflow wizard, ensure that the Source folder field is set to /my decision service/rules, and that the Package field is empty.
  3. In the Name field, enter miniloan.
  4. Click Finish. The ruleflow editor opens.

    You now construct a ruleflow in which you specify how tasks are related. In other words, how, when, and under what conditions rules are run.

  5. Click Create a start node "", and then click in the ruleflow editing window.
  6. Click Create an end node "", and then click in the ruleflow editing window.

    You now have a start node and an end node for your ruleflow.

Step 3: Defining rule tasks

About this task

Now that you have the start and end nodes, you select the rule packages to include in the ruleflow diagram, and then you create the transitions between the packages.

Procedure

  1. Drag the validation rule package from the Rule Explorer view to the ruleflow editing window.

    The rule package becomes a rule task in the ruleflow. When you add the package, any rule that you create in the package is run by default.

  2. Drag the eligibility rule package from the Rule Explorer view to the ruleflow editing window.
  3. Click Create a transition "" and create the following transitions (shown as arrows) by clicking the first item, and then clicking the second item:
    1. Connect the start node to the validation task.
    2. Connect the validation task to the eligibility task.
    3. Connect the eligibility task to the end node.
    4. Connect the validation task to the end node.
  4. Click Layout All Nodes "" to format the ruleflow diagram.

    The ruleflow diagram shows errors on transitions to indicate that conditions are missing:

    Image shows errors in the ruleflow.
  5. Click Create a transition "" again to release the transition tool.
  6. Save your work.

Step 4: Defining the main transition

About this task

You set a transition condition so that the rules in the eligibility package are run only when data is validated.

Procedure

  1. Click the transition from validation to eligibility.

    The Properties view opens and shows the condition for this transition.

    Tip: If you cannot see the Properties view, click Window > Show View > Properties to open the Properties view.
  2. In the Properties view, enter data approved in the Label field.
  3. Ensure that Use BAL for transition condition is selected. The Business Action Language (BAL) is the language in which you write your conditions.
  4. Click in the text area, and then press Space to display the Content Assist box. Double-click the items to form the following statement: 'the loan' is approved
    Tip: You can also enter the statement directly in the text area.

    The Properties view looks as follows:

    Image shows the condition page in the properties view.

    The transition from validation to the end node is automatically set to else.

  5. Save the changes.

    Your ruleflow now looks like the following diagram:

    Ruleflow diagram

Step 5: Defining the final action

About this task

You now have transitions between your rule packages. You can also define a final action to display a message in the console that indicates the status of the loan at the end of a rule run.

Procedure

  1. Click the end node.
  2. In the Properties view, in the Final Action section, ensure Use BAL for action is selected.
  3. Click in the text area, and press Space to display the Content Assist box. Enter the following final action:

    print the approval status of 'the loan' ;

    You must add a semicolon (;) to the end of the line.

  4. Save your work and close the ruleflow editor.

Step 6: Binding the ruleflow

About this task

To use the ruleflow at run time, you must bind the ruleflow to the decision operation.

Procedure

  1. In the Operation Map view, click Bind ruleflow.
  2. In Decision Operation Overview, select Use main ruleflow in the Ruleflow section.
  3. Click <choose a ruleflow> and select my decision service/rules/miniloan.
  4. Click OK.
  5. Save your work and close the decision operation editor.

What to do next

You now have a ruleflow for your rule project. In the next task, you write an action rule.

< Previous | Next >