Using Priority and Rank to Control Order of Rule Execution
For each RTC, the rule agenda is sorted by priority and then within priority by rank, for those rules that use the same ranking. Use of priority and rank is optional. You can also use priority without using rank.
In the rule’s Rank field (or rule attribute, in the source view), you specify a rule function that returns a double. The larger the return value, the higher the ranking. You can specify the same rule function in different rules to perform ranking across tuples of those rules. Here are the requirements:
- The rule function must have a Validity setting that includes Condition (that is, do not set it to Action Only).
- You can assign the same rule function to different rules as long as the following is true:
- The scope of the rule function includes only parameters found in all the rules that use the same function. Rank rule function scope must match the rule declaration exactly and in the same order(As with rules, primitives are not allowed.) For example, if the rule has EventA and ConceptB as the scope, the rule function must also have EventA and ConceptB (in that order) as the only two parameters.
- The parameters must be used in the same order as they appear in the rule declaration.
- The rule function must return a double value. (The default value for the Rank field is 0.0.)
Copyright © TIBCO Software Inc. All rights reserved.