@Override
        public void replay(
            long offset,
            long producerId,
            short producerEpoch,
            String record
        ) throws RuntimeException {
            RecordAndMetadata recordAndMetadata = new RecordAndMetadata(
                offset,
                producerId,
                producerEpoch,
                record
            );

            if (producerId == RecordBatch.NO_PRODUCER_ID) {
                records.add(recordAndMetadata);
            } else {
                pendingRecords
                    .computeIfAbsent(producerId, __ -> new TimelineHashSet<>(snapshotRegistry, 0))
                    .add(recordAndMetadata);
            }
        }
A simple Coordinator implementation that stores the records into a set.
group-coordinator/src/test/java/org/apache/kafka/coordinator/group/runtime/CoordinatorRuntimeTest.java