protected void enableEngineAction( String streamName, EngineActionType engineActionType, Map<String, Object> engineActionParams, StreamOperationServiceWithoutMetrics streamOperationService) { if (!streamStatusDao.isEngineActionEnabled(streamName, engineActionType)) { String engineActionQueryId = siddhiManager.addQuery( QueryFactory.createQuery() .from(QueryFactory.inputStream(streamName)) .insertInto(STREAMING.STATS_NAMES.SINK_STREAM_PREFIX.concat(streamName))); BaseEngineAction engineAction = null; if (engineActionType == EngineActionType.FIRE_RULES) { engineAction = new DroolsEngineAction( droolsConnectionContainer, engineActionParams, siddhiManager, streamOperationService); } siddhiManager.addCallback( engineActionQueryId, callbackService.addEngineCallback(streamName, engineActionType, engineAction)); streamStatusDao.enableEngineAction( streamName, engineActionType, engineActionParams, engineActionQueryId); } }
public void disableEngineAction(String streamName, EngineActionType engineActionType) { if (streamStatusDao.isEngineActionEnabled(streamName, engineActionType)) { String engineActionQueryId = streamStatusDao.getEngineActionQueryId(streamName, engineActionType); if (engineActionQueryId != null) { siddhiManager.removeQuery(engineActionQueryId); } streamStatusDao.disableEngineAction(streamName, engineActionType); callbackService.removeEngineAction(streamName, engineActionType); } }