public static LeaderChangeMessage deserializeLeaderChangeMessage(Record record) {
        ControlRecordType recordType = ControlRecordType.parse(record.key());
        validateControlRecordType(ControlRecordType.LEADER_CHANGE, recordType);

        return deserializeLeaderChangeMessage(record.value());
    }
Utility class for easy interaction with control records.
clients/src/main/java/org/apache/kafka/common/record/ControlRecordUtils.java