Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need advice on specific use case of adding rules dynamically #2

Open
AdVanOmmen opened this issue May 28, 2018 · 0 comments
Open

Need advice on specific use case of adding rules dynamically #2

AdVanOmmen opened this issue May 28, 2018 · 0 comments

Comments

@AdVanOmmen
Copy link

AdVanOmmen commented May 28, 2018

Hi Duncan,

Your drools-incremental-update project is very instructive. I tried to adapt it to the following use case in the latest 7.7.0.Final release of Drools:

  • We have a (k) jar publishing a compiled set of bpmn and drl files. It has a name of "rules".
  • In another maven project we add this as a dependency to create one Kiebase with using the KieServices getKieClassPathContainer() and getKieBaseModel("rules") to repeatibly create a KieSession from it with newKieSession();

Now for the more difficult part:

  • We would like to use this in a web application where the user may type an additional rule or two. These rules should be combined with the basic KieBase, so we can run drools with this and server the results to the user.
  • This seems to call for a dynamic/programmatic build of this newly combined Kiebase.

Our first attempt was to build on the code in this project by creating a new KieBaseModel named "customrules" and use the addInclude into the kmodel.xml with the name "rules" into the KieFileSystem together with the additional drl

Via the KieBuilder created from this KieFIleSystem this did not work as expected: showing in the results:

Error Messages:
Message [id=1, kieBase=customrules, level=ERROR, path=src/main/resources/META-INF/kmodule.xml, line=0, column=0
   text=Unable to build KieBase, could not find include: rules]

In the same method it proved easy to get to the "rules" by creating a KieClassPathContainer and invocation of getKieBase("rules")

Regards,
Ad van Ommen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant