@Override
    public void registerStateListener(MemberStateListener listener) {
        if (listener == null) {
            throw new IllegalArgumentException("State updates listener cannot be null");
        }
        this.stateUpdatesListeners.add(listener);
    }
Register a new listener that will be invoked whenever the member state changes, or a new
member ID or epoch is received.

@param listener Listener to invoke.
clients/src/main/java/org/apache/kafka/clients/consumer/internals/MembershipManagerImpl.java