dajac commented on code in PR #18636:
URL: https://github.com/apache/kafka/pull/18636#discussion_r1922713369


##########
transaction-coordinator/src/main/java/org/apache/kafka/coordinator/transaction/TransactionCoordinatorRecordSerde.java:
##########
@@ -16,32 +16,29 @@
  */
 package org.apache.kafka.coordinator.transaction;
 
+import org.apache.kafka.common.errors.UnsupportedVersionException;
 import org.apache.kafka.common.protocol.ApiMessage;
 import org.apache.kafka.coordinator.common.runtime.CoordinatorLoader;
 import org.apache.kafka.coordinator.common.runtime.CoordinatorRecordSerde;
-import org.apache.kafka.coordinator.transaction.generated.TransactionLogKey;
-import org.apache.kafka.coordinator.transaction.generated.TransactionLogValue;
+import 
org.apache.kafka.coordinator.transaction.generated.CoordinatorRecordType;
 
 public class TransactionCoordinatorRecordSerde extends CoordinatorRecordSerde {
 
     @Override
     protected ApiMessage apiMessageKeyFor(short recordType) {
-        switch (recordType) {
-            case 0:
-                return new TransactionLogKey();
-            default:
-                throw new 
CoordinatorLoader.UnknownRecordTypeException(recordType);
+        try {
+            return CoordinatorRecordType.fromId(recordType).newRecordKey();
+        } catch (UnsupportedVersionException ex) {
+            throw new CoordinatorLoader.UnknownRecordTypeException(recordType);
         }
     }
 
     @Override
     protected ApiMessage apiMessageValueFor(short recordVersion) {

Review Comment:
   Again :). Fixed it.



-- 
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]

Reply via email to