The full reason why the second one fires, although it is in the same activation group:
. insert Transaction with amount < 100 . there are activations for both rules . rule 1 fires, cancelling the actication for rule 2 (due to AG "Group1" . rule 1 updates the matched transaction, causing another activation of rule 2 (no-loop prohibits this for rule 1) Advice: * Do not rely on salience, no-loop, activation groups. This is obfuscating your mind, distracting you from the basics, i.e., logic. * Add constraints, clearly outlining the case when 1 and when 2 should fire. rule 1: $tx:Transaction(amount < 100, ! status) rule 2: $tx:Transaction(amount >= 100 ) -W On 28/03/2014, Nicolas Héron <nicolas.heron.j...@gmail.com> wrote: > Hi > why should rule2 be ignored ? > when $tx:Transaction(); > So it is true whatever is in transaction. > Cheers > Nicolas > > > 2014-03-28 16:37 GMT+01:00 007reader [via Drools] < > ml-node+s46999n4029009...@n3.nabble.com>: > >> I have a group of rules marked with "activation-group" where I want only >> one rule to fire and ignore the rest. I also want to evaluate rules in >> particular order, so I use salience to prioritize the rules within the >> group. Here are my rules: >> >> rule "rule1" >> no-loop >> salience 100 >> activation-group "Group1" >> when >> $tx:Transaction(amount < 100); >> then >> $tx.setStatus(true); >> update($tx); >> end >> >> rule "rule2" >> salience -50 >> activation-group "Group1" >> when >> $tx:Transaction(); >> then >> System.out.println("catch all: "+$tx.toString()); >> end >> >> I expect that if Transaction amount<100, then rule1 will fire, and rule2 >> ignored. However both rules get executed. What am I doing wrong? >> >> Thx >> >> ------------------------------ >> If you reply to this email, your message will be added to the discussion >> below: >> >> http://drools.46999.n3.nabble.com/Activation-group-and-salience-tp4029009.html >> To start a new topic under Drools: User forum, email >> ml-node+s46999n47000...@n3.nabble.com >> To unsubscribe from Drools, click >> here<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=46999&code=bmljb2xhcy5oZXJvbi5qYXZhQGdtYWlsLmNvbXw0Njk5OXwxMzk3MTU0MDQw> >> . >> NAML<http://drools.46999.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> >> > > > > > ----- > Nicolas Héron > -- > View this message in context: > http://drools.46999.n3.nabble.com/Activation-group-and-salience-tp4029009p4029012.html > Sent from the Drools: User forum mailing list archive at Nabble.com. _______________________________________________ rules-users mailing list rules-users@lists.jboss.org https://lists.jboss.org/mailman/listinfo/rules-users