2 Replies Latest reply on Sep 28, 2006 1:15 PM by Mark Proctor

    Inside Working Memory

    Elango M Newbie

      Hi
      I have sucessfully ran the sample examples given by drools but i dont undesratnd what happens(Internally) when fireRules method is being called.

      Take for Instance the HonestPoliticain Example i assert some five Politicain Objects into the working memory.After that i just call fire rules.Can anyone explain how the code executes.


      Thanks
      Elango

        • 1. Re: Inside Working Memory
          Shane Bryzak Master

          From what I understand, fireAllRules() itself doesn't really do much. Most of the actual rule evaluation work occurs while you're asserting objects into the working memory. Here's a snippet from the JBoss Rules documentation:


          "Assertion" is the act of telling the working memory about the facts. WorkingMemory.assertObject(yourObject) for example. When you assert a fact, it is examined for matches against the rules etc. This means ALL of the work is done during assertion; however, no rules are executedl you call "fireAllRules()" after you have finished asserting your facts. This is a common misunderstanding by people who think the work happens when you call "fireAllRules()".


          • 2. Re: Inside Working Memory
            Mark Proctor Apprentice

            If you use the audit view you can see exactly what is happenig. All the work is done during the working memory action phase (see 2 phase system in the manual). All fireAlRules() does is tell the rule that is at the top of the agenda to fire.