Property reactivity inconsistent behavior when modify-block is placed inside a block like if-block in RHS
Issue
When modify-block is placed inside a block like if-block in RHS (then-clause),
if (<condition>) {
modify(<fact object>) {
<property> = <value>
}
}
the modify does not work correctly in non-executable model. For example, when I execute the Java code (*2) with the rules (*1), value1 property is modified to 2 in then-clause of Rule 1 so the rule Rule 2 should be fired like (*3-1) but actually not fired like (*3-2).
(*1) Example rules
dialect "mvel"
rule "Rule 1"
when
$fact : Fact( value1 == 1 )
then
System.out.println("***** Action of " + drools.getRule().getName() + ": $fact = " + $fact);
if (true) {
modify($fact) {
value1 = 2
}
}
end
rule "Rule 2"
when
$fact : Fact( value1 == 2 )
then
System.out.println("***** Action of " + drools.getRule().getName() + ": $fact = " + $fact);
end
(*2) Example Java code
KieServices kServices = KieServices.Factory.get();
KieContainer kContainer = kServices.getKieClasspathContainer();
KieSession kSession = kContainer.newKieSession();
Fact fact = new Fact();
fact.setValue1(1);
kSession.insert(fact);
System.out.println("***** start");
kSession.fireAllRules();
System.out.println("***** end");
(*3-1) Expected result
***** start
***** Action of Rule 1: $fact = com.example.reproducer.Fact[value=1]
***** Action of Rule 2: $fact = com.example.reproducer.Fact[value=2]
***** end
(*3-2) Actual result
***** start
***** Action of Rule 1: $fact = com.example.reproducer.Fact[value=1]
***** end
Environment
- Red Hat Decision Manager (RHDM)
- 7.10.1 - 7.13.3
- Red Hat Process Automation Manager (RHPAM)
- 7.10.1 - 7.13.3
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.