public void replay(
        ConsumerGroupCurrentMemberAssignmentKey key,
        ConsumerGroupCurrentMemberAssignmentValue value,
        GroupType groupType
    ) {
        String groupId = key.groupId();
        String memberId = key.memberId();

        if (groupType == CONSUMER) {
            ConsumerGroup group = getOrMaybeCreatePersistedConsumerGroup(groupId, false);
            ConsumerGroupMember oldMember = group.getOrMaybeCreateMember(memberId, false);

            if (value != null) {
                ConsumerGroupMember newMember = new ConsumerGroupMember.Builder(oldMember)
                    .updateWith(value)
                    .build();
                group.updateMember(newMember);
            } else {
                ConsumerGroupMember newMember = new ConsumerGroupMember.Builder(oldMember)
                    .setMemberEpoch(LEAVE_GROUP_MEMBER_EPOCH)
                    .setPreviousMemberEpoch(LEAVE_GROUP_MEMBER_EPOCH)
                    .setAssignedPartitions(Collections.emptyMap())
                    .setPartitionsPendingRevocation(Collections.emptyMap())
                    .build();
                group.updateMember(newMember);
            }
        } else if (groupType == SHARE) {
            ShareGroup group = getOrMaybeCreatePersistedShareGroup(groupId, false);
            ShareGroupMember oldMember = group.getOrMaybeCreateMember(memberId, false);

            if (value != null) {
                ShareGroupMember newMember = new ShareGroupMember.Builder(oldMember)
                    .updateWith(value)
                    .build();
                group.updateMember(newMember);
            } else {
                ShareGroupMember newMember = new ShareGroupMember.Builder(oldMember)
                    .setMemberEpoch(LEAVE_GROUP_MEMBER_EPOCH)
                    .setPreviousMemberEpoch(LEAVE_GROUP_MEMBER_EPOCH)
                    .setAssignedPartitions(Collections.emptyMap())
                    .build();
                group.updateMember(newMember);
            }
        } else {
            throw new IllegalStateException("Received a ConsumerGroupCurrentMemberAssignmentKey/Value record "
                + "for an unknown group type: " + groupType);
        }
    }
Replays ConsumerGroupCurrentMemberAssignmentKey/Value to update the hard state of
the consumer group. It updates the assignment of a member or deletes it.

@param key   A ConsumerGroupCurrentMemberAssignmentKey key.
@param value A ConsumerGroupCurrentMemberAssignmentValue record.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java