Below is a test to demonstrate it, also add the @PropertyReactive property to
MyClass()

package com.sample;

rule base
when m : MyClass(data == null)
then
end

rule "2" extends base
when
        String()
        MyClass(value != "test") from m
then
        System.out.println("2 fired");
end

rule "1" extends base
salience 1
when
        MyClass(value == null) from m
then
        System.out.println("1 fired");
        insert(new String());
        modify(m) { setValue("test") }
end

The test above should output "1 fired" and "2 fired".
Although we have set the value to "test", rule "2" supposes to not fire, but
it is in fact expected to fire due to the non-reactive property of CE
"from", and the result confirms this.

But if we reorder the code in rule "1" to

rule "1" extends base
salience 1
when
        MyClass(value == null) from m
then
        System.out.println("1 fired");
        modify(m) { setValue("test") }
        insert(new String());
end

Then you get only "1 fired", as if CE "from" is reactive again.
This only happens when you have the @PropertyReactive property added to
MyClass()
Version tested are 5.5.0.Final and 5.6.0.Final

Could the Drools team review this? Thank you.



--
View this message in context: 
http://drools.46999.n3.nabble.com/Inconsistent-output-when-PropertyReactive-is-used-tp4027709.html
Sent from the Drools: User forum mailing list archive at Nabble.com.
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users

Reply via email to