drools-incremental-update's People
Forkers
xntric78 phamthaithinh yerzhanm nathane2005 maventalker emrebulbul23 kumarshorav11 kjq sergevas will-yedrools-incremental-update's Issues
Need advice on specific use case of adding rules dynamically
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
Drools 6.3.0.Final
Any chance you are going to update this to work with Drools 6.3.0.Final? I attempted on my own but am having trouble getting past some null pointers that it throws when you update. For example running KieSessionRulesIncrementalUpdateAddedRulesTest#testAddedRulesDifferentDrl()
gives a stacktrace like the following:
java.lang.NullPointerException
at org.drools.core.reteoo.NodeTypeEnums.isBetaNode(NodeTypeEnums.java:88)
at org.drools.core.phreak.RuleNetworkEvaluator.innerEval(RuleNetworkEvaluator.java:254)
at org.drools.core.phreak.RuleNetworkEvaluator.outerEval(RuleNetworkEvaluator.java:166)
at org.drools.core.phreak.RuleNetworkEvaluator.evaluateNetwork(RuleNetworkEvaluator.java:123)
at org.drools.core.phreak.RuleExecutor.reEvaluateNetwork(RuleExecutor.java:194)
at org.drools.core.phreak.RuleExecutor.evaluateNetworkAndFire(RuleExecutor.java:73)
at org.drools.core.common.DefaultAgenda.fireNextItem(DefaultAgenda.java:978)
at org.drools.core.common.DefaultAgenda.fireAllRules(DefaultAgenda.java:1292)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.internalFireAllRules(StatefulKnowledgeSessionImpl.java:1294)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1281)
at org.drools.core.impl.StatefulKnowledgeSessionImpl.fireAllRules(StatefulKnowledgeSessionImpl.java:1260)
at org.jboss.ddoyle.drools.demo.KieSessionRulesIncrementalUpdateAddedRulesTest.testAddedRulesDifferentDrl(KieSessionRulesIncrementalUpdateAddedRulesTest.java:125)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:78)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:212)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.