What you describe is a CEP scenario, i.e., what Drools Fusion features were created for.

   Documentation is on the way, but a lot more to do:

https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-fusion/html/index.html

   If you like to mess with the code, take a look at this example I am implementing. DISCLAMER: the example is not ready, but gives you a quick view on a few features, like event declaration, sliding windows and entry points (streams).

http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-examples/drools-examples-fusion/

   Also, for temporal operators, take a look on the javadocs of these classes:

http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/

   []s
   Edson



2009/2/17 ober0n <lili339@hotmail.com>

Hi, I am a total newb to Drools and am still trying to get a clear picture of
how things work. I have the HelloWorld example running in Eclipse and am
trying to modify it.

What I'd like to do is write a program that passes single events over a set
of rules I defined in Drools. Obviously I don't know these events ahead of
time and I don't know when they will be reported.

Another important point is that I want each of these calls to be a stateful
transaction, for example:

1) Some event type A happens and is passed through drools: Rules say to
ignore the event

2) Some time later, and event type B happens and is passed through drools:
Rules say to ignore the event

3) Then, some time later, another event type A happens and is passed through
drools: This time the rule says to do some action because both event B AND
event A occurred.
(NOTE: Here, Drools would need to realize that event B has already occurred
and needs to take this into account when it invokes the rules. Thus state
needs to be taken into consideration.)


I have been reading the documentation and have seen the stateless and
stateful sessions in the javadocs. But, I'm not sure if this is what I need
to accomplish the job. I was discouraged when I found this post:
http://lists.jboss.org/pipermail/rules-users/2008-February/004688.html
mentioning that the difference between stateful and stateless was the number
of objects that could be inserted into working memory before calling
fileAllRules().

>From the examples I've seen, Drools seems to be a simple program you call
once and the process is terminated (as opposed to a daemon-like program that
is continuously running). (Please correct me if I'm wrong.) Further, I
understand that Working Memory is where all the facts in Drools are
contained. I am wondering if these "facts" all disappear once an invocation
of Drools has finished. Or, do stateful sessions somehow maintain state
(facts) across Drools invocations?

My best guess is that the Working Memory gets destroyed along with the facts
after an invocation of Drools and that to achieve the state that I want, I
will need to create some sort of infinite loop to encapsulate an invocation
of Drools to keep all the facts in Working Memory. Is that true?

I am more than happy to look all of this up myself but need a push in the
right direction. (Up to this point, I've been looking mainly looking at the
"JBoss Rules User Guide" and searching on the web.)

Thanks for your help and I would be more that happy to clarify any points.


--
View this message in context: http://www.nabble.com/Maintaining-state-across-invocations-tp22068357p22068357.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users@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