dajac commented on code in PR #12901:
URL: https://github.com/apache/kafka/pull/12901#discussion_r1067043771
##########
core/src/main/scala/kafka/coordinator/group/GroupCoordinatorAdapter.scala:
##########
@@ -234,4 +240,67 @@ class GroupCoordinatorAdapter(
}
CompletableFuture.completedFuture(results)
}
+
+ override def commitTransactionalOffsets(
+ context: RequestContext,
+ request: TxnOffsetCommitRequestData,
+ bufferSupplier: BufferSupplier
+ ): CompletableFuture[TxnOffsetCommitResponseData] = {
+ val future = new CompletableFuture[TxnOffsetCommitResponseData]()
+
+ def callback(results: Map[TopicPartition, Errors]): Unit = {
+ val response = new TxnOffsetCommitResponseData()
+ val byTopics = new util.HashMap[String,
TxnOffsetCommitResponseData.TxnOffsetCommitResponseTopic]()
+
+ results.forKeyValue { (tp, error) =>
+ var topic = byTopics.get(tp.topic)
+ if (topic == null) {
+ topic = new
TxnOffsetCommitResponseData.TxnOffsetCommitResponseTopic().setName(tp.topic)
+ byTopics.put(tp.topic, topic)
+ response.topics.add(topic)
+ }
+ topic.partitions.add(new
TxnOffsetCommitResponseData.TxnOffsetCommitResponsePartition()
+ .setPartitionIndex(tp.partition)
+ .setErrorCode(error.code))
+ }
+
+ future.complete(response)
+ }
+
+ val currentTimestamp = time.milliseconds
+ val partitions = new mutable.HashMap[TopicPartition, OffsetAndMetadata]()
+
+ request.topics.forEach { topic =>
+ topic.partitions.forEach { partition =>
+ val tp = new TopicPartition(topic.name, partition.partitionIndex)
+ partitions += tp -> new OffsetAndMetadata(
+ offset = partition.committedOffset,
+ leaderEpoch = partition.committedLeaderEpoch match {
+ case RecordBatch.NO_PARTITION_LEADER_EPOCH =>
Optional.empty[Integer]
Review Comment:
It was handled
[here](https://github.com/apache/kafka/blob/a8d54231632355493b9d6e24431227199b44daea/clients/src/main/java/org/apache/kafka/common/requests/TxnOffsetCommitRequest.java#L124)
in the previous code.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]