public StateEvent joinEventBuilder(StreamEvent leftStream, StreamEvent rightStream, ComplexEvent.Type type) {
        StateEvent returnEvent = stateEventFactory.newInstance();
        returnEvent.setEvent(0, leftStream);
        returnEvent.setEvent(1, rightStream);
        returnEvent.setType(type);
        if (!leftJoinProcessor) {
            returnEvent.setTimestamp(rightStream.getTimestamp());
        } else {
            returnEvent.setTimestamp(leftStream.getTimestamp());
        }
        return returnEvent;
    }
Join the given two event streams.

@param leftStream  event left stream
@param rightStream event right stream
@param type        complex event type
@return StateEvent state event
modules/siddhi-core/src/main/java/io/siddhi/core/query/input/stream/join/JoinProcessor.java