Search in sources :

Example 11 with SiddhiAppContext

use of org.wso2.siddhi.core.config.SiddhiAppContext in project siddhi by wso2.

the class AllAggregationPerSnapshotOutputRateLimiter method start.

@Override
public void start() {
    scheduler = SchedulerParser.parse(scheduledExecutorService, this, siddhiAppContext);
    scheduler.setStreamEventPool(new StreamEventPool(0, 0, 0, 5));
    scheduler.init(lockWrapper, queryName);
    long currentTime = System.currentTimeMillis();
    scheduledTime = currentTime + value;
    scheduler.notifyAt(scheduledTime);
}
Also used : StreamEventPool(org.wso2.siddhi.core.event.stream.StreamEventPool)

Example 12 with SiddhiAppContext

use of org.wso2.siddhi.core.config.SiddhiAppContext in project siddhi by wso2.

the class GroupByPerSnapshotOutputRateLimiter method start.

@Override
public void start() {
    scheduler = SchedulerParser.parse(scheduledExecutorService, this, siddhiAppContext);
    scheduler.setStreamEventPool(new StreamEventPool(0, 0, 0, 5));
    scheduler.init(lockWrapper, queryName);
    long currentTime = System.currentTimeMillis();
    scheduledTime = currentTime + value;
    scheduler.notifyAt(scheduledTime);
}
Also used : StreamEventPool(org.wso2.siddhi.core.event.stream.StreamEventPool)

Example 13 with SiddhiAppContext

use of org.wso2.siddhi.core.config.SiddhiAppContext in project siddhi by wso2.

the class JoinStreamRuntime method clone.

@Override
public StreamRuntime clone(String key) {
    JoinStreamRuntime joinStreamRuntime = new JoinStreamRuntime(siddhiAppContext, metaStateEvent);
    for (SingleStreamRuntime singleStreamRuntime : singleStreamRuntimeList) {
        joinStreamRuntime.addRuntime((SingleStreamRuntime) singleStreamRuntime.clone(key));
    }
    SingleStreamRuntime leftSingleStreamRuntime = joinStreamRuntime.getSingleStreamRuntimes().get(0);
    SingleStreamRuntime rightSingleStreamRuntime = joinStreamRuntime.getSingleStreamRuntimes().get(1);
    Processor lastLeftProcessor = leftSingleStreamRuntime.getProcessorChain();
    while (!(lastLeftProcessor instanceof JoinProcessor)) {
        lastLeftProcessor = lastLeftProcessor.getNextProcessor();
    }
    JoinProcessor leftPreJoinProcessor = (JoinProcessor) lastLeftProcessor;
    WindowProcessor leftWindowProcessor = (WindowProcessor) leftPreJoinProcessor.getNextProcessor();
    JoinProcessor leftPostJoinProcessor = (JoinProcessor) leftWindowProcessor.getNextProcessor();
    Processor lastRightProcessor = rightSingleStreamRuntime.getProcessorChain();
    while (!(lastRightProcessor instanceof JoinProcessor)) {
        lastRightProcessor = lastRightProcessor.getNextProcessor();
    }
    JoinProcessor rightPreJoinProcessor = (JoinProcessor) lastRightProcessor;
    WindowProcessor rightWindowProcessor = (WindowProcessor) rightPreJoinProcessor.getNextProcessor();
    JoinProcessor rightPostJoinProcessor = (JoinProcessor) rightWindowProcessor.getNextProcessor();
    rightPostJoinProcessor.setFindableProcessor((FindableProcessor) leftWindowProcessor);
    rightPreJoinProcessor.setFindableProcessor((FindableProcessor) leftWindowProcessor);
    leftPreJoinProcessor.setFindableProcessor((FindableProcessor) rightWindowProcessor);
    leftPostJoinProcessor.setFindableProcessor((FindableProcessor) rightWindowProcessor);
    return joinStreamRuntime;
}
Also used : FindableProcessor(org.wso2.siddhi.core.query.processor.stream.window.FindableProcessor) Processor(org.wso2.siddhi.core.query.processor.Processor) WindowProcessor(org.wso2.siddhi.core.query.processor.stream.window.WindowProcessor) SingleStreamRuntime(org.wso2.siddhi.core.query.input.stream.single.SingleStreamRuntime) WindowProcessor(org.wso2.siddhi.core.query.processor.stream.window.WindowProcessor)

