Execution properties for rule tasks
You can define rule task execution properties to select the rule engine algorithm that is used to execute the rules, and refine the number and order of rules that the rule engine executes.
You specify the rule task execution properties in the Rule Task tab of the Properties view to control rule execution in different execution modes. You can choose a rule engine algorithm to execute the rules in a particular rule task, and use execution control properties to further refine the number and order of rules the rule engine should execute.
In general, the order of the rule artifacts in the list of selected rules is not guaranteed, and the list of selected rules is considered as a pool of rules to be executed. However, with Ordering set to Literal, the order of the rule artifacts selected becomes important.
| Action | Location | Description |
|---|---|---|
| Rule selection | Rule Selection tab in Properties view for rule task. | Click Edit to add and change the order of rules and rule packages by using the Select Rules dialog. |
| Runtime rule selection | Dynamic BAL, Static BAL and IRL in the Rule Selection tab of the Properties view for rule task. | Control which rules are evaluated in a rule task. |
| Execution mode | Rule Task tab in Properties view for rule task. | Specifies an execution mode for the rule task. See Changing the execution mode for details. |
| Rule task ordering | Rule Selection tab in Properties view for rule task. | The default ordering of a rule task:
See Deciding on an execution mode and Rule execution order for details. |
| Rule task exit criteria | Rule Task tab in Properties view for rule task. | Choose exit criteria specifies how rules are executed before the task terminates. See Exit criteria property for details. |
Control properties for rule tasks in execution modes
You can set specific properties to order rule tasks. These settings operate differently in each execution mode: RetePlus, Sequential, and Fastpath. See Engine execution modes for a description of each execution mode.
The following table outlines how ruleflow control properties operate in RetePlus execution mode.
| Ordering property | Exit Criteria property | Advanced Properties only |
|---|---|---|
Default A RetePlus network with full agenda management is created. |
None All the rules in the task body are activated. Rule instances are executed until the agenda is empty. Equivalent to: firing=allrules, firinglimit=0 |
firinglimit > 0: instances are executed until either the given number is reached or the agenda is empty. |
Rule Only the highest priority rule of the task body is activated. Rule instances are executed until the agenda is empty. Equivalent to: firing=rule, firinglimit=0 |
||
RuleInstance Only the highest priority rule of the task body is activated. Just the first instance of the rule is executed, or none if the agenda is empty. Equivalent to: firing=rule, firinglimit=1 |
||
Deprecated feature:
Literal A RetePlus network is created but there is no agenda. Rules are activated one by one according to the order provided by the body, and the instances are executed without reevaluation. Or: Priority A RetePlus network is created but there is no agenda. Rules are first sorted in decreasing order of priority. They are then activated one by one and the instances executed without reevaluation. |
None A loop is made on each of the rules provided in the task body, their instances computed and executed. Instances are executed until the end of the loop. Equivalent to: firing=allrules, firinglimit=0 |
firinglimit > 0: rule instances are executed until either the given number or the end of the loop is reached. |
Rule A loop is made on each rule provided in the task body. As soon as a rule can be instantiated (that is, at least one rule instance is created), all those instances are executed and the loop ends. Equivalent to: firing=rule, firinglimit=0 |
||
RuleInstance A loop is made on each rule provided in the task body. As soon as a rule can be instantiated (that is, at least one rule instance is created) that instance is executed and the loop ends. Equivalent to: firing=rule, firinglimit=1 |
The following table outlines how ruleflow properties operate in sequential execution mode.
| Ordering property | Exit Criteria property | Advanced Properties only |
|---|---|---|
Default In the sequential mode, the Default property acts the same way as the Priority property. |
||
Literal Rules are compiled according to the order provided by the task body. Rules are evaluated and executed sequentially against the incoming tuple objects. Or: Priority Rules are sorted according to their priorities. They are then compiled according to the sorted order. The rules are evaluated and executed sequentially against the incoming tuple objects. |
None All the rules provided in the task body are evaluated. All the rules evaluated as true are executed until there are no more rules to select. The order is the one determined by the ordering property. Equivalent to: firing=allrules, firinglimit=0 |
firinglimit > 0: rules evaluated as true are executed until the given number of rules is reached, or there are no more rules to select. |
Rule The rules provided in the task body are evaluated sequentially. As soon as one rule evaluates to true, it is executed and the loop ends. Equivalent to: firing=rule This property forces the firinglimit to 1. |
firinglimit Not applicable. |
|
RuleInstance Not applicable. |
||
The following table outlines how ruleflow properties operate in Fastpath execution mode.
| Ordering property | Exit Criteria property | Advanced Properties only |
|---|---|---|
Default In the Fastpath mode, the Default property acts the same way as the Priority property. |
||
Literal Rules are compiled according to the order provided by the task body. Rules are evaluated and executed sequentially against the incoming tuple objects. Or: Priority Rules are sorted according to their priority. They are then compiled according to the sort order. The rules are evaluated and executed sequentially against the incoming tuple objects. |
None All the rules provided in the task body are evaluated. All the rules evaluated as true are executed until there are no more rules to select. The order is determined by the ordering property. Equivalent to: firing=allrules, firinglimit=0 |
firinglimit > 0: rules evaluated as true are executed until the given number of rules is reached, or there are no more rules to select. |
Rule The rules provided in the task body are evaluated. As soon as one rule can be instantiated (that is, one rule instance is created), those instances are executed and the loop ends. Equivalent to: firing=rule, firinglimit=0 |
||
RuleInstance The rules provided in the task body are evaluated. As soon as one rule can be instantiated (that is, one rule instance is created), that instance is executed and the loop ends. Equivalent to: firing=rule, firinglimit=1 |
||
Rule execution order
When the rule artifacts for a rule task are selected at compile time or run time, the packages in the list of selected rules are expanded. The expansion starts at the top of the list. If a business rule is listed separately above its package, it retains its execution position in the list. However, if it is listed separately under its package, the business rule executes from the package. Under the package, the business rule is redundant because it is already in the package.
- If you add R2 and then the package, the expanded list is R2, R1 and R3.
- If you add the package and then R2, the expanded list is R1, R2 and R3.
- To force R2 to be last in the list, you must list the rules separately: R1, R3, and then R2.
Exit criteria property
- None: All the instances of all the applicable rules execute for a tuple before moving to the next tuple.
- Rule: All the rule instances of the first applicable rule execute for a tuple before moving to the next tuple.
- Rule Instance: Only the first rule instance of the first applicable rule executes for a tuple before moving to the next tuple.