Search in sources :

Example 56 with ComplexEvent

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

the class StreamJunction method sendEvent.

public void sendEvent(ComplexEvent complexEvent) {
    if (isTraceEnabled) {
        log.trace("Event is received by streamJunction " + this);
    }
    ComplexEvent complexEventList = complexEvent;
    if (disruptor != null) {
        while (complexEventList != null) {
            if (throughputTracker != null && siddhiAppContext.isStatsEnabled()) {
                throughputTracker.eventIn();
            }
            long sequenceNo = ringBuffer.next();
            try {
                Event existingEvent = ringBuffer.get(sequenceNo);
                existingEvent.copyFrom(complexEventList);
            } finally {
                ringBuffer.publish(sequenceNo);
            }
            complexEventList = complexEventList.getNext();
        }
    } else {
        if (throughputTracker != null && siddhiAppContext.isStatsEnabled()) {
            int messageCount = 0;
            while (complexEventList != null) {
                messageCount++;
                complexEventList = complexEventList.getNext();
            }
            throughputTracker.eventsIn(messageCount);
        }
        for (Receiver receiver : receivers) {
            receiver.receive(complexEvent);
        }
    }
}
Also used : ComplexEvent(org.ballerinalang.siddhi.core.event.ComplexEvent) ComplexEvent(org.ballerinalang.siddhi.core.event.ComplexEvent) Event(org.ballerinalang.siddhi.core.event.Event)

Example 57 with ComplexEvent

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

the class IndexEventHolder method add.

@Override
public void add(ComplexEventChunk<StreamEvent> addingEventChunk) {
    addingEventChunk.reset();
    while (addingEventChunk.hasNext()) {
        ComplexEvent complexEvent = addingEventChunk.next();
        StreamEvent streamEvent = tableStreamEventPool.borrowEvent();
        eventConverter.convertComplexEvent(complexEvent, streamEvent);
        add(streamEvent);
    }
}
Also used : ComplexEvent(org.ballerinalang.siddhi.core.event.ComplexEvent) StreamEvent(org.ballerinalang.siddhi.core.event.stream.StreamEvent)

Example 58 with ComplexEvent

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

the class ListEventHolder method add.

@Override
public void add(ComplexEventChunk<StreamEvent> addingEventChunk) {
    addingEventChunk.reset();
    while (addingEventChunk.hasNext()) {
        ComplexEvent complexEvent = addingEventChunk.next();
        StreamEvent streamEvent = tableStreamEventPool.borrowEvent();
        eventConverter.convertComplexEvent(complexEvent, streamEvent);
        this.add(streamEvent);
    }
}
Also used : ComplexEvent(org.ballerinalang.siddhi.core.event.ComplexEvent) StreamEvent(org.ballerinalang.siddhi.core.event.stream.StreamEvent)

Aggregations

ComplexEvent (org.ballerinalang.siddhi.core.event.ComplexEvent)58 ComplexEventChunk (org.ballerinalang.siddhi.core.event.ComplexEventChunk)29 ArrayList (java.util.ArrayList)20 GroupedComplexEvent (org.ballerinalang.siddhi.core.event.GroupedComplexEvent)17 Event (org.ballerinalang.siddhi.core.event.Event)15 SiddhiAppRuntime (org.ballerinalang.siddhi.core.SiddhiAppRuntime)12 SiddhiManager (org.ballerinalang.siddhi.core.SiddhiManager)12 StreamEvent (org.ballerinalang.siddhi.core.event.stream.StreamEvent)12 StreamCallback (org.ballerinalang.siddhi.core.stream.output.StreamCallback)12 InputHandler (org.ballerinalang.siddhi.core.stream.input.InputHandler)11 Test (org.testng.annotations.Test)11 MetaStreamEvent (org.ballerinalang.siddhi.core.event.stream.MetaStreamEvent)7 AttributeProcessor (org.ballerinalang.siddhi.core.query.selector.attribute.processor.AttributeProcessor)4 StateEvent (org.ballerinalang.siddhi.core.event.state.StateEvent)3 Iterator (java.util.Iterator)2 Map (java.util.Map)2 LinkedHashMap (java.util.LinkedHashMap)1 Scanner (java.util.Scanner)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 StreamEventPool (org.ballerinalang.siddhi.core.event.stream.StreamEventPool)1