It's working now. The key was to provide a change-set location to
KnowledgeAgent and make the agent itself singleton in the app.
public static KnowledgeBase getKnowledgeBase()
throws DroolsParserException, IOException {
// hold a static reference in class
if(agent != null) {
return agent.getKnowledgeBase();
}
ResourceChangeScannerConfiguration sconf =
ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
sconf.setProperty("drools.resource.scanner.interval", "5");
ResourceFactory.getResourceChangeScannerService().configure(sconf);
ResourceFactory.getResourceChangeScannerService().start();
ResourceFactory.getResourceChangeNotifierService().start();
agent = KnowledgeAgentFactory.newKnowledgeAgent("myagent");
agent.applyChangeSet(ResourceFactory.newFileResource("<path>\\change-set.xml"));
return agent.getKnowledgeBase();
}
<change-set
xmlns='http://drools.org/drools-5.0/change-set'
xmlns:xs='http://www.w3.org/2001/XMLSchema-instance'
xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' >
<add>
<resource source='file:<path>/rules/' type='DRL' />
</add>
</change-set>
faruk wrote:
Hi all,
i have same problem with my code. And i implement both cases: with path to
chage-set file and with xml string as You suggests.
I both cases, i have same situation: logs says me that rules are
rebuilded, but when i fire rules, i have next situation:
with statefull session, no rules are fired after update
with stateless session, same rules are fired.
I make rules without conditions.
--
View this message in context:
http://n3.nabble.com/KnowledgeAgent-not-reloading-KnowledgeBase-tp121401p...
Sent from the Drools - User mailing list archive at
Nabble.com.