kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chia7...@apache.org
Subject [kafka] branch trunk updated: MINOR: add toString to Subscription classes (#10172)
Date Tue, 23 Feb 2021 09:30:34 GMT
This is an automated email from the ASF dual-hosted git repository.

chia7712 pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 8372080  MINOR: add toString to Subscription classes (#10172)
8372080 is described below

commit 837208009fa994751958b5d748dc422c9058993e
Author: Luke Chen <43372967+showuon@users.noreply.github.com>
AuthorDate: Tue Feb 23 17:29:11 2021 +0800

    MINOR: add toString to Subscription classes (#10172)
    
    Reviewers: Chia-Ping Tsai <chia7712@gmail.com>
---
 .../consumer/ConsumerPartitionAssignor.java        | 30 +++++++++++++++++++---
 1 file changed, 27 insertions(+), 3 deletions(-)

diff --git a/clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerPartitionAssignor.java
b/clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerPartitionAssignor.java
index 8708ea4..9fd7673 100644
--- a/clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerPartitionAssignor.java
+++ b/clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerPartitionAssignor.java
@@ -132,6 +132,16 @@ public interface ConsumerPartitionAssignor {
         public Optional<String> groupInstanceId() {
             return groupInstanceId;
         }
+
+        @Override
+        public String toString() {
+            return "Subscription(" +
+                "topics=" + topics +
+                (userData == null ? "" : ", userDataSize=" + userData.remaining()) +
+                ", ownedPartitions=" + ownedPartitions +
+                ", groupInstanceId=" + (groupInstanceId.map(String::toString).orElse("null"))
+
+                ")";
+        }
     }
 
     final class Assignment {
@@ -158,9 +168,9 @@ public interface ConsumerPartitionAssignor {
         @Override
         public String toString() {
             return "Assignment(" +
-                    "partitions=" + partitions +
-                    (userData == null ? "" : ", userDataSize=" + userData.remaining()) +
-                    ')';
+                "partitions=" + partitions +
+                (userData == null ? "" : ", userDataSize=" + userData.remaining()) +
+                ')';
         }
     }
 
@@ -174,6 +184,13 @@ public interface ConsumerPartitionAssignor {
         public Map<String, Subscription> groupSubscription() {
             return subscriptions;
         }
+
+        @Override
+        public String toString() {
+            return "GroupSubscription(" +
+                "subscriptions=" + subscriptions +
+                ")";
+        }
     }
 
     final class GroupAssignment {
@@ -186,6 +203,13 @@ public interface ConsumerPartitionAssignor {
         public Map<String, Assignment> groupAssignment() {
             return assignments;
         }
+
+        @Override
+        public String toString() {
+            return "GroupAssignment(" +
+                "assignments=" + assignments +
+                ")";
+        }
     }
 
     /**


Mime
View raw message