Search in sources :

Example 31 with StreamEvent

use of org.ballerinalang.siddhi.core.event.stream.StreamEvent in project ballerina by ballerina-lang.

the class MultiProcessStreamReceiver method receive.

@Override
public void receive(ComplexEvent complexEvent) {
    ComplexEvent aComplexEvent = complexEvent;
    while (aComplexEvent != null) {
        synchronized (this) {
            stabilizeStates();
            for (int anEventSequence : eventSequence) {
                StreamEventConverter aStreamEventConverter = streamEventConverters[anEventSequence];
                StreamEventPool aStreamEventPool = streamEventPools[anEventSequence];
                StreamEvent borrowedEvent = aStreamEventPool.borrowEvent();
                aStreamEventConverter.convertComplexEvent(aComplexEvent, borrowedEvent);
                process(anEventSequence, borrowedEvent);
            }
        }
        aComplexEvent = aComplexEvent.getNext();
    }
}
Also used : ComplexEvent(org.ballerinalang.siddhi.core.event.ComplexEvent) StreamEventConverter(org.ballerinalang.siddhi.core.event.stream.converter.StreamEventConverter) MetaStreamEvent(org.ballerinalang.siddhi.core.event.stream.MetaStreamEvent) StreamEvent(org.ballerinalang.siddhi.core.event.stream.StreamEvent) StreamEventPool(org.ballerinalang.siddhi.core.event.stream.StreamEventPool)

Example 32 with StreamEvent

use of org.ballerinalang.siddhi.core.event.stream.StreamEvent in project ballerina by ballerina-lang.

the class MultiProcessStreamReceiver method receive.

@Override
public void receive(Event event) {
    synchronized (this) {
        stabilizeStates();
        for (int anEventSequence : eventSequence) {
            StreamEventConverter aStreamEventConverter = streamEventConverters[anEventSequence];
            StreamEventPool aStreamEventPool = streamEventPools[anEventSequence];
            StreamEvent borrowedEvent = aStreamEventPool.borrowEvent();
            aStreamEventConverter.convertEvent(event, borrowedEvent);
            process(anEventSequence, borrowedEvent);
        }
    }
}
Also used : StreamEventConverter(org.ballerinalang.siddhi.core.event.stream.converter.StreamEventConverter) MetaStreamEvent(org.ballerinalang.siddhi.core.event.stream.MetaStreamEvent) StreamEvent(org.ballerinalang.siddhi.core.event.stream.StreamEvent) StreamEventPool(org.ballerinalang.siddhi.core.event.stream.StreamEventPool)

Example 33 with StreamEvent

use of org.ballerinalang.siddhi.core.event.stream.StreamEvent in project ballerina by ballerina-lang.

the class ProcessStreamReceiver method receive.

@Override
public void receive(Event event) {
    if (event != null) {
        StreamEvent borrowedEvent = streamEventPool.borrowEvent();
        streamEventConverter.convertEvent(event, borrowedEvent);
        if (siddhiDebugger != null) {
            siddhiDebugger.checkBreakPoint(queryName, SiddhiDebugger.QueryTerminal.IN, borrowedEvent);
        }
        process(new ComplexEventChunk<StreamEvent>(borrowedEvent, borrowedEvent, this.batchProcessingAllowed));
    }
}
Also used : MetaStreamEvent(org.ballerinalang.siddhi.core.event.stream.MetaStreamEvent) StreamEvent(org.ballerinalang.siddhi.core.event.stream.StreamEvent)

Example 34 with StreamEvent

use of org.ballerinalang.siddhi.core.event.stream.StreamEvent in project ballerina by ballerina-lang.

the class ProcessStreamReceiver method receive.

@Override
public void receive(long timestamp, Object[] data) {
    StreamEvent borrowedEvent = streamEventPool.borrowEvent();
    streamEventConverter.convertData(timestamp, data, borrowedEvent);
    // Send to debugger
    if (siddhiDebugger != null) {
        siddhiDebugger.checkBreakPoint(queryName, SiddhiDebugger.QueryTerminal.IN, borrowedEvent);
    }
    process(new ComplexEventChunk<StreamEvent>(borrowedEvent, borrowedEvent, this.batchProcessingAllowed));
}
Also used : MetaStreamEvent(org.ballerinalang.siddhi.core.event.stream.MetaStreamEvent) StreamEvent(org.ballerinalang.siddhi.core.event.stream.StreamEvent)

Example 35 with StreamEvent

use of org.ballerinalang.siddhi.core.event.stream.StreamEvent in project ballerina by ballerina-lang.

the class ProcessStreamReceiver method receive.

@Override
public void receive(Event event, boolean endOfBatch) {
    StreamEvent borrowedEvent = streamEventPool.borrowEvent();
    streamEventConverter.convertEvent(event, borrowedEvent);
    ComplexEventChunk<StreamEvent> streamEventChunk = null;
    synchronized (this) {
        batchingStreamEventChunk.add(borrowedEvent);
        if (endOfBatch) {
            streamEventChunk = batchingStreamEventChunk;
            batchingStreamEventChunk = new ComplexEventChunk<StreamEvent>(this.batchProcessingAllowed);
        }
    }
    if (streamEventChunk != null) {
        if (siddhiDebugger != null) {
            siddhiDebugger.checkBreakPoint(queryName, SiddhiDebugger.QueryTerminal.IN, streamEventChunk.getFirst());
        }
        process(streamEventChunk);
    }
}
Also used : MetaStreamEvent(org.ballerinalang.siddhi.core.event.stream.MetaStreamEvent) StreamEvent(org.ballerinalang.siddhi.core.event.stream.StreamEvent)

Aggregations

StreamEvent (org.ballerinalang.siddhi.core.event.stream.StreamEvent)117 ComplexEventChunk (org.ballerinalang.siddhi.core.event.ComplexEventChunk)41 MetaStreamEvent (org.ballerinalang.siddhi.core.event.stream.MetaStreamEvent)40 StateEvent (org.ballerinalang.siddhi.core.event.state.StateEvent)19 Test (org.testng.annotations.Test)18 ComplexEvent (org.ballerinalang.siddhi.core.event.ComplexEvent)17 StreamEventPool (org.ballerinalang.siddhi.core.event.stream.StreamEventPool)16 Event (org.ballerinalang.siddhi.core.event.Event)15 ArrayList (java.util.ArrayList)11 ExpressionExecutor (org.ballerinalang.siddhi.core.executor.ExpressionExecutor)10 Map (java.util.Map)9 HashSet (java.util.HashSet)8 StreamEventConverter (org.ballerinalang.siddhi.core.event.stream.converter.StreamEventConverter)8 StreamDefinition (org.ballerinalang.siddhi.query.api.definition.StreamDefinition)8 ConstantExpressionExecutor (org.ballerinalang.siddhi.core.executor.ConstantExpressionExecutor)7 ConversionStreamEventChunk (org.ballerinalang.siddhi.core.event.stream.converter.ConversionStreamEventChunk)6 HashMap (java.util.HashMap)5 Set (java.util.Set)5 VariableExpressionExecutor (org.ballerinalang.siddhi.core.executor.VariableExpressionExecutor)5 StreamCallback (org.ballerinalang.siddhi.core.stream.output.StreamCallback)5