[rules-users] Why this rule fires immediately ?

Wolfgang Laun wolfgang.laun at gmail.com
Tue Oct 18 02:42:08 EDT 2011


What you report is very unlikely.

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.

Please do this and provide the stack trace - but I don't think that you'll
be able to do that.

Note that the rule will fire *as soon as you insert the first ZZZBean*,
because a window of lenght N is actually a window of lenght <= N.

-W


On 18 October 2011 08:20, eskomk <esko.hujanen at ebsolut.fi> wrote:

> Hi all,
>
> Here is the rule:
>
> CLIP -->
> rule "ZZZOver30" dialect "mvel"
>
> when
>    $tsb : ZZZBean($prof : profileID)
>    $avg : Number( doubleValue > 30 ) from accumulate(
>        ZZZBean( $tempr : temperature, profileID == $prof) over
> window:length( 3 ),
>        average( $tempr ) )
> then
>    // do something
> end
> CLIP <--
>
> The intention as you can see is that the rule fires if the average
> temperature rises above 30 degrees (of Celsius) in some measuring period.
> For testing purposes the rule takes a specific number of temperatures
> (window:length), in production environment the window will be time
> (window:time(Xm)).
>
> My question is, why this rule fires immediately after drools-expert is
> started ?
> Is there something wrong in syntax ?
>
> In startup there are obviously no objects of this kind (ZZZBean) in Working
> Set's memory, so it really shouldn't fire.
>
> We are running Drools ver. 5.1.1 as a web service on top of apache, and the
> facts (events) are fed to Drools via REST interface as XML.
>
> thanks and regards,
> Esko
> -----
> Esko Hujanen
> www.ebsolut.fi
>
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Why-this-rule-fires-immediately-tp3430427p3430427.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20111018/8f844a96/attachment.html 


More information about the rules-users mailing list