Different mechanism of loading rule between Designer and Engine
Hi all
I have a project that using api *ivy.rules.engine* to execute Drool rule, i just found a difference between Designer and Engine about the way it load rule package.
Here is folder rule i have:
![alt text][1]
I have two main folders: salaryReference and salaryCalculation, *salaryReference* and *salaryCalculation*, each of them has a child package name demo. called *demo*.
Here is the code that i load those rule bases:
//salaryRuleBase and basicSalaryRuleBase are IRuleBase type
in.salaryRuleBase = ivy.rules.engine.createRuleBase();
in.salaryRuleBase.loadRulesFromNamespace("salaryCalculation");
in.basicSalaryRuleBase = ivy.rules.engine.createRuleBase();
in.basicSalaryRuleBase.loadRulesFromNamespace("salaryReference");
Those two rule base only need to load main package (not childs). To be sure that it load correct package, i put two test rules on child packages, ex:
import ch.ivyteam.ivy.environment.Ivy;
rule "SalaryCal.demo"
when
then
Ivy.log().info("=========Rule SalaryCal.demo");
end
and
import ch.ivyteam.ivy.environment.Ivy;
rule "SalaryRef.demo"
when
then
Ivy.log().info("=========Rule SalaryRef.demo");
end
When executing this code on Designer (Axon ivy 6.3), it work exactly as i want. only rules from salaryCalculation/basic.drl and salaryReference/default.drl *salaryCalculation/basic.drl* and *salaryReference/default.drl* are loaded and executed. I don't see any logs from test rules.
But when i deploy this project to server(same version with Designer) , i saw this line:
![alt text][2]
That a big trouble in our real project because we separate rule by packages and somehow expect rule engine will only load package that we set to them, non recursively.
Do you know why do we have this difference? it's quite confused and strange to us
[Here][3] is demo project if you want to try it out
Thanks
[1]: http://answers.axonivy.com/upfiles/Untitled_RkIO6RW.png
[2]: http://answers.axonivy.com/upfiles/Untitled_iNiDG64.png
[3]: https://drive.google.com/file/d/0B6qldkZvvHgHRWM5X1dWb1VvM1k/view?usp=sharing