use of org.ballerinalang.siddhi.core.event.stream.StreamEvent in project ballerina by ballerina-lang.
the class StateMultiProcessStreamReceiver method processAndClear.
protected void processAndClear(int processIndex, StreamEvent streamEvent) {
ComplexEventChunk<StateEvent> retEventChunk = new ComplexEventChunk<StateEvent>(batchProcessingAllowed);
ComplexEventChunk<StreamEvent> currentStreamEventChunk = new ComplexEventChunk<StreamEvent>(streamEvent, streamEvent, batchProcessingAllowed);
ComplexEventChunk<StateEvent> eventChunk = ((StreamPreStateProcessor) nextProcessors[processIndex]).processAndReturn(currentStreamEventChunk);
if (eventChunk.getFirst() != null) {
retEventChunk.add(eventChunk.getFirst());
}
eventChunk.clear();
if (querySelector != null) {
while (retEventChunk.hasNext()) {
StateEvent stateEvent = retEventChunk.next();
retEventChunk.remove();
querySelector.process(new ComplexEventChunk<StateEvent>(stateEvent, stateEvent, batchProcessingAllowed));
}
}
}
use of org.ballerinalang.siddhi.core.event.stream.StreamEvent in project ballerina by ballerina-lang.
the class AbsentLogicalPostStateProcessor method process.
protected void process(StateEvent stateEvent, ComplexEventChunk complexEventChunk) {
// Mark the state changed
thisStatePreProcessor.stateChanged();
// Update the timestamp
StreamEvent streamEvent = stateEvent.getStreamEvent(stateId);
// This is the notification to AbsentStreamPreStateProcessor that this event has been processed
this.isEventReturned = true;
((AbsentPreStateProcessor) thisStatePreProcessor).updateLastArrivalTime(streamEvent.getTimestamp());
}
use of org.ballerinalang.siddhi.core.event.stream.StreamEvent in project ballerina by ballerina-lang.
the class StreamPostStateProcessor method process.
protected void process(StateEvent stateEvent, ComplexEventChunk complexEventChunk) {
thisStatePreProcessor.stateChanged();
StreamEvent streamEvent = stateEvent.getStreamEvent(stateId);
stateEvent.setTimestamp(streamEvent.getTimestamp());
if (nextProcessor != null) {
complexEventChunk.reset();
this.isEventReturned = true;
}
if (nextStatePerProcessor != null) {
nextStatePerProcessor.addState(stateEvent);
}
if (nextEveryStatePerProcessor != null) {
nextEveryStatePerProcessor.addEveryState(stateEvent);
}
if (callbackPreStateProcessor != null) {
callbackPreStateProcessor.startStateReset();
}
}
use of org.ballerinalang.siddhi.core.event.stream.StreamEvent in project ballerina by ballerina-lang.
the class PartitionStreamReceiver method receive.
@Override
public void receive(long timestamp, Object[] data) {
StreamEvent borrowedEvent = eventPool.borrowEvent();
streamEventConverter.convertData(timestamp, data, borrowedEvent);
if (partitionExecutors.size() == 0) {
send(borrowedEvent);
} else {
for (PartitionExecutor partitionExecutor : partitionExecutors) {
String key = partitionExecutor.execute(borrowedEvent);
send(key, borrowedEvent);
}
}
eventPool.returnEvents(borrowedEvent);
}
use of org.ballerinalang.siddhi.core.event.stream.StreamEvent in project ballerina by ballerina-lang.
the class PartitionStreamReceiver method receive.
@Override
public void receive(Event event) {
StreamEvent borrowedEvent = eventPool.borrowEvent();
streamEventConverter.convertEvent(event, borrowedEvent);
for (PartitionExecutor partitionExecutor : partitionExecutors) {
String key = partitionExecutor.execute(borrowedEvent);
send(key, borrowedEvent);
}
if (partitionExecutors.size() == 0) {
send(borrowedEvent);
}
eventPool.returnEvents(borrowedEvent);
}
Aggregations