[rules-users] rules priority

Nadav Hashimshony nadavh at gmail.com
Mon Sep 20 04:58:23 EDT 2010


Hi

Im using drools 5 with Guvnor 5
i set up 30 Technical rules and build a package to be used by my
drools-sample application.

my probelm is as followed, some rule may conflict, i want to set up a rule
order and if one rule is caught then i want the drools to stop and not
continue to try other rules.

ive use salience but it hasnt really done the trick.

example:
my rules:

rule "Rule-01"
salience 100
activation-group "group1"
...
System.Out.Println("caught rule 1")
....

rule "Rule-02"
salience 100
activation-group "group1"
...
System.Out.Println("caught rule 2")
....

rule "Rule-03"
activation-group "group2"
...
System.Out.Println("caught rule 3")
....


rule "Rule-04"
activation-group "group2"
...
System.Out.Println("caught rule 4")
....


actual result: lets say all 4 rules are cuaght, what i will see is as
followed

ACTIVATION CREATED rule:Rule-01 activationId:Rule-01 [1] declarations:
BEFORE ACTIVATION FIRED
caught rule 1
ACTIVATION CANCELLED rule:Rule-2

ACTIVATION CREATED rule:Rule-03 activationId:Rule-01 [1] declarations:
BEFORE ACTIVATION FIRED
caught rule 3
ACTIVATION CANCELLED rule:Rule-3


only one rule from each activation-group will be fired, and the first group
with the higher salience will fire first.

what i would like is it one rule was caught to stop trying? is it possible?

Thanks, Nadav.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100920/5faf4a6d/attachment.html 


More information about the rules-users mailing list