I have 4 drl files in my app. Loading all the 4 files during application startup.
If any rule is satisfied in File 1,I don't want File 2 be called.Should execute File 3 and 4.
If rules in File 1 is not satisfied,want to call File 2 then File 3 and 4.

At present I am doing this way.Please let me know if this is ok or if there is any better solution.

Set an attribute when a rule is satisfied. (attribute is not dummy,I need it in my app)
Attribute is checked in each and every if it is null.


Example File1.drl contains 2 rules.If first rule is satisfied, don't want to execute second rule.So setting rule with a valid number.


File1.drl

rule "1.Age Factor and Junior"
     when
          d : CustomerDetail( rule == "" && sale == 'Junior' && age in ("16","17"))
     then        
     System.out.println("Junior and Age Satisfied ");
      d.setRule("1");
end

rule "2.Junior only Age Factor"
     when
          m : CustomerDetail( rule == "" && age in ("16","17"))
     then         
      System.out.println("Only junior Age satisfied.");
      m.setRule("2");
end

 

File2.drl

rule "3.Age Factor and Senior"
     when
          d : CustomerDetail( rule == "" && sale == 'Senior' && age in ("70","75"))
     then        
     System.out.println("Senior and Age Satisfied ");
      d.setRule("10");
end

rule "4.Senior only Age Factor "
     when
          m : CustomerDetail( rule == "" && age in ("70","75"))
     then         
      System.out.println("Only senior Age satisfied.");
      m.setRule("11");
end

This one works but is it possible , If the rule 1 is satisfied, rule2 is still executed.Is there any way we can stop rule2 from beinge executed? Similary stop File2.drl being executed. Any suggestions?