[rules-users] How to batch high freq events before sending to RHS

Ladd ladd at codemettle.com
Tue Jul 3 18:28:01 EDT 2012


Thanks for the quick reply W!!  I think that was the nudge I needed.  It
seems like as long as I keep my timer interval shorter than the sliding
window interval this should work.  This rule passed my simple tests:

*import drools.tests.MyEvent 
import java.util.List 
 
declare MyEvent @role(event) end 
 
rule "Grouped Events" 
    timer( int: 500ms )
when 
    $list : List() from collect ( MyEvent() over window:time(2s) ) 
then 
    for( Object myEvent : $list ) { 
        System.out.println( System.currentTimeMillis() + "ms: event group
contains: " + myEvent.toString() );
    } 
end* 

Please let me know if there's a danger with this approach or if there's a
better way to do it.

And thanks again!

- Ladd

--
View this message in context: http://drools.46999.n3.nabble.com/How-to-batch-high-freq-events-before-sending-to-RHS-tp4018447p4018449.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list