<br>&nbsp;&nbsp; What you describe is a CEP scenario, i.e., what Drools Fusion features were created for.<br><br>&nbsp;&nbsp; Documentation is on the way, but a lot more to do:<br><br><a href="https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-fusion/html/index.html">https://hudson.jboss.org/hudson/job/drools/lastSuccessfulBuild/artifact/trunk/target/docs/drools-fusion/html/index.html</a><br>
<br>&nbsp;&nbsp; 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).<br><br><a href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-examples/drools-examples-fusion/">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-examples/drools-examples-fusion/</a><br>
<br>&nbsp;&nbsp; Also, for temporal operators, take a look on the javadocs of these classes:<br><br><a href="http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/">http://anonsvn.jboss.org/repos/labs/labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/</a><br>
<br>&nbsp;&nbsp; []s<br>&nbsp;&nbsp; Edson<br><br><br><br><div class="gmail_quote">2009/2/17 ober0n <span dir="ltr">&lt;<a href="mailto:lili339@hotmail.com">lili339@hotmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi, I am a total newb to Drools and am still trying to get a clear picture of<br>
how things work. I have the HelloWorld example running in Eclipse and am<br>
trying to modify it.<br>
<br>
What I&#39;d like to do is write a program that passes single events over a set<br>
of rules I defined in Drools. Obviously I don&#39;t know these events ahead of<br>
time and I don&#39;t know when they will be reported.<br>
<br>
Another important point is that I want each of these calls to be a stateful<br>
transaction, for example:<br>
<br>
1) Some event type A happens and is passed through drools: Rules say to<br>
ignore the event<br>
<br>
2) Some time later, and event type B happens and is passed through drools:<br>
Rules say to ignore the event<br>
<br>
3) Then, some time later, another event type A happens and is passed through<br>
drools: This time the rule says to do some action because both event B AND<br>
event A occurred.<br>
(NOTE: Here, Drools would need to realize that event B has already occurred<br>
and needs to take this into account when it invokes the rules. Thus state<br>
needs to be taken into consideration.)<br>
<br>
<br>
I have been reading the documentation and have seen the stateless and<br>
stateful sessions in the javadocs. But, I&#39;m not sure if this is what I need<br>
to accomplish the job. I was discouraged when I found this post:<br>
<a href="http://lists.jboss.org/pipermail/rules-users/2008-February/004688.html" target="_blank">http://lists.jboss.org/pipermail/rules-users/2008-February/004688.html</a><br>
mentioning that the difference between stateful and stateless was the number<br>
of objects that could be inserted into working memory before calling<br>
fileAllRules().<br>
<br>
&gt;From the examples I&#39;ve seen, Drools seems to be a simple program you call<br>
once and the process is terminated (as opposed to a daemon-like program that<br>
is continuously running). (Please correct me if I&#39;m wrong.) Further, I<br>
understand that Working Memory is where all the facts in Drools are<br>
contained. I am wondering if these &quot;facts&quot; all disappear once an invocation<br>
of Drools has finished. Or, do stateful sessions somehow maintain state<br>
(facts) across Drools invocations?<br>
<br>
My best guess is that the Working Memory gets destroyed along with the facts<br>
after an invocation of Drools and that to achieve the state that I want, I<br>
will need to create some sort of infinite loop to encapsulate an invocation<br>
of Drools to keep all the facts in Working Memory. Is that true?<br>
<br>
I am more than happy to look all of this up myself but need a push in the<br>
right direction. (Up to this point, I&#39;ve been looking mainly looking at the<br>
&quot;JBoss Rules User Guide&quot; and searching on the web.)<br>
<br>
Thanks for your help and I would be more that happy to clarify any points.<br>
<font color="#888888"><br>
<br>
--<br>
View this message in context: <a href="http://www.nabble.com/Maintaining-state-across-invocations-tp22068357p22068357.html" target="_blank">http://www.nabble.com/Maintaining-state-across-invocations-tp22068357p22068357.html</a><br>

Sent from the drools - user mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br> &nbsp;Edson Tirelli<br> &nbsp;JBoss Drools Core Development<br> &nbsp;JBoss, a division of Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>