On 04/07/2012, Ladd <ladd(a)codemettle.com> wrote:
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.
I'm sure you realize that this is bound to catch events more than once
unless you mark or retract them.
This rule passed my simple tests:
rule "Grouped Events"
timer( int: 500ms )
Shouldn't you use a repeat interval?
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.
It's difficult to propose anything else since I don't know the reason
for dealing with events in batches.
As an alternative to the collect, consider a simple rule that just
adds the MyEvent to the end of a list (a singleton fact), and let the
"Grouped Events" rule with its interval timer (using 2s) look at what
is there.
-W
And thanks again!
- Ladd
--
View this message in context:
http://drools.46999.n3.nabble.com/How-to-batch-high-freq-events-before-se...
Sent from the Drools: User forum mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users