Source:
public void initialize() throws Exception { KieServices ks = KieServices.Factory.get(); KieFileSystem kFileSystem = ks.newKieFileSystem(); loadRules(kFileSystem); KieBuilder kbuilder = ks.newKieBuilder( kFileSystem ); kbuilder.buildAll(); if (kbuilder.getResults().hasMessages(org.kie.api.builder.Message.Level.ERROR)) { LOG.warn("Unable to initialize Drools engine: {}", kbuilder.getResults().getMessages(Level.ERROR)); throw new IllegalStateException("Unable to initialize Drools engine: " + kbuilder.getResults().getMessages(Level.ERROR)); } KieContainer kContainer = ks.newKieContainer(ks.getRepository().getDefaultReleaseId()); AssertBehaviour behaviour = AssertBehaviour.determineAssertBehaviour(m_assertBehaviour); RuleBaseConfiguration ruleBaseConfig = new RuleBaseConfiguration(); ruleBaseConfig.setAssertBehaviour(behaviour); EventProcessingOption eventProcessingOption = EventProcessingOption.CLOUD; if (m_eventProcessingMode != null && m_eventProcessingMode.toLowerCase().equals("stream")) { eventProcessingOption = EventProcessingOption.STREAM; m_isStreaming = true; } ruleBaseConfig.setEventProcessingMode(eventProcessingOption); m_kieBase = kContainer.newKieBase(ruleBaseConfig); m_kieSession = m_kieBase.newKieSession(); m_kieSession.setGlobal("engine", this); for (final Map.Entry<String, Object> entry : m_globals.entrySet()) { m_kieSession.setGlobal(entry.getKey(), entry.getValue()); } if (m_persistState != null && m_persistState) { unmarshallStateFromDisk(true); } if (m_isStreaming) { new Thread(() -> { Logging.putPrefix(getClass().getSimpleName() + '-' + getName()); try { m_kieSession.fireUntilHalt(); } catch (Exception e) { LOG.error("Exception while running rules, reloading engine ", e); reloadConfig(); } }, "FireTask").start(); } }

Target:
public void initialize() throws Exception { KieServices ks = KieServices.Factory.get(); KieFileSystem kFileSystem = ks.newKieFileSystem(); loadRules(kFileSystem); KieBuilder kbuilder = ks.newKieBuilder( kFileSystem ); kbuilder.buildAll(); if (kbuilder.getResults().hasMessages(org.kie.api.builder.Message.Level.ERROR)) { LOG.warn("Unable to initialize Drools engine: {}", kbuilder.getResults().getMessages(Level.ERROR)); throw new IllegalStateException("Unable to initialize Drools engine: " + kbuilder.getResults().getMessages(Level.ERROR)); } KieContainer kContainer = ks.newKieContainer(ks.getRepository().getDefaultReleaseId()); AssertBehaviour behaviour = AssertBehaviour.determineAssertBehaviour(m_assertBehaviour); RuleBaseConfiguration ruleBaseConfig = new RuleBaseConfiguration(); ruleBaseConfig.setAssertBehaviour(behaviour); EventProcessingOption eventProcessingOption = EventProcessingOption.CLOUD; if (m_eventProcessingMode != null && m_eventProcessingMode.toLowerCase().equals("stream")) { eventProcessingOption = EventProcessingOption.STREAM; m_isStreaming = true; } ruleBaseConfig.setEventProcessingMode(eventProcessingOption); m_kieBase = kContainer.newKieBase(ruleBaseConfig); m_kieSession = m_kieBase.newKieSession(); m_kieSession.setGlobal("engine", this); for (final Map.Entry<String, Object> entry : m_globals.entrySet()) { m_kieSession.setGlobal(entry.getKey(), entry.getValue()); } if (m_persistState != null && m_persistState) { unmarshallStateFromDisk(true); } if (m_isStreaming) { new Thread(() -> { Logging.putPrefix(getClass().getSimpleName() + '-' + getName()); try { m_kieSession.fireUntilHalt(); } catch (Exception e) { LOG.error("Exception while running rules, reloading engine ", e); triggerAlarm(e); reloadConfig(); } }, "FireTask").start(); } }