[rules-users] Why no auto-retraction after adding this temporal rule?

Ladd ladd at codemettle.com
Wed Mar 6 14:25:26 EST 2013


I'm attaching a small standalone java program to demonstrate this.  The code
should be self explanatory.  But in a nutshell, I'm feeding events into this
rule:

rule averageOverTime
when
    $avg: Number() from accumulate (
         MyEvent( key == 'someKey', $val : value ) over window:time( 200ms
),
         average( $val ) )
then
    System.out.println( "--- $avg in then clause is " + $avg );
end

I set up a loop to feed events in and I do see the rule fire and my averages
print out as I'd expect.  I also set up a session listener to see if events
are automatically expired/retracted.  And they are.

The trouble begins when I add this rule:

rule RetractionBreaker
when
    $a : MyEvent( key == 'A' )
    MyEvent( key == 'B', this after $a )
then
    System.out.println( "--- just saw A followed by B" );
end

Whether or not I inject events with key 'A' or 'B', no events of any kind
are ever automatically retracted.

Why is that?

Thanks for helping me understand this!!

- Ladd

NoRetractionTest.java
<http://drools.46999.n3.nabble.com/file/n4022716/NoRetractionTest.java>  



--
View this message in context: http://drools.46999.n3.nabble.com/Why-no-auto-retraction-after-adding-this-temporal-rule-tp4022716.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list