Sorry for the delay on answering. I am on a trip with limited internet connection.
   I am interested in your experience with the sliding windows, since the tests are working. Maybe it is a scenario not covered by the tests.

   In any case, what is probably happening is that you are not configuring the engine to work in STREAM mode. The default mode is CLOUD and it does not support sliding windows. It seems the engine is silently failing in this case, when the compiler raise an error to warn the user.

    I just committed some docs on this subject:


    (plz, wait for hudson to rebuild the docs or build docs yourself).

    Feedback welcome. I will complement the sliding window docs.


2009/3/29 ober0n <lili339@hotmail.com>

Still trying to get sliding windows to work (basing my code off of the
Eclipse supplied "Hello World" example). I don't think I fully understand
how it works yet so I'm trying to simplify things even further by writing a
simple rule that is meant to say:

if (current_message = "Hello" AND exists( goodbye_message within
sliding_window(3 seconds) ))
then print("There was a GOODBYE message before the HELLO message." )

In other words: This rule should fire if the current Hello World message was
preceeded within 3 seconds by a goodbye message.

I wrote a new rule for this:

declare Message
   @role( event )

rule "Goodbye before Hello World"
               Message( status == Message.HELLO )
               exists( Message( status == Message.GOODBYE ) over window:time( 3s ) )
               System.out.println( "There was a GOODBYE message before the HELLO
message." );


To send the messages: (ksession is a StatefulKnowledgeSession)




I expect to get nothing back since I sent the Hello message 5 seconds after
the goodbye message (outside the sliding window of 3 seconds). But, for some
reason the rule fires and I get one:

"There was a GOODBYE message before the HELLO message."

Any help would be greatly appreciated.

View this message in context: http://www.nabble.com/Trying-to-get-Sliding-Windows-to-work-tp22735051p22770318.html
Sent from the drools - user mailing list archive at Nabble.com.

rules-users mailing list

 Edson Tirelli
 JBoss Drools Core Development
 JBoss, a division of Red Hat @ www.jboss.com