<br>   Chris,<br><br>   Someone found a bug a couple days ago that might be affecting you too. What happens if you write:<br><br><p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">declare NumReading</span></font></p>


<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">    @role( event )</span></font></p><p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">    @expires( 10s )<br>
</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">end</span></font></p>

<font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"></span></font><br>   ?<br><br>   Edson<br><br><br><div class="gmail_quote">2009/9/29 Chris Richmond <span dir="ltr">&lt;<a href="mailto:crichmond@referentia.com">crichmond@referentia.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">








<div link="blue" vlink="purple" lang="EN-US">

<div>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Hello,</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">I am trying to make a rule to delay firing until a certain
amount of time has passed without another event being received.  I have
set up a loop that goes every 10 seconds in my main application that takes
readings and injects them into the ReadingStream. These are like sensor
readings. </span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> I have a thread started at initialization that is
basically calling fireUntilHalt() and I never call halt until shutdown, and
that seams to be working fine.</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">So basically any time an out of spec reading in my Reading
object (&lt;15) is received, I want to wait to see if a FollowUpReading is not
received in the next 5 seconds, before I fire the results(The second rule
below).  The first rule is there just to verify I am indeed detecting NumReadings
with values &lt; 15 being injected and that works fine.   Now at this
point in my appication I am *<b><span style="font-weight: bold;">never</span></b>*
inserting a FollowUpReading object/event, so I would expect the 2<sup>nd</sup>
rule to fire all the time, however the strange thing is that it only fires the
first time I receive a reading out of spec. I see rule one fire, then the seond
time, but after that any subsequent out of spec readings received(I know they
are out of spec, because rule 1 still fires when received) but rule 2 never
fires again.  It only ever fires one time!   This is very
confusing.  These ar the only 2 rules and the only two object types being
inserted to the stream. Know that rule 2 *<b><span style="font-weight: bold;">can</span></b>*
fire because it does once and only once.  Why won’t it fire beyond
the first time, even though I never insert the FollowUpReading() ?</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Thanks,</span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"><br>
Chris</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">declare NumReading</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">    @role( event )</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">end</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">declare FollowUpReading</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">      @role(event)</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">end</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">rule &quot;Determine out of spec reading&quot;</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">when</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">      $n : NumReading($r:reading
&lt; 15) from entry-point &quot;ReadingStream&quot;;</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">then</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">     
System.err.println(&quot;Fire off a follow up reading for device: &quot; + $n);</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">end</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;"> </span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">rule &quot;Missed degrading confirmation
reading&quot; </span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">when</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">      $n :
NumReading($r:reading &lt; 15) from entry-point &quot;ReadingStream&quot;;</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">      not
(FollowUpReading(this after[0s, 5s] $n))</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">then</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">     
System.err.println(&quot;No good reading received for: &quot; + $n);</span></font></p>

<p><font face="Courier New" size="2"><span style="font-size: 10pt; font-family: &quot;Courier New&quot;;">end</span></font><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"></span></font></p>


<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>

</div>

</div>


<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>
<br></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>