Also, the only time rules may be fired automatically is when you add new
rules to a rulebase that already has created sessions, but even this can be
disabled by a rulebase configuration.
[]s
Edson
2008/11/18 Maxim Veksler <maxim.veksler(a)gmail.com>
On Tue, Nov 18, 2008 at 12:17 AM, Jin Chai <jin.chai(a)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(a)lists.jboss.org
>
https://lists.jboss.org/mailman/listinfo/rules-users
>
--
Cheers,
Maxim Veksler
"Free as in Freedom" - Do u GNU ?
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @
www.jboss.com