Search in sources :

Example 1 with StreamEventFactory

use of io.siddhi.core.event.stream.StreamEventFactory in project siddhi by wso2.

the class AggregationGroupByWindowedPerSnapshotOutputRateLimiter method init.

@Override
protected StateFactory<AggregationRateLimiterState> init() {
    this.scheduler = SchedulerParser.parse(this, siddhiQueryContext);
    this.scheduler.setStreamEventFactory(new StreamEventFactory(0, 0, 0));
    this.scheduler.init(lockWrapper, siddhiQueryContext.getName());
    return () -> new AggregationGroupByRateLimiterState();
}
Also used : StreamEventFactory(io.siddhi.core.event.stream.StreamEventFactory)

Example 2 with StreamEventFactory

use of io.siddhi.core.event.stream.StreamEventFactory in project siddhi by wso2.

the class AllAggregationGroupByWindowedPerSnapshotOutputRateLimiter method init.

@Override
protected StateFactory<RateLimiterState> init() {
    this.scheduler = SchedulerParser.parse(this, siddhiQueryContext);
    this.scheduler.setStreamEventFactory(new StreamEventFactory(0, 0, 0));
    this.scheduler.init(lockWrapper, siddhiQueryContext.getName());
    return () -> new RateLimiterState();
}
Also used : StreamEventFactory(io.siddhi.core.event.stream.StreamEventFactory)

Example 3 with StreamEventFactory

use of io.siddhi.core.event.stream.StreamEventFactory in project siddhi by wso2.

the class GroupByPerSnapshotOutputRateLimiter method init.

@Override
protected StateFactory<RateLimiterState> init() {
    this.scheduler = SchedulerParser.parse(this, siddhiQueryContext);
    this.scheduler.setStreamEventFactory(new StreamEventFactory(0, 0, 0));
    this.scheduler.init(lockWrapper, siddhiQueryContext.getName());
    return () -> new RateLimiterState();
}
Also used : StreamEventFactory(io.siddhi.core.event.stream.StreamEventFactory)

Example 4 with StreamEventFactory

use of io.siddhi.core.event.stream.StreamEventFactory in project siddhi by wso2.

the class WrappedSnapshotOutputRateLimiter method init.

public void init(int outPutAttributeSize, List<AttributeProcessor> attributeProcessorList, MetaComplexEvent metaComplexEvent) {
    for (AttributeProcessor attributeProcessor : attributeProcessorList) {
        if (attributeProcessor.getExpressionExecutor() instanceof AttributeAggregatorExecutor<?>) {
            aggregateAttributePositionList.add(attributeProcessor.getOutputPosition());
        }
    }
    if (windowed) {
        if (groupBy) {
            if (outPutAttributeSize == aggregateAttributePositionList.size()) {
                // All Aggregation
                outputRateLimiter = new AllAggregationGroupByWindowedPerSnapshotOutputRateLimiter(value, this, groupBy, siddhiQueryContext);
            } else if (aggregateAttributePositionList.size() > 0) {
                // Some Aggregation
                outputRateLimiter = new AggregationGroupByWindowedPerSnapshotOutputRateLimiter(value, aggregateAttributePositionList, this, groupBy, siddhiQueryContext);
            } else {
                // No aggregation
                // GroupBy is same as Non GroupBy
                outputRateLimiter = new WindowedPerSnapshotOutputRateLimiter(value, this, groupBy, siddhiQueryContext);
            }
        } else {
            if (outPutAttributeSize == aggregateAttributePositionList.size()) {
                // All Aggregation
                outputRateLimiter = new AllAggregationPerSnapshotOutputRateLimiter(value, this, groupBy, siddhiQueryContext);
            } else if (aggregateAttributePositionList.size() > 0) {
                // Some Aggregation
                outputRateLimiter = new AggregationWindowedPerSnapshotOutputRateLimiter(value, aggregateAttributePositionList, this, groupBy, siddhiQueryContext);
            } else {
                // No aggregation
                outputRateLimiter = new WindowedPerSnapshotOutputRateLimiter(value, this, groupBy, siddhiQueryContext);
            }
        }
    } else {
        if (groupBy) {
            outputRateLimiter = new GroupByPerSnapshotOutputRateLimiter(value, this, groupBy, siddhiQueryContext);
        } else {
            outputRateLimiter = new PerSnapshotOutputRateLimiter(value, this, groupBy, siddhiQueryContext);
        }
    }
    if (metaComplexEvent instanceof MetaStateEvent) {
        StateEventFactory stateEventFactory = new StateEventFactory((MetaStateEvent) metaComplexEvent);
        outputRateLimiter.setStateEventCloner(new StateEventCloner((MetaStateEvent) metaComplexEvent, stateEventFactory));
    } else {
        StreamEventFactory streamEventFactory = new StreamEventFactory((MetaStreamEvent) metaComplexEvent);
        outputRateLimiter.setStreamEventCloner(new StreamEventCloner((MetaStreamEvent) metaComplexEvent, streamEventFactory));
    }
}
Also used : StreamEventFactory(io.siddhi.core.event.stream.StreamEventFactory) MetaStateEvent(io.siddhi.core.event.state.MetaStateEvent) StateEventFactory(io.siddhi.core.event.state.StateEventFactory) StreamEventCloner(io.siddhi.core.event.stream.StreamEventCloner) AttributeProcessor(io.siddhi.core.query.selector.attribute.processor.AttributeProcessor) StateEventCloner(io.siddhi.core.event.state.StateEventCloner) AttributeAggregatorExecutor(io.siddhi.core.query.selector.attribute.aggregator.AttributeAggregatorExecutor) MetaStreamEvent(io.siddhi.core.event.stream.MetaStreamEvent)

Example 5 with StreamEventFactory

use of io.siddhi.core.event.stream.StreamEventFactory in project siddhi by wso2.

the class AggregationWindowedPerSnapshotOutputRateLimiter method init.

@Override
protected StateFactory<AggregationRateLimiterState> init() {
    this.scheduler = SchedulerParser.parse(this, siddhiQueryContext);
    this.scheduler.setStreamEventFactory(new StreamEventFactory(0, 0, 0));
    this.scheduler.init(lockWrapper, siddhiQueryContext.getName());
    return () -> new AggregationRateLimiterState();
}
Also used : StreamEventFactory(io.siddhi.core.event.stream.StreamEventFactory)

Aggregations

StreamEventFactory (io.siddhi.core.event.stream.StreamEventFactory)39 MetaStreamEvent (io.siddhi.core.event.stream.MetaStreamEvent)23 StreamEvent (io.siddhi.core.event.stream.StreamEvent)21 Attribute (io.siddhi.query.api.definition.Attribute)15 Test (org.testng.annotations.Test)15 ArrayList (java.util.ArrayList)13 StreamEventCloner (io.siddhi.core.event.stream.StreamEventCloner)11 StreamEventConverter (io.siddhi.core.event.stream.converter.StreamEventConverter)9 HashMap (java.util.HashMap)7 Map (java.util.Map)7 MetaStateEvent (io.siddhi.core.event.state.MetaStateEvent)6 ConversionStreamEventChunk (io.siddhi.core.event.stream.converter.ConversionStreamEventChunk)6 StreamEventClonerHolder (io.siddhi.core.event.stream.holder.StreamEventClonerHolder)6 Event (io.siddhi.core.event.Event)5 Operation (io.siddhi.core.event.stream.Operation)5 ZeroStreamEventConverter (io.siddhi.core.event.stream.converter.ZeroStreamEventConverter)5 SnapshotableStreamEventQueue (io.siddhi.core.event.stream.holder.SnapshotableStreamEventQueue)5 Snapshot (io.siddhi.core.util.snapshot.state.Snapshot)5 SnapshotStateList (io.siddhi.core.util.snapshot.state.SnapshotStateList)5 ComplexEvent (io.siddhi.core.event.ComplexEvent)4