what is the difference between no-loop and lock-on-active in drools

Anil Kumar picture Anil Kumar · Jun 11, 2013 · Viewed 16.9k times · Source

Here is an example of a rule that uses "no-loop":

rule "Even Number Rule"   
dialect "java"  
no-loop  
      when  
       n : Number( number !=0 && (number%2)==0 , value : number)  
    then  
        modify(n){setNumber(8)};  
      end

Answer

Esteban Aliverti picture Esteban Aliverti · Jun 11, 2013

Long story short:

  • no-loop: avoid the re-activation of a rule caused by the RHS of that SAME rule.
  • lock-on-active: avoid the re-activation of a rule NO MATTER what the cause is.

Long story: http://ilesteban.wordpress.com/2012/11/16/about-drools-and-infinite-execution-loops/

Hope it helps,