Search code examples
jbossdrools

Orderly execution of multiple rule defined in one DRL file


I defined multiples rules in one DRL file, how to set order, want to execute one after another (top to bottom).


Solution

  • 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