You certainly need no-loop for rule "1 precondition" as it stands because the
Foo is updaetd, but not in a way that prevents the rule from firing again. One way to
prevent that would be to put a condition in the rule that is the antithesis of some update
you make:
rule "1 precondition"
when
foo : Foo( preconditionPassedRule not contains "1 precondition", f1 != null,
f2 != null)
then
foo.addPreconditionPassedRule("1 precondition");
update(foo)
end
As for lock-on-active, it should be used in conjunction with a ruleflow-group or
agenda-group. It's basically no-loop for the entire group, as I understand it. I
don't see either a ruleflow-group or agenda-group defined for those rules. Did you do
that?
--- On Tue, 11/11/08, techy <techluver007(a)gmail.com> wrote:
From: techy <techluver007(a)gmail.com>
Subject: [rules-users] no-loop & lock-on-active clarification
To: rules-users(a)lists.jboss.org
Date: Tuesday, November 11, 2008, 10:25 AM
I tried following rules as given below and result
are:(assumes facts which
I tried are qualified for both rules)
1. when lock-on-active used with both rule, only rule
"1 precondition" got
executed for all facts.
2. when no-loop used with both rules, infinite loop
3. when lock-on-active for rule "1 precondition"
and no-loop for rule "1
main condition" used, both rule got fired correctly.
4. for vice versa of 3 scenario, only rule "1
precondition" got executed for
all facts.
Can someone please clarify about this scenario and also
diff between no-loop
& lock-on-active? when we should use one and when
should not?
I went thru documentation and still could not understand
the difference.
public class Foo
{
private Set<String> preConditionPassedRules ;
private Integer f1;
private Integer f2;
}
rule "1 precondition"
salience 100
when
foo : Foo( f1 != null && f2 != null)
then
foo.addPreconditionPassedRule("1
precondition");
update(foo)
end
rule "1 main condition"
salience 100
when
foo : Foo( preconditionPassedRule contains "1
precondition",f1 > 1000,f2
< 1000)
then
#actions
end
--
View this message in context:
http://www.nabble.com/no-loop---lock-on-active-clarification-tp20443036p2...
Sent from the drools - user mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users