[rules-users] Time Window

diana-mendes diana-mendes at hotmail.com
Mon Oct 31 14:28:46 EDT 2011


Hello, 

I want to implement a simple scenario using Drools, but I can't find the
right functions to do so.

I have a class named Notif that represents my events.

When I receive a Notif with a certain attribute (for example, type == "A") I
want to get a list of all the events I receive in the next 10 seconds.

If I receive a second event of type "A" during those 10 seconds, I don't
want to start another count. It should only restart the count after the 10
seconds have expired.

Example:
1s: Notif (type=="A")    should start the 10 second count
2s: Notif (type=="B")    
3s: Notif (type=="C")
4s: Notif (type=="A")
5s: Notif (type=="D")
12s: Notif(type=="E")


10 seconds after the first Notif(type=="A") I would like to receive the
following list:
Notif (type=="A")
Notif (type=="B")    
Notif (type=="C")
Notif (type=="A")
Notif (type=="D")

Note that Notif(type=="E") (at 12 seconds) should not be in the list because
it's outside of the 10 seconds interval. Also, note that the second
Notif(type=="A") (at 4 seconds) should not start a new count because it's
included in the 10 seconds interval.

Thanks in advance,

Diana

--
View this message in context: http://drools.46999.n3.nabble.com/Time-Window-tp3468566p3468566.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list