[rules-users] @propertyReactive not work when condition are coded in java

Davide Sottara dsotty at gmail.com
Mon May 26 13:05:52 EDT 2014


The engine analyzes the constraints to see which property a pattern is
"watching":

So, it expects something like:
Person( name == "alice" )

If you invoke your custom logic:
Person( myEqualComparator( ..., name, ... ) )
it's unlikely that the engine will recognize that a field is involved
and, even then, that it should react to.

The simplest solution is to force the pattern to react to the field,
doing either:

Person( myEqual(...), $n : name )

or, in alternative:

Person( myEqual(...) ) @watch( name )

Please let us know if it works for you.
Thanks
Davide


On 05/22/2014 02:49 PM, wtang wrote:
> I have rule1 and rule2 and rule1 is modifying an object whose property is
> checked in the when part of rule2 and rule2 should fire.
>
> The problem is rule2 is not firing.  When I took out the @PropertyReactive
> annotation, then rule2 will fire.
>
> After further investigation, I find the cause is because in the when part I
> am calling java function to do the comparison as suppose to using native
> operators like "==".
>
> Property Reactive seems to be not working when in the WHEN part of the rules
> we are calling java function to do the comparison as suppose to using native
> operators like ==, <, >, etc.  
>
> Please advice.
>
>
>
> --
> View this message in context: http://drools.46999.n3.nabble.com/propertyReactive-not-work-when-condition-are-coded-in-java-tp4029657.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



More information about the rules-users mailing list