use of org.opennms.netmgt.correlation.drools.ConfigFileApplicationContext in project opennms by OpenNMS.
the class RuleSet method constructEngine.
public CorrelationEngine constructEngine(Resource basePath, ApplicationContext appContext, EventIpcManager eventIpcManager, MetricRegistry metricRegistry) {
final ApplicationContext configContext = new ConfigFileApplicationContext(basePath, getConfigLocation(), appContext);
final DroolsCorrelationEngine engine = new DroolsCorrelationEngine(getName(), metricRegistry);
engine.setAssertBehaviour(getAssertBehaviour());
engine.setEventProcessingMode(getEventProcessingMode());
engine.setPersistState(getPersistState());
engine.setEventIpcManager(eventIpcManager);
engine.setScheduler(new ScheduledThreadPoolExecutor(1));
engine.setInterestingEvents(getInterestingEvents());
engine.setRulesResources(getRuleResources(configContext));
engine.setGlobals(getGlobals(configContext));
try {
engine.initialize();
return engine;
} catch (final Throwable e) {
throw new RuntimeException("Unable to initialize Drools engine " + getName(), e);
}
}
Aggregations