On Tue, Nov 18, 2008 at 12:17 AM, Jin Chai <jin.chai@jdsu.com> wrote:
Hi,

I have the following code, which is not working as I expected.

rule "New AlertFacade"
   salience 1140
       when
           $af : AlertFacade();
       then
           System.out.println($af.getProperties());
end


In the java code:
  while (!isFireAllRules)
  {
    session.insert(alertFacade);
    ....
  }
  session.fireAllRules();


But I am seeing the rule "New AlertFacade" is fired everytime I inserted the
fact.  Shouldn't it wait until fireAllRules() be called? Am I missing something
here?

The "when' is evaluated as Drools builds its RETE network, which happens as soon as you insert() the fact. This is called the LHS.
The "then" should happen only after you issue "fireallrules()". This is also called the RHS of the rule.

If you see the system.out prints before you call fireallrules check that your not using some eval in another rule in the LHS that might cause the system.out calls.
 

Thanks,
Jin

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
Cheers,
Maxim Veksler

"Free as in Freedom" - Do u GNU ?