Automatic event retraction is something that looks good on glossy flyers.<br>(&quot;Saves your programmers&#39; time, blah, blah...) But as long as you haven&#39;t<br>seen a concise definition of what this feature does (and what it does not),<br>
be very cautious.<br><br>That said, your rule RetractionBreaker should fire whenever there is a <br>MyEvent( key == &#39;A&#39; ) - no matter how antique -  when followed by a<br>MyEvent( key == &#39;B&#39; ). This will keep all MyEvent facts from being <br>
retracted. Also, note that the implementation does not try to analyze beyond <br>time stamps, i.e., the subtle distinctions of the &quot;key&quot; property are lost.<br><br>HTH<br>-W<br> <br><br><div class="gmail_quote">On 6 March 2013 20:25, Ladd <span dir="ltr">&lt;<a href="mailto:ladd@codemettle.com" target="_blank">ladd@codemettle.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I&#39;m attaching a small standalone java program to demonstrate this.  The code<br>
should be self explanatory.  But in a nutshell, I&#39;m feeding events into this<br>
rule:<br>
<br>
rule averageOverTime<br>
when<br>
    $avg: Number() from accumulate (<br>
         MyEvent( key == &#39;someKey&#39;, $val : value ) over window:time( 200ms<br>
),<br>
         average( $val ) )<br>
then<br>
    System.out.println( &quot;--- $avg in then clause is &quot; + $avg );<br>
end<br>
<br>
I set up a loop to feed events in and I do see the rule fire and my averages<br>
print out as I&#39;d expect.  I also set up a session listener to see if events<br>
are automatically expired/retracted.  And they are.<br>
<br>
The trouble begins when I add this rule:<br>
<br>
rule RetractionBreaker<br>
when<br>
    $a : MyEvent( key == &#39;A&#39; )<br>
    MyEvent( key == &#39;B&#39;, this after $a )<br>
then<br>
    System.out.println( &quot;--- just saw A followed by B&quot; );<br>
end<br>
<br>
Whether or not I inject events with key &#39;A&#39; or &#39;B&#39;, no events of any kind<br>
are ever automatically retracted.<br>
<br>
Why is that?<br>
<br>
Thanks for helping me understand this!!<br>
<br>
- Ladd<br>
<br>
NoRetractionTest.java<br>
&lt;<a href="http://drools.46999.n3.nabble.com/file/n4022716/NoRetractionTest.java" target="_blank">http://drools.46999.n3.nabble.com/file/n4022716/NoRetractionTest.java</a>&gt;<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://drools.46999.n3.nabble.com/Why-no-auto-retraction-after-adding-this-temporal-rule-tp4022716.html" target="_blank">http://drools.46999.n3.nabble.com/Why-no-auto-retraction-after-adding-this-temporal-rule-tp4022716.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>
</blockquote></div><br>