[ https://issues.apache.org/jira/browse/GOBBLIN-1040?focusedWorklogId=395717&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-395717 ]
ASF GitHub Bot logged work on GOBBLIN-1040: ------------------------------------------- Author: ASF GitHub Bot Created on: 02/Mar/20 02:42 Start Date: 02/Mar/20 02:42 Worklog Time Spent: 10m Work Description: sv2000 commented on pull request #2900: [GOBBLIN-1040] HighLevelConsumer re-design by removing references to … URL: https://github.com/apache/incubator-gobblin/pull/2900#discussion_r386166044 ########## File path: gobblin-modules/gobblin-kafka-09/src/main/java/org/apache/gobblin/kafka/client/Kafka09ConsumerClient.java ########## @@ -160,14 +164,30 @@ public long getLatestOffset(KafkaPartition partition) throws KafkaOffsetRetrieva this.consumer.assign(Lists.newArrayList(new TopicPartition(partition.getTopicName(), partition.getId()))); this.consumer.seek(new TopicPartition(partition.getTopicName(), partition.getId()), nextOffset); - ConsumerRecords<K, V> consumerRecords = consumer.poll(super.fetchTimeoutMillis); - return Iterators.transform(consumerRecords.iterator(), new Function<ConsumerRecord<K, V>, KafkaConsumerRecord>() { + return consume(); + } - @Override - public KafkaConsumerRecord apply(ConsumerRecord<K, V> input) { - return new Kafka09ConsumerRecord<>(input); - } - }); + @Override + public synchronized Iterator<KafkaConsumerRecord> consume() { + try { + ConsumerRecords<K, V> consumerRecords = consumer.poll(super.fetchTimeoutMillis); + + return Iterators.transform(consumerRecords.iterator(), input -> { + try { + return new Kafka09ConsumerRecord(input); + } catch (Throwable t) { + throw Throwables.propagate(t); + } + }); + } catch (Exception e) { + log.error("Exception on polling records", e); + throw new RuntimeException(e); + } + } + + @Override + public void subscribe(String topic) { Review comment: Add javadoc here. How difficult would it be to add multi-topic subscription? It's fine to limit the scope of this PR for single topic subscription, but please add a TODO here if you plan to add that support later. ---------------------------------------------------------------- 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 Issue Time Tracking ------------------- Worklog Id: (was: 395717) Time Spent: 0.5h (was: 20m) > Fix High level consumer > ------------------------ > > Key: GOBBLIN-1040 > URL: https://issues.apache.org/jira/browse/GOBBLIN-1040 > Project: Apache Gobblin > Issue Type: Improvement > Reporter: Vikram Bohra > Priority: Major > Time Spent: 0.5h > Remaining Estimate: 0h > -- This message was sent by Atlassian Jira (v8.3.4#803005)