Automatic event retraction is something that looks good on glossy flyers.<br>("Saves your programmers' time, blah, blah...) But as long as you haven'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 == 'A' ) - no matter how antique - when followed by a<br>MyEvent( key == 'B' ). 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 "key" 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"><<a href="mailto:ladd@codemettle.com" target="_blank">ladd@codemettle.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm attaching a small standalone java program to demonstrate this. The code<br>
should be self explanatory. But in a nutshell, I'm feeding events into this<br>
rule:<br>
<br>
rule averageOverTime<br>
when<br>
$avg: Number() from accumulate (<br>
MyEvent( key == 'someKey', $val : value ) over window:time( 200ms<br>
),<br>
average( $val ) )<br>
then<br>
System.out.println( "--- $avg in then clause is " + $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'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 == 'A' )<br>
MyEvent( key == 'B', this after $a )<br>
then<br>
System.out.println( "--- just saw A followed by B" );<br>
end<br>
<br>
Whether or not I inject events with key 'A' or 'B', 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>
<<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>><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>