Hi,
 
Given the rule you show it doesn't matter how many records you have on a table UNLESS they are inserted into working memory. So, assuming you have code outside of that below which inserts each individual record into working memory, then you can expect one activation to appear on the agenda for each Emp_Crime_Record object in working memory that have disposition equal to "GUILTY". Does this make sense?
 
Rule activations are put on the agenda as objects are inserted into working memory and not when you call fireAllRules() - which executes the activations on the agenda. So, every time you insert an object into working memory the object is checked against the patterns defined in the left-hand-side ("when"). If they match an activation is put on the agenda (the right-hand-side - "then") for later execution (when you call fireAllRules).
 
Cheers,
 
Mike


From: rules-users-bounces@lists.jboss.org [mailto:rules-users-bounces@lists.jboss.org] On Behalf Of pramod george
Sent: 08 July 2008 10:58
To: rules-users@lists.jboss.org
Subject: [rules-users] Rules 'firing' multiple times?

Hi all.
I have this question on drools rules and I'm not sure if this
is the right thinking?
I have a rule defined in a drl file:
when        
    c: Emp_Crime_Record(DISPOSITION == "GUILTY");   
then
    System.out.println("CriminalRecordRule fired...");
end

Here, if the table "Emp_Crime_Record" is got 5 rows that satisfy this condition ie:- DISPOSITION == "GUILTY", then does this rule get fired
5 times? Ie:- the sop gets printed 5 times?

For this, if there are a million records that satisfy this condition - then the firing happens a million times?

I would be greatful if this can be clarified?
Thanks a million!  :)

-Promod