Hi,<br><br>I&#39;m very new to drools and am trying to understand how &quot;facts&quot; are managed by the knowledge session.  I&#39;ve been experimenting with a simple example using drools 5.3.0.  I created a simple Account class that has a single &quot;balance&quot; attribute.  My rule tests the balance and prints a message if it is less than 100. I am creating a new instance of Account in my main method and inserting it into a stateful knowledge session.   I put this into a loop that runs 3 times and never dispose of the session.  Each of my Account instances has a balance less that 100.  Here is a portion of the code:<br>
<br>    public static final void main(String[] args) throws InterruptedException<br>    {    <br>        KnowledgeBase knowledgeBase = createKnowledgeBase();<br>        StatefulKnowledgeSession session = knowledgeBase.newStatefulKnowledgeSession();<br>
        <br>        for (int i = 0; i &lt; 3; i++)<br>        {<br>            try<br>            {<br>                Account account = new Account();<br>                switch (i) <br>                {<br>                   case 0: account.setBalance(95);<br>
                           break;<br>                   case 1: account.setBalance(85);<br>                           break;<br>                   case 2: account.setBalance(80);<br>                           break;<br>                   default: account.setBalance(80);<br>
                }<br>                session.insert(account);<br>                session.fireAllRules();<br>            }<br>            catch (Exception e)<br>            {<br>                System.out.println(&quot;Exception: &quot; + e.toString());<br>
            }<br>            Thread.sleep(1000);<br>        }<br>    }<br><br>My rule is:<br>rule &quot;basic rule&quot;<br>when $a : Account (balance &lt; 100) // condition<br>then System.out.println(&quot;Account balance &quot; + $a.getBalance() + &quot; is less than 100&quot;);  // consequence<br>
end<br><br>What I see is that each time the loop executes only the last instance of Account seems to get triggered.  I expected that each time I call &quot;fireAllRules&quot; it would examine all the facts in the session and execute them. So I thought the first time the loop runs I would get 1 activation, the second time the loop runs I get 2 activations, etc.<br>
<br>Are all 3 instances of Account still in the working memory or is the latest instance replacing the existing one?  Or, once a fact triggers the rules engine, does it not trigger it again?<br><br>Thanks for any insights,<br>
Anne<br>