can we add/amends rules (.drl or decision table) at runtime in drools?
For example I created a simple decision table rule, this rule worked fined, however any change in decision table was not reflected in rule evaluation at runtime until the jvm was restarted.
Tried this re-creating the KieSession
was able to do this by creating new KieSession instance as below:
KnowledgeBuilder builder = KnowledgeBuilderFactory.newKnowledgeBuilder(); builder.add(ResourceFactory.newFileResource(), ResourceType.DTABLE); InternalKnowledgeBase knowledgeBase = KnowledgeBaseFactory.newKnowledgeBase(); knowledgeBase.addPackages(builder.getKnowledgePackages()); knowledgeBase.newKieSession(); =====================
the new session was created whenever there was any amend made in the rule
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.