brandboat commented on code in PR #18695:
URL: https://github.com/apache/kafka/pull/18695#discussion_r1929845481
##########
tools/src/main/java/org/apache/kafka/tools/consumer/TransactionLogMessageFormatter.java:
##########
@@ -16,45 +16,36 @@
*/
package org.apache.kafka.tools.consumer;
-import org.apache.kafka.common.errors.UnsupportedVersionException;
-import org.apache.kafka.common.protocol.ByteBufferAccessor;
-import
org.apache.kafka.coordinator.transaction.generated.CoordinatorRecordType;
-import org.apache.kafka.coordinator.transaction.generated.TransactionLogKey;
-import
org.apache.kafka.coordinator.transaction.generated.TransactionLogKeyJsonConverter;
-import org.apache.kafka.coordinator.transaction.generated.TransactionLogValue;
-import
org.apache.kafka.coordinator.transaction.generated.TransactionLogValueJsonConverter;
+import org.apache.kafka.common.protocol.ApiMessage;
+import org.apache.kafka.coordinator.common.runtime.CoordinatorRecord;
+import org.apache.kafka.coordinator.common.runtime.CoordinatorRecordSerde;
+import
org.apache.kafka.coordinator.transaction.TransactionCoordinatorRecordSerde;
+import
org.apache.kafka.coordinator.transaction.generated.CoordinatorRecordJsonConverters;
import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.node.NullNode;
-import com.fasterxml.jackson.databind.node.TextNode;
import java.nio.ByteBuffer;
-public class TransactionLogMessageFormatter extends ApiMessageFormatter {
+public class TransactionLogMessageFormatter extends
CoordinatorRecordMessageFormatter {
+ private CoordinatorRecordSerde serde = new
TransactionCoordinatorRecordSerde();
+
+ @Override
+ protected CoordinatorRecord deserialize(ByteBuffer key, ByteBuffer value) {
+ return serde.deserialize(key, value);
+ }
+
+ @Override
+ protected boolean shouldPrint(short recordType) {
+ return true;
Review Comment:
I think the reason is that there is only one element, TRANSACTION_LOG, in
CoordinatorType, so there is no need to add extra checking here.
--
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]