public void init() {
        StreamPreState state = stateHolder.getState();
        try {
            if (isStartState && (!state.initialized ||
                    this.thisStatePostProcessor.nextEveryStatePreProcessor != null ||
                    (stateType == StateInputStream.Type.SEQUENCE && this.thisStatePostProcessor.nextStatePreProcessor
                            instanceof AbsentPreStateProcessor))) {
                // For 'every' sequence, the 'thisStatePostProcessor.nextEveryStatePreProcessor != null'
                // check is not enough
                StateEvent stateEvent = stateEventFactory.newInstance();
                addState(stateEvent);
                state.initialized = true;
            }
        } finally {
            stateHolder.returnState(state);
        }
    }
Set as the last element of the processor chain

@param processor Last processor in the chain
modules/siddhi-core/src/main/java/io/siddhi/core/query/input/stream/state/StreamPreStateProcessor.java