protected void processAndClear(ComplexEventChunk<StreamEvent> streamEventChunk) {
        ComplexEventChunk<StateEvent> retEventChunk = new ComplexEventChunk<>();
        ComplexEventChunk<StreamEvent> currentStreamEventChunk = new ComplexEventChunk<>(
        );
        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));
        }
    }
Implementation of {StreamJunction.Receiver} to receive events to be fed into
single stream stateless queries(Filter).
modules/siddhi-core/src/main/java/io/siddhi/core/query/input/SingleProcessStreamReceiver.java