dajac commented on code in PR #14047: URL: https://github.com/apache/kafka/pull/14047#discussion_r1269744467
########## group-coordinator/src/main/java/org/apache/kafka/coordinator/group/RecordHelpers.java: ########## @@ -467,6 +471,72 @@ public static Record newEmptyGroupMetadataRecord( ); } + /** + * Creates an OffsetCommit record. + * + * @param groupId The group id. + * @param topic The topic name. + * @param partitionId The partition id. + * @param offsetAndMetadata The offset and metadata. + * @param metadataVersion The metadata version. + * @return The record. + */ + public static Record newOffsetCommitRecord( + String groupId, + String topic, + int partitionId, + OffsetAndMetadata offsetAndMetadata, + MetadataVersion metadataVersion + ) { + short version = offsetAndMetadata.expireTimestampMs.isPresent() ? + (short) 1 : metadataVersion.offsetCommitValueVersion(); + + return new Record( + new ApiMessageAndVersion( + new OffsetCommitKey() + .setGroup(groupId) + .setTopic(topic) + .setPartition(partitionId), + (short) 1 Review Comment: I actually used the value on purpose vs using something like `ConsumerGroupTargetAssignmentMemberKey.HIGHEST_SUPPORTED_VERSION ` in order to not change it by mistake. I wanted to rework the format of those records to include an api key and to auto-generate the constants based on it. In the mean time, we could define them manually. Do you mind if I address this separably though? I will do it for all the records at once. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org