[rules-users] drools 5.5 property reactive issue

gboro54 gboro54 at gmail.com
Mon Nov 25 08:51:17 EST 2013


I am seeing a weird pattern(or at least unexpected one) when running drools
5.5 in property reactive mode. I have to rules such as:

rule "Rule 1"
  when
       $order:Order(orderType=="A", orderVolume>1000)
  then
      insert(new Charge($order,"code1",-.25));
end

rule "Rule 2"
  when
       $order:Order(orderType=="A")
  then
      insert(new Charge($order,"code2",-.24));
end

rule "Set best price"
  when
     $order:Order($id:id, $setCharge:charge)
     $charge:Charge(orderId=$id,$setCharge==null ||
chargeAmount<$setCharge.chargeAmount)
  then
     modify($order){setCharge($charge)};
end

If I insert and Order of 1001 I see all 3 activations get created, Rule 2
fires first thus triggering set price rule and the activation of Rule 1 is
cancelled. If I add a @watch(charge) to the end of the rules or set up
salience Rule 1 fires.

Could someone help me understand why the firing of Rule 2 and thus the set
best price rule cause rule 1 to get cancelled without the @watch? 



--
View this message in context: http://drools.46999.n3.nabble.com/drools-5-5-property-reactive-issue-tp4026917.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list