[rules-users] suprises when using auto-focus with salience or lock-on-active

oknuutti olli.knuuttila at gmail.com
Mon Dec 28 05:29:39 EST 2009


While evaluating Drools 5.1.0 M1, I came across two issues which strike me
somewhat undesirable. Maybe there's good reasons why they exist; perhaps I'm
missing something?

First:

If I have two agenda groups, each with a rule that has auto-focus set to
true and different saliences, the group which will get the focus first seems
to be determined by the order in which the auto-focused rules appear in the
drl-file, not by their salience.

// example snippet:
rule "rule1"
salience 0
agenda-group "group1"
auto-focus true
when
then
    System.out.println("rule1 fired");
end

rule "rule2"
salience -100
agenda-group "group2"
auto-focus true
when
then
    System.out.println("rule2 fired");
end

// output of the example:
rule2 fired
rule1 fired

If I change the salience of rule2 to 100 the result is still the same. It
seems reasonable to me that the salience would be taken into account also in
this situation.

Second:

This issue is with auto-focus and lock-on-active. If I add "lock-on-active
true" to rule2 and also a third rule:

// continuing the earlier example:
rule "rule3"
agenda-group "group2"
when
then
    System.out.println("rule3 fired");
end

then I get the following puzzling output:

rule3 fired
rule1 fired

It seems that auto-focus activates the agenda group first and then tries to
activate rule2 but the activation is discarded by lock-on-active. I feel
that this is a bit too strong loop prevention. I would rather see rule2
fired once, with no consecutive activations in the case that it would have
some conditions that were changed by rule3.

Any comments?

Olli
-- 
View this message in context: http://n3.nabble.com/suprises-when-using-auto-focus-with-salience-or-lock-on-active-tp101839p101839.html
Sent from the Drools - User mailing list archive at Nabble.com.



More information about the rules-users mailing list