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

I have two main folders: salaryReference and salaryCalculation, each of them has a child package 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.0.52421), it work exactly as i want. only rules from 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

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 is demo project if you want to try it out

Thanks

This question is marked "community wiki".

asked 10.07.2017 at 06:32

trungdv's gravatar image

trungdv
(suspended)
accept rate: 52%

edited 10.07.2017 at 06:50


Hi Trung,

We created a ticket for your issue. We will investigate the problem as soon as possible. If this is a real issue, then it will be fixed in one of the next releases (currently the issue is put into version 7.0 backlog). If we cannot reproduce this issue on our environment. We will come back to you with more information.

In the mean time, you can continue with your workaround by separating the namespaces.

link

answered 19.07.2017 at 04:09

nghia-tran's gravatar image

nghia-tran
(suspended)
accept rate: 0%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×147
×4

Asked: 10.07.2017 at 06:32

Seen: 2,645 times

Last updated: 19.07.2017 at 04:09