public void notifyClose() {
        if (log.isDebugEnabled()) {
            log.debug("Set the metadata for next fetch request to close the existing session ID={}", nextMetadata.sessionId());
        }
        nextMetadata = nextMetadata.nextCloseExisting();
    }
The client will initiate the session close on next fetch request.
clients/src/main/java/org/apache/kafka/clients/FetchSessionHandler.java