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

Ladd ladd at codemettle.com
Thu Jul 5 13:11:15 EDT 2012


I see what you mean about potentially catching events multiple times.  Not
good.  And I can't retract them since other rules may be written to catch
those same events.  Marking each event would be possible but could get
complicated for the same reason - multiple rules may be interested in them
and would each need to mark them.

Using a repeat interval for the timer does seem necessary alright.

I like your singleton fact solution.  I implemented this by having a "fire
only once" rule create the list, a second rule looks for events matching the
desired criteria and appends to the list, and a third rule uses the timer to
look for the list, process its contents, and then clear those contents.  I
wanted to do it purely with DRL so I declared the list like this:

*declare TimeBatchList
    name : String
    list : List 
end*

Since I might have multiple "batching" rules like this, I need each one to
have their own event batch/list.  The name field keeps them unique (probably
should change this to something like "id").  Seems to work.

Thanks!

- Ladd

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


More information about the rules-users mailing list