use of io.siddhi.core.query.output.ratelimit.PassThroughOutputRateLimiter in project siddhi by wso2.
the class OnDemandQueryParser method populateFindOnDemandQueryRuntime.
private static void populateFindOnDemandQueryRuntime(FindOnDemandQueryRuntime findOnDemandQueryRuntime, MatchingMetaInfoHolder metaStreamInfoHolder, Selector selector, List<VariableExpressionExecutor> variableExpressionExecutors, Map<String, Table> tableMap, Map<String, Window> windowMap, int metaPosition, boolean groupBy, LockWrapper lockWrapper, SiddhiQueryContext siddhiQueryContext) {
ReturnStream returnStream = new ReturnStream(OutputStream.OutputEventType.CURRENT_EVENTS);
QuerySelector querySelector = SelectorParser.parse(selector, returnStream, metaStreamInfoHolder.getMetaStateEvent(), tableMap, variableExpressionExecutors, metaPosition, ProcessingMode.BATCH, false, siddhiQueryContext);
PassThroughOutputRateLimiter rateLimiter = new PassThroughOutputRateLimiter(siddhiQueryContext.getName());
rateLimiter.init(lockWrapper, groupBy, siddhiQueryContext);
OutputCallback outputCallback = OutputParser.constructOutputCallback(returnStream, metaStreamInfoHolder.getMetaStateEvent().getOutputStreamDefinition(), tableMap, windowMap, true, siddhiQueryContext);
rateLimiter.setOutputCallback(outputCallback);
querySelector.setNextProcessor(rateLimiter);
QueryParserHelper.reduceMetaComplexEvent(metaStreamInfoHolder.getMetaStateEvent());
QueryParserHelper.updateVariablePosition(metaStreamInfoHolder.getMetaStateEvent(), variableExpressionExecutors);
querySelector.setEventPopulator(StateEventPopulatorFactory.constructEventPopulator(metaStreamInfoHolder.getMetaStateEvent()));
findOnDemandQueryRuntime.setStateEventFactory(new StateEventFactory(metaStreamInfoHolder.getMetaStateEvent()));
findOnDemandQueryRuntime.setSelector(querySelector);
findOnDemandQueryRuntime.setOutputAttributes(metaStreamInfoHolder.getMetaStateEvent().getOutputStreamDefinition().getAttributeList());
}
use of io.siddhi.core.query.output.ratelimit.PassThroughOutputRateLimiter in project siddhi by wso2.
the class OnDemandQueryParser method getQuerySelector.
private static QuerySelector getQuerySelector(MatchingMetaInfoHolder matchingMetaInfoHolder, List<VariableExpressionExecutor> variableExpressionExecutors, Map<String, Table> tableMap, Map<String, Window> windowMap, int metaPosition, OnDemandQuery onDemandQuery, LockWrapper lockWrapper, SiddhiQueryContext siddhiQueryContext) {
QuerySelector querySelector = SelectorParser.parse(onDemandQuery.getSelector(), onDemandQuery.getOutputStream(), matchingMetaInfoHolder.getMetaStateEvent(), tableMap, variableExpressionExecutors, metaPosition, ProcessingMode.BATCH, false, siddhiQueryContext);
PassThroughOutputRateLimiter rateLimiter = new PassThroughOutputRateLimiter(siddhiQueryContext.getName());
rateLimiter.init(lockWrapper, !onDemandQuery.getSelector().getGroupByList().isEmpty(), siddhiQueryContext);
OutputCallback outputCallback = OutputParser.constructOutputCallback(onDemandQuery.getOutputStream(), matchingMetaInfoHolder.getMetaStateEvent().getOutputStreamDefinition(), tableMap, windowMap, true, siddhiQueryContext);
rateLimiter.setOutputCallback(outputCallback);
querySelector.setNextProcessor(rateLimiter);
QueryParserHelper.reduceMetaComplexEvent(matchingMetaInfoHolder.getMetaStateEvent());
QueryParserHelper.updateVariablePosition(matchingMetaInfoHolder.getMetaStateEvent(), variableExpressionExecutors);
querySelector.setEventPopulator(StateEventPopulatorFactory.constructEventPopulator(matchingMetaInfoHolder.getMetaStateEvent()));
return querySelector;
}
Aggregations