0
votes

I have 3 rules in drool file.

rule1

rule2

rule3

if condition for rule1 is true then it should not execute rule2 or 3. If condition fails then it should go to next rule until the rule for which condition is true.

How to do this?

1
Don't use Drools and use a chain of if-else statements. - Esteban Aliverti
A want to avoid if else that’s why I am using drools - Shubham Randive

1 Answers

0
votes

I think "activation-group" attribute may solve your problem. According to the drools documentation it is stated like the following

Rules that belong to the same activation-group, identified by this attribute’s string value, will only fire exclusively. More precisely, the first rule in an activation-group to fire will cancel all pending activations of all rules in the group, i.e., stop them from firing.

If you want your rules to be executed sequentially you can try to give them salience attribute as well.