[rules-users] same criteria across multiple rules cancels activation with Property Reactive Facts

m11 mchanian at hotmail.com
Fri Dec 14 07:29:48 EST 2012


I have come across a problem of unexpected cancels on activations when using
property reactive facts. The problem occurs  if two or more rules have the
same criteria. I have uploaded all the files and a unit test to show this
using a very simple bare bones example: 

pom.xml <http://drools.46999.n3.nabble.com/file/n4021204/pom.xml>  
log4j.properties
<http://drools.46999.n3.nabble.com/file/n4021204/log4j.properties>  
modify-test.drl
<http://drools.46999.n3.nabble.com/file/n4021204/modify-test.drl>  
SampleBean.java
<http://drools.46999.n3.nabble.com/file/n4021204/SampleBean.java>  
RuleRunner.java
<http://drools.46999.n3.nabble.com/file/n4021204/RuleRunner.java>  
RulesLogger.java
<http://drools.46999.n3.nabble.com/file/n4021204/RulesLogger.java>  
ModifyTest.java
<http://drools.46999.n3.nabble.com/file/n4021204/ModifyTest.java>  

Running ModifyTest.java produces the following logs: 

0    [main] DEBUG com.demo.rules.session.RulesLogger  - Activation created
calculate y
 1    [main] DEBUG com.demo.rules.session.RulesLogger  - Activation created
calculate x
 2    [main] DEBUG com.demo.rules.session.RulesLogger  - Before Activation
fired calculate x
 4    [main] DEBUG com.demo.rules.session.RulesLogger  - Activation
cancelled calculate y
 6    [main] DEBUG com.demo.rules.session.RulesLogger  - After Activation
fired [Activation rule=calculate x, act#=1, salience=0, tuple=[fact
0:2:42753698:30752:3:DEFAULT:SampleBean [x=10, y=null, id=1]]
]
 
The activations have been created as expected but an activation on a rule is
cancelled unexpectedily as indicated by log statement 4. Why is this?

If all the rules have a different criteria then all works fine.  If i dont
use property reactive facts then it works. It looks like this is a bug, can
someone confirm this ? 

We have some edge case scenarios in our rules where it is possible for some
rules to end up with the same criteria. We dont want to force the business
analysts to have to merge the rules as we have a very large number of rules,
and it will be very hard for them to track the criteria for each rule. 

If it is not a bug can someone please provide the rational reason why it is
sensible to have the activation cancelled. 



--
View this message in context: http://drools.46999.n3.nabble.com/same-criteria-across-multiple-rules-cancels-activation-with-Property-Reactive-Facts-tp4021204.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list