[rules-users] Using Sliding Time Window usage in Drools Fusion v5.0.1

Karthik Krishnan karthikvkrishnan at gmail.com
Thu Feb 25 11:03:47 EST 2010


Dear all :

We have been using Drools Expert in our various projects.  Now we are to use
Drools Fusion v5.0.1 in our project for CEP.

We are trying to get SlidingTimeWindow function working... My Rule is like
below

********************************
declare MyEvent
    @role( event )
    @timestamp(eventDateTime)
end

rule "Rule1"
when
    $event: MyEvent() over window:time( 2s ) from entry-point "My Stream"
then
    System.out.println($event.getEventName() + ": Event Occured!!!" +
$event.getEventDateTime().toString());
end
*******************************

MyEvent is a Java Bean with eventName and eventDateTime attributes.

And my java code looks like below :

MyEvent e1 = new MyEvent("Meeting1", new Date(110, 1, 25, 10, 30));
MyEvent e2 = new MyEvent("Meeting2", new Date(110, 1, 25, 10, 33));
...
...
session.insert(e1);
Thread.sleep(5000);
session.insert(e2);
session.fireAllRules();

Here Since all these events time stamps indicate they had happened long
back...when I evaluate the rule, I should not see any event picked up...
But I see the following output...

Meeting2: Event Occured!!!Thu Feb 25 10:33:00 IST 2010
Meeting1: Event Occured!!!Thu Feb 25 10:30:00 IST 2010

This example seems to pretty simple, but I am wondering whats going wrong.
 Am I missing anything here?  Any help would be greatly appreciated.

Thanks.

Best regards,
Karthik Krishnan.
http://karthiks.in
Best regards,
Karthik Krishnan.
http://karthiks.in
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100225/260674c2/attachment.html 


More information about the rules-users mailing list