[rules-users] Basic rules carrying state/field changes.

Esteban Aliverti esteban.aliverti at gmail.com
Tue Oct 30 12:39:23 EDT 2012


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:
Drools Introduction:
http://docs.jboss.org/drools/release/5.5.0.CR1/droolsjbpm-introduction-docs/html_single/index.html

Drools Expert:
http://docs.jboss.org/drools/release/5.5.0.CR1/drools-expert-docs/html_single/index.html

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.

Best Regards,

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Esteban Aliverti
- Blog @ http://ilesteban.wordpress.com


On Tue, Oct 30, 2012 at 5:26 PM, <reachkn6 at gmail.com> wrote:

>
>
> http://drools.46999.n3.nabble.com/Field-value-is-different-when-and-then-section-very-strange-Is-it-mvel-vs-java-issue-td4020550.html
>
> 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.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20121030/bdb581e0/attachment.html 


More information about the rules-users mailing list