Hi Edson.<br><br>Many thanks for the response. Firing the rules before advancing the clock fixes the problem. However,<br>I&#39;m now looking for suggestions on how I can use time windows - when I have events arriving from multiple<br>
unsynchronized streams :)<br><br>For example, I have two events StreamOne and StreamTwo, which have their own timestamp properties,<br>both of these events are inserted into the a single session.<br><br>StreamOne Data.<br>
<br>timestamp = 2010-03-27 04:20:05, x = 0, y = 0<br>timestamp = 2010-03-27 04:20:10, x = 1, y = 0<br>timestamp = 2010-03-27 04:20:15, x = 1, y = 0<br>timestamp = 2010-03-27 04:20:20, x = 1, y = 0<br>timestamp = 2010-03-27 04:20:25, x = 0, y = 0<br>
<br>StreamTwo Data.<br>
<br>
timestamp = 2010-03-27 04:20:10, x = 0, y = 0<br>
timestamp = 2010-03-27 04:20:15, x = 1, y = 1<br>
timestamp = 2010-03-27 04:20:20, x = 1, y = 1<br>
timestamp = 2010-03-27 04:20:25, x = 0, y = 1<br>timestamp = 2010-03-27 04:20:30, x = 0, y = 1<br><br>I would like to use simple rules like the following to capture particular sequences of data.<br><br>Number(intValue &gt; 2) from accumulate<br>
        $f : StreamOne(x == 1)<br>           
 over window:time ( 15s )<br>            from entry-point 
ChannelDataStream, <br>        count($f))<br><br><br>
Number(intValue &gt; 2) from accumulate<br>
        $f : StreamOne(y == 1)<br>
           
 over window:time ( 15s )<br>
            from entry-point 
ChannelDataStream, <br>
        count($f))<br><br>Because the timestamps are in the past, and because of the fact that multiple instances of the<br>same event type (different timestamps) may arrive at the same time, due to network latency, etc.<br>
This rules out the use of the real-time clock.<br><br>I also can&#39;t see how I can reliably use the pseudo-clock because of the lack of synchronization<br>of the timestamps between the two streams?<br><br>Any suggestions greatly appreciated!<br>
<br>Thanks and Regards,<br><br>Paul<br><br><br><br><br><br><br><br><br><div class="gmail_quote">2010/3/26 Edson Tirelli <span dir="ltr">&lt;<a href="mailto:ed.tirelli@gmail.com" target="_blank">ed.tirelli@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br>   Did you tried firing the rules before advancing the time clock? <br><br>   This is a very tricky situation because you are working with the edge limits of the time window. Events are expired from the time window when the clock advances. You are inserting events every 5 seconds. So, lets say you insert events on T0, T5, T10, T15, T20, T25... at this point in time the rule activates, but before it fires, you advance the clock to T30, when T0 is expired from the window, making the condition intValue &gt; 5 false and deactivating the rule.<br>


<br>    []s<br>    Edson<br><br><div class="gmail_quote">2010/3/25 Paul R. <span dir="ltr">&lt;<a href="mailto:reverselogic@gmail.com" target="_blank">reverselogic@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div><div></div><div>
Hi,<br><br>I&#39;m using an accumulate on a sliding window to count the number of events, which occur in a 30 second window;<br>the events are inserted every 5 seconds - so with a 30 second window, I would expect 6 events to occur.<br>



<br>The rule below never fires, though from the log output, it looks as though the condition has matched successfully?<br><br>declare Foo <br>    @role ( event ) <br>    @expires ( 60s ) <br>    @timestamp ( date ) <br>end<br>



<br>rule &quot;Count Foo&quot;<br>when<br>    c : Number(intValue &gt; 5) from accumulate<br>        $f : Foo()<br>            over window:time ( 30s )<br>            from entry-point ChannelDataStream, <br>        count($f))<br>



then<br>    System.out.println(&quot;Count [30s] = &quot; + c);<br>end<br><br>OBJECT ASSERTED value:com.test.DroolsTest$Foo@c52200 factId: 1<br>OBJECT ASSERTED value:com.test.DroolsTest$Foo@128edf2 factId: 3<br>OBJECT ASSERTED value:com.test.DroolsTest$Foo@1dddba factId: 4<br>



OBJECT ASSERTED value:com.test.DroolsTest$Foo@c7e8a7 factId: 5<br>OBJECT ASSERTED value:com.test.DroolsTest$Foo@7b4703 factId: 6<br>ACTIVATION CREATED rule:Count Foo activationId:Count Foo [2, 0] declarations: c=6(2)<br>


OBJECT ASSERTED value:com.test.DroolsTest$Foo@1732ed2 factId: 7<br>
ACTIVATION CANCELLED rule:Count Foo activationId:Count Foo [2, 0] declarations: c=6(2)<br>ACTIVATION CREATED rule:Count Foo activationId:Count Foo [2, 0] declarations: c=6(2)<br>OBJECT ASSERTED value:com.test.DroolsTest$Foo@be76c7 factId: 8<br>



ACTIVATION CANCELLED rule:Count Foo activationId:Count Foo [2, 0] declarations: c=6(2)<br>ACTIVATION CREATED rule:Count Foo activationId:Count Foo [2, 0] declarations: c=6(2)<br><br><br>Can anybody explain why this is happening? I&#39;ve attached a test case, which demonstrates the problem.<br>



<br>Thanks in advance.<br><font color="#888888"><br>- Paul<br>
</font><br></div></div>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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><font color="#888888"><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com" target="_blank">www.jboss.com</a><br>
</font><br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org" target="_blank">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>