<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3059" name=GENERATOR></HEAD>
<BODY
style="WORD-WRAP: break-word; khtml-nbsp-mode: space; khtml-line-break: after-white-space">
<DIV dir=ltr align=left><SPAN class=653540514-28032007><FONT face=Arial
color=#0000ff size=2>Mike,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=653540514-28032007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=653540514-28032007><FONT face=Arial
color=#0000ff size=2>Thanks for you rresponse, however I'm not sure based
on what we are wanting to do that we should use a single working memory. The
proposed </FONT></SPAN><SPAN class=653540514-28032007><FONT face=Arial
color=#0000ff size=2>approach is: </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=653540514-28032007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=653540514-28032007><FONT face=Arial
color=#0000ff size=2>a rule has been added to the rule base, then a Fact
(object) comes along and we instantiate a working memory and fire all rules
relative to this working memory. The outcome from Drools is evaluated by
another sw component, and it is decided to try a different rule with a given
Fact.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=653540514-28032007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=653540514-28032007><FONT face=Arial
color=#0000ff size=2>So, a new rule, rule #2, comes along with slightly
different specifics on what it is supposed to match, so it is added to the rule
base. Then, Fact #2 comes down the pipeline. A new working memory
#2 is instantiated against the existing rulebase, Fact #2 is asserted, and
fireAllRules() called against the working memory #2.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=653540514-28032007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=653540514-28032007><FONT face=Arial
color=#0000ff size=2>The desired behavior is that only rule #2 is actually
kicked into action (against Fact #2), since the first rule and fact is done
with. We don't want the previous rules/facts in the rule base operating any
longer. </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=653540514-28032007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=653540514-28032007><FONT face=Arial
color=#0000ff size=2>Maybe I just don't know enough about the proper application
of rules when solving particular problems to ask the right questions -- my task
is to expose JBoss rules as a service so I'm trying to
understand a bit about it's operation.</FONT></SPAN></DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV><!-- Converted from text/rtf format --><SPAN
class=653540514-28032007></SPAN><FONT face=Arial><FONT color=#0000ff><FONT
size=2>Thanks,<SPAN
class=653540514-28032007></SPAN></FONT></FONT></FONT><BR><BR>
<P><SPAN lang=en-us><FONT face=Arial size=2>aj</FONT></SPAN> </P><BR>
<P><SPAN lang=en-us><FONT face=Arial
size=2>--------------------------------------------</FONT></SPAN> <BR><SPAN
lang=en-us><FONT face=Arial color=#0000ff size=2>Alan R Jones</FONT></SPAN>
<BR><SPAN lang=en-us><FONT face=Arial size=2>Boeing S&IS Mission
Systems</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial size=2>Denver
Engineering Center (BDEC)</FONT></SPAN> <BR><SPAN lang=en-us><FONT face=Arial
size=2>303.307.3415</FONT></SPAN> </P>
<DIV> </DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Anstis, Michael (M.)
[mailto:manstis1@ford.com] <BR><B>Sent:</B> Wednesday, March 28, 2007 2:23
AM<BR><B>To:</B> Rules Users List<BR><B>Subject:</B> RE: [rules-users] Rules
Engine always running<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT face=Arial
color=#0000ff size=2>Hi Alan,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT face=Arial
color=#0000ff size=2>A working memory is in essence always available\running
whilst there is a reference to it; other than the "main" thread (on which your
public static void main executes) you don't need to use other threads (but this
obviously depends upon what exactly you're trying to achieve). The Rulebase can
contain all of your production rules (in fact this is probably the recommended
approach as, assuming some rules share a common pattern, the resulting
RETE network will be optimised); and you can feed incoming objects (Facts in
JBoss Rules terms) into one working memory created from the one Rulebase. As
objects are asserted patterns (LHS) defining the rules are matched and, once
fully matched, rules are activated for execution (RHS). <SPAN
class=714460308-28032007><FONT face=Arial color=#0000ff size=2>Unfortunately I
don't have any experience of JBoss Rules in a multi-threaded
environment.</FONT></SPAN></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT face=Arial
color=#0000ff size=2><SPAN
class=714460308-28032007></SPAN></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT face=Arial
color=#0000ff size=2><SPAN class=714460308-28032007></SPAN>For
example:-</FONT></SPAN></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT
face="Courier New" color=#0000ff size=2>public static void main(String args[])
{</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT
face="Courier New" color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT
face="Courier New" color=#0000ff size=2> Rulebase rb =
loadRuleBase();</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT
face="Courier New" color=#0000ff size=2> WorkingMemory wm =
rb.newWorkingMemory();</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT
face="Courier New" color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT
face="Courier New" color=#0000ff size=2> while (!exit())
{</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT
face="Courier New" color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT
face="Courier New"><FONT size=2>
<FONT color=#0000ff>Collection c =
getObjectsFromWherever();</FONT></FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT
face="Courier New"><FONT size=2>
<FONT color=#0000ff>assertObjectsIntoWorkingMemory(c,
wm);</FONT></FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT
face="Courier New"><FONT size=2>
<FONT color=#0000ff>wm.fireAllRules();</FONT></FONT></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT
face="Courier New" color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN
class=714460308-28032007>
<FONT face="Courier New" color=#0000ff size=2>try {</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN
class=714460308-28032007>
<FONT face="Courier New" color=#0000ff
size=2>Thread.sleep(1000);</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN
class=714460308-28032007>
<FONT face="Courier New" color=#0000ff size=2>}</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN
class=714460308-28032007>
<FONT face="Courier New" color=#0000ff size=2>catch(InterruptedException ie)
{</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT
face="Courier New" color=#0000ff
size=2> }</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT
face="Courier New" color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT
face="Courier New" color=#0000ff size=2>
}</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT
face="Courier New" color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=714460308-28032007><FONT
face="Courier New" color=#0000ff size=2>}</FONT></SPAN></DIV></BLOCKQUOTE>
<DIV><FONT color=#0000ff><FONT face=Arial
size=2>With kind regards,</FONT></FONT></DIV>
<DIV><FONT color=#0000ff><FONT face=Arial size=2></FONT></FONT> </DIV>
<DIV><FONT size=+0><FONT color=#0000ff><FONT size=2><FONT face=Arial>M<SPAN
class=714460308-28032007>ike</SPAN></FONT></FONT></FONT></FONT></DIV>
<DIV><BR></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> rules-users-bounces@lists.jboss.org
[mailto:rules-users-bounces@lists.jboss.org] <B>On Behalf Of </B>Jones, Alan
R<BR><B>Sent:</B> 27 March 2007 19:05<BR><B>To:</B> Rules Users
List<BR><B>Subject:</B> [rules-users] Rules Engine always
running<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=466345717-27032007>Kind of new to JBoss Rules...I'm trying to fiigure
out from what i have read so far if the following scenario is
possible:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=466345717-27032007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=466345717-27032007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=466345717-27032007>1. Start up an instance of a working memory (say,
with dummy rule?) and keep it running, feeding it data objects to operate on
from time to time.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=466345717-27032007>2. As needed, kick off as many instance of working
memory within the single rule base (in a separate thread) and keep them
going as in step 1</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=466345717-27032007></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=466345717-27032007>The idea is to keep the rules engine running
constantly, but kick off separate working-memory threads for the injection
of various incoming rule sets and the objects those rule sets work on as
needed. Can anyone provide some insight to this? Pointers to examples,
perhaps?</SPAN></FONT></DIV>
<DIV> </DIV><!-- Converted from text/rtf format --><BR><BR>
<P><SPAN lang=en-us><FONT face=Arial color=#0000ff size=2><SPAN
class=466345717-27032007>Alan J.</SPAN></FONT></SPAN> </P><BR>
<P><FONT face=Arial color=#0000ff
size=2></FONT> </P></BLOCKQUOTE></BODY></HTML>