unconfigAgent.applyChangeSet(ResourceFactory.newClassPathResource(getDroolsRuleSet())); ResourceChangeScannerConfiguration sconf = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration(); sconf.setProperty( "drools.resource.scanner.interval", Integer.toString(getUpdateInterval()) ); ResourceFactory.getResourceChangeScannerService().configure( sconf );
String drsi = Strings.trimToNull(System.getProperty(DROOLS_RESOURCE_SCANNER_INTERVAL)); if (drsi != null && !drsi.equals("60")) { ResourceChangeScannerConfiguration rcs_conf = rcs.newResourceChangeScannerConfiguration(); rcs_conf.setProperty(DROOLS_RESOURCE_SCANNER_INTERVAL, drsi); rcs.configure(rcs_conf);
protected KnowledgeAgent buildKnowledgeAgent(GuvnorConnectionUtils guvnorUtils) { try { ResourceChangeScannerConfiguration sconf = ResourceFactory.getResourceChangeScannerService().newResourceChangeScannerConfiguration(); sconf.setProperty( "drools.resource.scanner.interval", "10" ); ResourceFactory.getResourceChangeScannerService().configure( sconf ); ResourceFactory.getResourceChangeScannerService().start(); ResourceFactory.getResourceChangeNotifierService().start(); KnowledgeAgentConfiguration aconf = KnowledgeAgentFactory.newKnowledgeAgentConfiguration(); aconf.setProperty("drools.agent.newInstance", "false"); KnowledgeAgent kagent = KnowledgeAgentFactory.newKnowledgeAgent("Guvnor default", aconf); kagent.applyChangeSet(ResourceFactory.newReaderResource(guvnorUtils.createChangeSet())); return kagent; } catch (Throwable t) { logger.error("Could not load processes from Guvnor: " + t.getMessage(), t); return null; } } }