Chandresh Mishra
Chandresh Mishra

Reputation: 1189

Modify keyword not working Drools

I am testing infinite loops using Modify keyword.

But it is not re triggering the rule.

Rule 1:

rule "Entitle for promotion"

when
$i: EmployeeFinancialFact(rating==Rating.ONE.getRating())
then
  PromotionFact $promotion=new PromotionFact($i.getEmpID(),$i.getEmpName());
  insert($promotion);
end

Rule 2:

rule "Print EmployeeFinancialFact name entitled for promotion"

when
$p:  PromotionFact()
then
modify($p) {setSentForApproval(true);}
end

I am expecting RHS of rule 2 will re-trigger the rule 2 again but it is getting fired only once.

Can anyone please tell me the reason.

Upvotes: 1

Views: 996

Answers (2)

Chandresh Mishra
Chandresh Mishra

Reputation: 1189

Disable property reactive in Kmodule.xml in Drools 7 by adding following lines:

<configuration>
  <property key="drools.propertySpecific" value="ALLOWED"/>
</configuration>

Upvotes: 1

Esteban Aliverti
Esteban Aliverti

Reputation: 6322

The first obvious question would be if you are sure your rules are indeed getting executed (sounds like a silly question, but it has solved many many issues here in SO).

Some other relevant questions are:

  • which version of Drools are you using?
  • Is PromotionFact a java class? or a defined declaration in your DRL?
  • Do you know if Property Reactive is enabled in your kbase? It used to be disabled in versions < 7, but since version 7 is enabled by default.

Hope it helps,

Upvotes: 1

Related Questions