Hello :)
How can I manage dynamically rules in KnowledgeBase ? I mean remove, add or
update rules without rebuilding a new KnowledgeBase or a new
KnowledgeSession. Is it possible ?
I tried with a basic example:
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("rule.DRL"),
ResourceType.DRL);
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
// insertion of facts
ksession.fireAllRules();
kbase.removeRule("package", "myRule");
ksession.fireAllRules();
But the rules don't seem to be fired the second time. I also tried to create
a new session but the result is the same.
I don't wanna use a KnowledgeAgent because the modification of the rules is
not very frequent.
But when there is one, it has to be applied immediately and shouldn't wait
for the interval of time of the scan.
If anyone has an idea :)
Thank you !
--
View this message in context:
http://drools.46999.n3.nabble.com/Manage-dynamically-rules-in-KnowledgeBa...
Sent from the Drools: User forum mailing list archive at
Nabble.com.