[rules-users] Rules fired without calling session.fireAllRules()
Edson Tirelli
tirelli at post.com
Tue Nov 18 08:52:19 EST 2008
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 at gmail.com>
>
>
> On Tue, Nov 18, 2008 at 12:17 AM, Jin Chai <jin.chai at 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 at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20081118/dd971e17/attachment.html
More information about the rules-users
mailing list