@Override
    public void receive(ComplexEvent complexEvent) {
        List<Event> eventBuffer = new ArrayList<Event>();
        while (complexEvent != null) {
            eventBuffer.add(new Event(complexEvent.getOutputData().length).copyFrom(complexEvent));
            complexEvent = complexEvent.getNext();
        }
        if (eventBuffer.size() == 1) {
            receive(eventBuffer.get(0));
        } else {
            receiveEvents(eventBuffer.toArray(new Event[eventBuffer.size()]));
        }
    }
StreamCallback is used to receive events from {@link StreamJunction}. This class should be extended if one intends
to get events from a Siddhi Stream.
modules/siddhi-core/src/main/java/io/siddhi/core/stream/output/StreamCallback.java