Example 14 with SiddhiAppContext

use of org.wso2.siddhi.core.config.SiddhiAppContext in project siddhi by wso2.

the class AbsentLogicalPreStateProcessor method cloneProcessor.

@Override
public PreStateProcessor cloneProcessor(String key) {
    AbsentLogicalPreStateProcessor logicalPreStateProcessor = new AbsentLogicalPreStateProcessor(logicalType, stateType, withinStates, waitingTimeConstant);
    cloneProperties(logicalPreStateProcessor, key);
    logicalPreStateProcessor.init(siddhiAppContext, queryName);
    // Set the scheduler
    siddhiAppContext.addEternalReferencedHolder(logicalPreStateProcessor);
    EntryValveProcessor entryValveProcessor = new EntryValveProcessor(siddhiAppContext);
    entryValveProcessor.setToLast(logicalPreStateProcessor);
    Scheduler scheduler = SchedulerParser.parse(siddhiAppContext.getScheduledExecutorService(), entryValveProcessor, siddhiAppContext);
    logicalPreStateProcessor.setScheduler(scheduler);
    return logicalPreStateProcessor;
}
Also used : Scheduler(org.wso2.siddhi.core.util.Scheduler) EntryValveProcessor(org.wso2.siddhi.core.query.input.stream.single.EntryValveProcessor)

Example 15 with SiddhiAppContext

use of org.wso2.siddhi.core.config.SiddhiAppContext in project siddhi by wso2.

the class AbsentStreamPreStateProcessor method cloneProcessor.

@Override
public PreStateProcessor cloneProcessor(String key) {
    AbsentStreamPreStateProcessor streamPreStateProcessor = new AbsentStreamPreStateProcessor(stateType, withinStates, waitingTimeConstant);
    cloneProperties(streamPreStateProcessor, key);
    streamPreStateProcessor.init(siddhiAppContext, queryName);
    // Set the scheduler
    siddhiAppContext.addEternalReferencedHolder(streamPreStateProcessor);
    EntryValveProcessor entryValveProcessor = new EntryValveProcessor(siddhiAppContext);
    entryValveProcessor.setToLast(streamPreStateProcessor);
    Scheduler scheduler = SchedulerParser.parse(siddhiAppContext.getScheduledExecutorService(), entryValveProcessor, siddhiAppContext);
    streamPreStateProcessor.setScheduler(scheduler);
    return streamPreStateProcessor;
}
Also used : Scheduler(org.wso2.siddhi.core.util.Scheduler) EntryValveProcessor(org.wso2.siddhi.core.query.input.stream.single.EntryValveProcessor)

Aggregations

VariableExpressionExecutor (org.wso2.siddhi.core.executor.VariableExpressionExecutor)30 ExpressionExecutor (org.wso2.siddhi.core.executor.ExpressionExecutor)28 SiddhiAppCreationException (org.wso2.siddhi.core.exception.SiddhiAppCreationException)24 ArrayList (java.util.ArrayList)22 MetaStreamEvent (org.wso2.siddhi.core.event.stream.MetaStreamEvent)20 Attribute (org.wso2.siddhi.query.api.definition.Attribute)18 StreamEventPool (org.wso2.siddhi.core.event.stream.StreamEventPool)17 ConstantExpressionExecutor (org.wso2.siddhi.core.executor.ConstantExpressionExecutor)17 SiddhiAppValidationException (org.wso2.siddhi.query.api.exception.SiddhiAppValidationException)13 MetaStateEvent (org.wso2.siddhi.core.event.state.MetaStateEvent)12 AbstractDefinition (org.wso2.siddhi.query.api.definition.AbstractDefinition)12 StreamDefinition (org.wso2.siddhi.query.api.definition.StreamDefinition)12 HashMap (java.util.HashMap)11 StreamEvent (org.wso2.siddhi.core.event.stream.StreamEvent)11 SingleStreamRuntime (org.wso2.siddhi.core.query.input.stream.single.SingleStreamRuntime)11 Expression (org.wso2.siddhi.query.api.expression.Expression)11 Table (org.wso2.siddhi.core.table.Table)10 Variable (org.wso2.siddhi.query.api.expression.Variable)10 QueryRuntime (org.wso2.siddhi.core.query.QueryRuntime)8 StreamJunction (org.wso2.siddhi.core.stream.StreamJunction)8