Reputation: 141
I defined multiples rules in one DRL file, how to set order, want to execute one after another (top to bottom).
Upvotes: 0
Views: 1718
Reputation: 38
Setting priority to rules is the best form. Use Salience to determine the priority of each rule, where a higher number denotes a higher priority. The default Salience for rules is 0, and you can give negative Salience, for example,if you want a rule to be fired last.
Upvotes: 0
Reputation: 4153
If you use salience you will be killing the rule engine, because you will be forcing the rule execution order instead of letting the engine decide. Cheers
Upvotes: 0
Reputation: 98
Rules are fired automatically when the conditions are met when the inserted facts(objects) are updated. But if in case you want to run it from top to bottom, you can set a property called salience in the rule. The value it takes is an integer. The rule with the highest salience is executed first.
rule "First name mandatory" salience 10 when (Person(firstName=="" || firstName==null)) then ... end
Upvotes: 1