What you report is very unlikely.<br><br>If this rule would fire when there are no facts of ZZZBean in the working memory, then, referring to $tsb on the right hand side (e.g., by doing $tsb.toString()) should result in a NullPointerException.<br>
<br>Please do this and provide the stack trace - but I don't think that you'll be able to do that.<br><br>Note that the rule will fire <i>as soon as you insert the first ZZZBean</i>, because a window of lenght N is actually a window of lenght <= N.<br>
<br>-W<br><br><br><div class="gmail_quote">On 18 October 2011 08:20, eskomk <span dir="ltr"><<a href="mailto:esko.hujanen@ebsolut.fi">esko.hujanen@ebsolut.fi</a>></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 all,<br>
<br>
Here is the rule:<br>
<br>
CLIP --><br>
rule "ZZZOver30" dialect "mvel"<br>
<br>
when<br>
$tsb : ZZZBean($prof : profileID)<br>
$avg : Number( doubleValue > 30 ) from accumulate(<br>
ZZZBean( $tempr : temperature, profileID == $prof) over<br>
window:length( 3 ),<br>
average( $tempr ) )<br>
then<br>
// do something<br>
end<br>
CLIP <--<br>
<br>
The intention as you can see is that the rule fires if the average<br>
temperature rises above 30 degrees (of Celsius) in some measuring period.<br>
For testing purposes the rule takes a specific number of temperatures<br>
(window:length), in production environment the window will be time<br>
(window:time(Xm)).<br>
<br>
My question is, why this rule fires immediately after drools-expert is<br>
started ?<br>
Is there something wrong in syntax ?<br>
<br>
In startup there are obviously no objects of this kind (ZZZBean) in Working<br>
Set's memory, so it really shouldn't fire.<br>
<br>
We are running Drools ver. 5.1.1 as a web service on top of apache, and the<br>
facts (events) are fed to Drools via REST interface as XML.<br>
<br>
thanks and regards,<br>
Esko<br>
-----<br>
Esko Hujanen<br>
<a href="http://www.ebsolut.fi" target="_blank">www.ebsolut.fi</a><br>
<font color="#888888"><br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Why-this-rule-fires-immediately-tp3430427p3430427.html" target="_blank">http://drools.46999.n3.nabble.com/Why-this-rule-fires-immediately-tp3430427p3430427.html</a><br>
Sent from the Drools: User forum mailing list archive at Nabble.com.<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>
</font></blockquote></div><br>