SEKIRO-J commented on a change in pull request #8748: Use earliest offset on 
kafka newly discovered partitions
URL: https://github.com/apache/incubator-druid/pull/8748#discussion_r342773057
 
 

 ##########
 File path: 
extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/KafkaRecordSupplier.java
 ##########
 @@ -259,4 +260,36 @@ private static void wrapExceptions(Runnable runnable)
       return null;
     });
   }
+
+  @VisibleForTesting
+  private KafkaConsumer<byte[], byte[]> getKafkaConsumer(Map<String, Object> 
consumerConfigs)
+  {
+    final Properties props = new Properties();
+    addConsumerPropertiesFromConfig(props, sortingMapper, consumerProperties);
+    props.putAll(consumerConfigs);
+
+    ClassLoader currCtxCl = Thread.currentThread().getContextClassLoader();
+    try {
+      
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+      Deserializer keyDeserializerObject = getKafkaDeserializer(props, 
"key.deserializer");
+      Deserializer valueDeserializerObject = getKafkaDeserializer(props, 
"value.deserializer");
+
+      return new KafkaConsumer<>(props, keyDeserializerObject, 
valueDeserializerObject);
+    }
+    finally {
+      Thread.currentThread().setContextClassLoader(currCtxCl);
+    }
+  }
+
+  @VisibleForTesting
+  public KafkaRecordSupplier(
+      Map<String, Object> consumerProperties,
+      ObjectMapper sortingMapper,
+      Map<String, Object> consumerConfigs
+  )
+  {
+    this.consumerProperties = consumerProperties;
+    this.sortingMapper = sortingMapper;
+    this.consumer = getKafkaConsumer(consumerConfigs);
+  }
 
 Review comment:
   `getKafkaConsumer()` is a private method. And it depends on other parameters.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to