Skip to content

Instantly share code, notes, and snippets.

@mpellegrini
Created November 4, 2011 17:51
Show Gist options
  • Save mpellegrini/1339995 to your computer and use it in GitHub Desktop.
Save mpellegrini/1339995 to your computer and use it in GitHub Desktop.
Configuring a Drools KnowledgeAgent
KnowledgeAgentConfiguration agentConf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration();
agentConf.setProperty("drools.agent.newInstance", "false");
// scan every second
ResourceChangeScannerConfiguration config = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration();
config.setProperty("drools.resource.scanner.interval", "1");
ResourceFactory.getResourceChangeScannerService().configure(config);
KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("problem", agentConf);
//Resource resource = ResourceFactory.newFileResource("resources/change-se.xml");
Resource resource = ResourceFactory.newClassPathResource("change-set.xml");
kagent.applyChangeSet(resource);
KnowledgeBase kbase = kagent.getKnowledgeBase();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment