Search in sources :

Example 1 with StreamEvent

use of org.wso2.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.

the class IncrementalExecutor method dispatchEvents.

private void dispatchEvents(Map<String, BaseIncrementalValueStore> baseIncrementalValueGroupByStore) {
    int noOfEvents = baseIncrementalValueGroupByStore.size();
    if (noOfEvents > 0) {
        ComplexEventChunk<StreamEvent> eventChunk = new ComplexEventChunk<>(true);
        for (BaseIncrementalValueStore aBaseIncrementalValueStore : baseIncrementalValueGroupByStore.values()) {
            StreamEvent streamEvent = aBaseIncrementalValueStore.createStreamEvent();
            eventChunk.add(streamEvent);
        }
        LOG.debug("Event dispatched by " + this.duration + " incremental executor: " + eventChunk.toString());
        table.addEvents(eventChunk, noOfEvents);
        if (getNextExecutor() != null) {
            next.execute(eventChunk);
        }
    }
    baseIncrementalValueGroupByStore.clear();
}
Also used : ComplexEventChunk(org.wso2.siddhi.core.event.ComplexEventChunk) MetaStreamEvent(org.wso2.siddhi.core.event.stream.MetaStreamEvent) StreamEvent(org.wso2.siddhi.core.event.stream.StreamEvent)

Example 2 with StreamEvent

use of org.wso2.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.

the class IncrementalExecutor method dispatchEvent.

private void dispatchEvent(long startTimeOfNewAggregates, BaseIncrementalValueStore aBaseIncrementalValueStore) {
    if (aBaseIncrementalValueStore.isProcessed()) {
        StreamEvent streamEvent = aBaseIncrementalValueStore.createStreamEvent();
        ComplexEventChunk<StreamEvent> eventChunk = new ComplexEventChunk<>(true);
        eventChunk.add(streamEvent);
        LOG.debug("Event dispatched by " + this.duration + " incremental executor: " + eventChunk.toString());
        table.addEvents(eventChunk, 1);
        if (getNextExecutor() != null) {
            next.execute(eventChunk);
        }
    }
    cleanBaseIncrementalValueStore(startTimeOfNewAggregates, aBaseIncrementalValueStore);
}
Also used : ComplexEventChunk(org.wso2.siddhi.core.event.ComplexEventChunk) MetaStreamEvent(org.wso2.siddhi.core.event.stream.MetaStreamEvent) StreamEvent(org.wso2.siddhi.core.event.stream.StreamEvent)

Example 3 with StreamEvent

use of org.wso2.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.

the class BaseIncrementalValueStore method createStreamEvent.

public StreamEvent createStreamEvent() {
    StreamEvent streamEvent = streamEventPool.borrowEvent();
    streamEvent.setTimestamp(timestamp);
    setValue(timestamp, 0);
    streamEvent.setOutputData(values);
    return streamEvent;
}
Also used : StreamEvent(org.wso2.siddhi.core.event.stream.StreamEvent)

Example 4 with StreamEvent

use of org.wso2.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.

the class ConversionStreamEventChunk method convertAllStreamEvents.

private StreamEvent convertAllStreamEvents(ComplexEvent complexEvents, StreamEvent firstEvent) {
    streamEventConverter.convertComplexEvent(complexEvents, firstEvent);
    StreamEvent currentEvent = firstEvent;
    complexEvents = complexEvents.getNext();
    while (complexEvents != null) {
        StreamEvent nextEvent = streamEventPool.borrowEvent();
        streamEventConverter.convertComplexEvent(complexEvents, nextEvent);
        currentEvent.setNext(nextEvent);
        currentEvent = nextEvent;
        complexEvents = complexEvents.getNext();
    }
    return currentEvent;
}
Also used : MetaStreamEvent(org.wso2.siddhi.core.event.stream.MetaStreamEvent) StreamEvent(org.wso2.siddhi.core.event.stream.StreamEvent)

Example 5 with StreamEvent

use of org.wso2.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.

the class ConversionStreamEventChunk method convertAndAssign.

public void convertAndAssign(Event event) {
    StreamEvent borrowedEvent = streamEventPool.borrowEvent();
    streamEventConverter.convertEvent(event, borrowedEvent);
    first = borrowedEvent;
    last = first;
}
Also used : MetaStreamEvent(org.wso2.siddhi.core.event.stream.MetaStreamEvent) StreamEvent(org.wso2.siddhi.core.event.stream.StreamEvent)

Aggregations

StreamEvent (org.wso2.siddhi.core.event.stream.StreamEvent)120 MetaStreamEvent (org.wso2.siddhi.core.event.stream.MetaStreamEvent)42 ComplexEventChunk (org.wso2.siddhi.core.event.ComplexEventChunk)41 StateEvent (org.wso2.siddhi.core.event.state.StateEvent)23 ComplexEvent (org.wso2.siddhi.core.event.ComplexEvent)20 Test (org.testng.annotations.Test)19 Event (org.wso2.siddhi.core.event.Event)16 StreamEventPool (org.wso2.siddhi.core.event.stream.StreamEventPool)16 ExpressionExecutor (org.wso2.siddhi.core.executor.ExpressionExecutor)14 ArrayList (java.util.ArrayList)13 Map (java.util.Map)10 ConstantExpressionExecutor (org.wso2.siddhi.core.executor.ConstantExpressionExecutor)9 HashSet (java.util.HashSet)8 StreamEventConverter (org.wso2.siddhi.core.event.stream.converter.StreamEventConverter)8 Attribute (org.wso2.siddhi.query.api.definition.Attribute)8 StreamDefinition (org.wso2.siddhi.query.api.definition.StreamDefinition)8 VariableExpressionExecutor (org.wso2.siddhi.core.executor.VariableExpressionExecutor)7 ConversionStreamEventChunk (org.wso2.siddhi.core.event.stream.converter.ConversionStreamEventChunk)6 StreamCallback (org.wso2.siddhi.core.stream.output.StreamCallback)6 HashMap (java.util.HashMap)5