[ 
https://issues.apache.org/jira/browse/GOBBLIN-1716?focusedWorklogId=813161&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-813161
 ]

ASF GitHub Bot logged work on GOBBLIN-1716:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 28/Sep/22 23:09
            Start Date: 28/Sep/22 23:09
    Worklog Time Spent: 10m 
      Work Description: ZihanLi58 commented on code in PR #3570:
URL: https://github.com/apache/gobblin/pull/3570#discussion_r982929378


##########
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/kafka/HighLevelConsumer.java:
##########
@@ -123,19 +123,7 @@ public HighLevelConsumer(String topic, Config config, int 
numThreads) {
     this.numThreads = numThreads;
     this.config = config.withFallback(FALLBACK);
     this.gobblinKafkaConsumerClient = createConsumerClient(this.config);
-    // On Partition rebalance, commit exisiting offsets and reset.
-    this.gobblinKafkaConsumerClient.subscribe(this.topic, new 
GobblinConsumerRebalanceListener() {
-      @Override
-      public void onPartitionsRevoked(Collection<KafkaPartition> partitions) {
-        copyAndCommit();
-        partitionOffsetsToCommit.clear();
-      }
-
-      @Override
-      public void onPartitionsAssigned(Collection<KafkaPartition> partitions) {
-        // No op
-      }
-    });
+    initializeConsumerClient();

Review Comment:
   Change the method name to be assign topic partitions?



##########
gobblin-service/src/main/java/org/apache/gobblin/service/monitoring/SpecStoreChangeMonitor.java:
##########
@@ -74,7 +76,15 @@ public String load(String key) throws Exception {
   protected GobblinServiceJobScheduler scheduler;
 
   public SpecStoreChangeMonitor(String topic, Config config, int numThreads) {
-    super(topic, config, numThreads);
+    // Differentiate group id for each host
+    super(topic, config.withValue(GROUP_ID_KEY,
+        ConfigValueFactory.fromAnyRef(SPEC_STORE_CHANGE_MONITOR_PREFIX + 
UUID.randomUUID().toString())),
+        numThreads);
+  }
+
+  @Override
+  protected void initializeConsumerClient() {

Review Comment:
   Add comment here to mention that we expect the client to consume all 
partitions in the topic from the latest offset? You can even move that part of 
logic here



##########
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/kafka/client/GobblinKafkaConsumerClient.java:
##########
@@ -169,6 +169,8 @@ default long committed(KafkaPartition partition) {
 
   public default void assignAndSeek(List<KafkaPartition> topicPartitions, 
Map<KafkaPartition, LongWatermark> topicWatermarksMap) { return; }
 
+  public default void initializeClient(String topic) { return; }

Review Comment:
   What's this method for? 





Issue Time Tracking
-------------------

    Worklog Id:     (was: 813161)
    Time Spent: 40m  (was: 0.5h)

> refactor HighLevelConsumer to make consumer initialization configurable
> -----------------------------------------------------------------------
>
>                 Key: GOBBLIN-1716
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1716
>             Project: Apache Gobblin
>          Issue Type: Improvement
>            Reporter: Urmi Mustafi
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Derived classes of HighLevelConsumer, for example SpecChangeMonitor, may want 
> to initialize the kafka partitions and offset differently so we refactor the 
> base class to grant this configurability. The default implementation remains 
> the same as the original. 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to