use of io.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.
the class MultiProcessStreamReceiver method receive.
@Override
public void receive(List<Event> events) {
List<ReturnEventHolder> returnEventHolderList = new ArrayList<>(eventSequence.length);
synchronized (patternSyncObject) {
for (Event event : events) {
try {
multiProcessReturn.set(new ReturnEventHolder());
stabilizeStates(event.getTimestamp());
for (int anEventSequence : eventSequence) {
StreamEventConverter aStreamEventConverter = streamEventConverters[anEventSequence];
StreamEventFactory aStreamEventFactory = streamEventFactorys[anEventSequence];
StreamEvent newEvent = aStreamEventFactory.newInstance();
aStreamEventConverter.convertEvent(event, newEvent);
process(anEventSequence, newEvent);
if (multiProcessReturn.get() != null && multiProcessReturn.get().complexEventChunk != null) {
returnEventHolderList.add(multiProcessReturn.get());
multiProcessReturn.set(new ReturnEventHolder());
}
}
} finally {
multiProcessReturn.set(null);
}
}
}
for (ReturnEventHolder returnEventHolder : returnEventHolderList) {
outputRateLimiter.sendToCallBacks(returnEventHolder.complexEventChunk);
}
}
use of io.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.
the class MultiProcessStreamReceiver method receive.
@Override
public void receive(ComplexEvent complexEvent) {
ComplexEvent aComplexEvent = complexEvent;
List<ReturnEventHolder> returnEventHolderList = new ArrayList<>(eventSequence.length);
synchronized (patternSyncObject) {
while (aComplexEvent != null) {
try {
multiProcessReturn.set(new ReturnEventHolder());
stabilizeStates(aComplexEvent.getTimestamp());
for (int anEventSequence : eventSequence) {
StreamEventConverter aStreamEventConverter = streamEventConverters[anEventSequence];
StreamEventFactory aStreamEventFactory = streamEventFactorys[anEventSequence];
StreamEvent newEvent = aStreamEventFactory.newInstance();
aStreamEventConverter.convertComplexEvent(aComplexEvent, newEvent);
process(anEventSequence, newEvent);
if (multiProcessReturn.get() != null && multiProcessReturn.get().complexEventChunk != null) {
returnEventHolderList.add(multiProcessReturn.get());
multiProcessReturn.set(new ReturnEventHolder());
}
}
} finally {
multiProcessReturn.set(null);
}
aComplexEvent = aComplexEvent.getNext();
}
for (ReturnEventHolder returnEventHolder : returnEventHolderList) {
outputRateLimiter.sendToCallBacks(returnEventHolder.complexEventChunk);
}
}
}
use of io.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.
the class MultiProcessStreamReceiver method receive.
@Override
public void receive(long timestamp, Object[] data) {
List<ReturnEventHolder> returnEventHolderList = new ArrayList<>(eventSequence.length);
synchronized (patternSyncObject) {
try {
multiProcessReturn.set(new ReturnEventHolder());
stabilizeStates(timestamp);
for (int anEventSequence : eventSequence) {
StreamEventConverter aStreamEventConverter = streamEventConverters[anEventSequence];
StreamEventFactory aStreamEventFactory = streamEventFactorys[anEventSequence];
StreamEvent newEvent = aStreamEventFactory.newInstance();
aStreamEventConverter.convertData(timestamp, data, newEvent);
process(anEventSequence, newEvent);
if (multiProcessReturn.get() != null && multiProcessReturn.get().complexEventChunk != null) {
returnEventHolderList.add(multiProcessReturn.get());
multiProcessReturn.set(new ReturnEventHolder());
}
}
} finally {
multiProcessReturn.set(null);
}
}
for (ReturnEventHolder returnEventHolder : returnEventHolderList) {
outputRateLimiter.sendToCallBacks(returnEventHolder.complexEventChunk);
}
}
use of io.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.
the class MultiProcessStreamReceiver method receive.
@Override
public void receive(Event event) {
List<ReturnEventHolder> returnEventHolderList = new ArrayList<>(eventSequence.length);
synchronized (patternSyncObject) {
try {
multiProcessReturn.set(new ReturnEventHolder());
stabilizeStates(event.getTimestamp());
for (int anEventSequence : eventSequence) {
StreamEventConverter aStreamEventConverter = streamEventConverters[anEventSequence];
StreamEventFactory aStreamEventFactory = streamEventFactorys[anEventSequence];
StreamEvent newEvent = aStreamEventFactory.newInstance();
aStreamEventConverter.convertEvent(event, newEvent);
process(anEventSequence, newEvent);
if (multiProcessReturn.get() != null && multiProcessReturn.get().complexEventChunk != null) {
returnEventHolderList.add(multiProcessReturn.get());
multiProcessReturn.set(new ReturnEventHolder());
}
}
} finally {
multiProcessReturn.set(null);
}
}
for (ReturnEventHolder returnEventHolder : returnEventHolderList) {
outputRateLimiter.sendToCallBacks(returnEventHolder.complexEventChunk);
}
}
use of io.siddhi.core.event.stream.StreamEvent in project siddhi by wso2.
the class SingleProcessStreamReceiver method processAndClear.
protected void processAndClear(ComplexEventChunk<StreamEvent> streamEventChunk) {
ComplexEventChunk<StateEvent> retEventChunk = new ComplexEventChunk<>();
ComplexEventChunk<StreamEvent> currentStreamEventChunk = new ComplexEventChunk<>();
synchronized (patternSyncObject) {
while (streamEventChunk.hasNext()) {
StreamEvent streamEvent = streamEventChunk.next();
streamEventChunk.remove();
stabilizeStates(streamEvent.getTimestamp());
currentStreamEventChunk.add(streamEvent);
ComplexEventChunk<StateEvent> eventChunk = ((StreamPreStateProcessor) next).processAndReturn(currentStreamEventChunk);
if (eventChunk.getFirst() != null) {
retEventChunk.add(eventChunk.getFirst());
}
eventChunk.clear();
currentStreamEventChunk.clear();
}
}
while (retEventChunk.hasNext()) {
StateEvent stateEvent = retEventChunk.next();
retEventChunk.remove();
querySelector.process(new ComplexEventChunk<>(stateEvent, stateEvent));
}
}
Aggregations