https://github.com/droolsjbpm/drools/blob/master/drools-compiler/src/test/java/org/drools/compiler/integrationtests/DynamicRulesTest.java
On 23 Jul 2013, at 17:26, tiahdomoina <[email protected]> wrote: > 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-KnowledgeBase-tp4025108.html > Sent from the Drools: User forum mailing list archive at Nabble.com. > _______________________________________________ > rules-users mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/rules-users _______________________________________________ rules-users mailing list [email protected] https://lists.jboss.org/mailman/listinfo/rules-users
