修改事实后,某些规则不会再次触发

时间:2017-12-13 07:16:56

标签: drools bpm

我通过将折扣设置为5来解雇规则。为什么在“规则3”中修改了事实(产品)后,“规则1”不再被触发

输出

规则1 规则2 规则3

规则2 规则3

规则2 规则3

代码

rule "Rule 1"

when
    eval(true)
then
        System.out.println("Rule 1");
end

rule "Rule 2"

when 
    $c: Product(discount < 8 && discount > 3)
then
    System.out.println("Rule 2");

end


rule "Rule 3" 

when
    $c: Product(discount < 8 && discount > 3)
then
    System.out.println("Rule 3");
    modify($c){ 
        setDiscount($c.getDiscount()+1) 
    }

    System.out.println("--------------");
end 

1 个答案:

答案 0 :(得分:1)

不包含LHS模式中的事实类型的规则不会受到未引用类型的任何事实的任何更改的影响。

&#34;规则1&#34;。

中未引用

Product

相关问题