Ober0n,
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:
https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/t...
(plz, wait for hudson to rebuild the docs or build docs yourself).
Feedback welcome. I will complement the sliding window docs.
[]s
Edson
2009/3/29 ober0n <lili339(a)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 )
end
rule "Goodbye before Hello World"
when
Message( status == Message.HELLO )
exists( Message( status == Message.GOODBYE ) over
window:time( 3s ) )
then
System.out.println( "There was a GOODBYE message before the
HELLO
message." );
end
---------------------------------------------------------------------------------------------------
To send the messages: (ksession is a StatefulKnowledgeSession)
...
ksession.insert(goodbye_message);
ksession.fireAllRules();
Thread.sleep(5000);
ksession.insert(hello_message);
ksession.fireAllRules();
...
---------------------------------------------------------------------------------------------------
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.
Thanks!
--
View this message in context:
http://www.nabble.com/Trying-to-get-Sliding-Windows-to-work-tp22735051p22...
Sent from the drools - user mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
JBoss Drools Core Development
JBoss, a division of Red Hat @
www.jboss.com