What you need to understand is that rules evaluation and rules execution
happen in different times. Whenever you insert/update(modify)/retract a
fact, all the rules that could potentially match are evaluated by Drools. A
rule having its conditions satisfied generates an ACTIVATION (but the THEN
part is not yet executed). All the ACTIVATIONS are put together in
something called the AGENDA.
When you call fireAllRules() an algorithm (that takes into account the
salience of the rules) gets ONE activation from the AGENDA and executes it
(the THEN part gets executed). If the execution didn't
insert/modify/retract any fact, then another ACTIVATION is selected and
executed until the AGENDA is empty. If an ACTIVATION causes the
insertion/modification/retraction of a fact, then the rules are evaluated
again possibly generating new ACTIVATIONS or cancelling existing ones.
All this should be explained in drools documentation:
I'm not in favor of answering Drools related questions arriving directly to
my inbox. This is the last email I'm going to reply to.
- Blog @ http://ilesteban.wordpress.com
On Tue, Oct 30, 2012 at 5:26 PM, <reachkn6(a)gmail.com> wrote:
Esteban, you seem to understand how Drools Rules work, I'm trying to
understand how a field value changed in 'then'/consequence be retained so
next rule can see it.
Posted above is a link for my question, can you help me fix it. Share any
links that helps me understand how to do it right, I have written about 100
rules, to my surprise this basic fact that one field changed in rule 1 is
not visible in rule2, I couldn't test earlier as my data wasn't good enough.
Any help is greatly appreciated.