<div dir="ltr"><br><br><div class="gmail_quote">On Tue, Nov 18, 2008 at 12:17 AM, Jin Chai <span dir="ltr">&lt;<a href="mailto:jin.chai@jdsu.com">jin.chai@jdsu.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
I have the following code, which is not working as I expected.<br>
<br>
rule &quot;New AlertFacade&quot;<br>
 &nbsp; &nbsp;salience 1140<br>
 &nbsp; &nbsp; &nbsp; &nbsp;when<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$af : AlertFacade();<br>
 &nbsp; &nbsp; &nbsp; &nbsp;then<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println($af.getProperties());<br>
end<br>
<br>
<br>
In the java code:<br>
 &nbsp; while (!isFireAllRules)<br>
 &nbsp; {<br>
 &nbsp; &nbsp; session.insert(alertFacade);<br>
 &nbsp; &nbsp; ....<br>
 &nbsp; }<br>
 &nbsp; session.fireAllRules();<br>
<br>
<br>
But I am seeing the rule &quot;New AlertFacade&quot; is fired everytime I inserted the<br>
fact. &nbsp;Shouldn&#39;t it wait until fireAllRules() be called? Am I missing something<br>
here?<br>
</blockquote><div><br>The &quot;when&#39; is evaluated as Drools builds its RETE network, which happens
as soon as you insert() the fact. This is called the LHS.<br>
The &quot;then&quot; should happen only after you issue &quot;fireallrules()&quot;. This is also called the RHS of the rule.<br>
<br>
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.<br>&nbsp;<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Thanks,<br>
Jin<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Cheers, <br>Maxim Veksler<br><br>&quot;Free as in Freedom&quot; - Do u GNU ?<br>
</div>