@Override
    int numBuffered(final TopicPartition partition) {
        final RecordQueue recordQueue = partitionQueues.get(partition);

        if (recordQueue == null) {
            throw new IllegalStateException("Partition " + partition + " not found.");
        }

        return recordQueue.size();
    }
@throws IllegalStateException if the record's partition does not belong to this partition group
streams/src/main/java/org/apache/kafka/streams/processor/internals/PartitionGroup.java