pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] merlimat commented on a change in pull request #3273: Adding config auto.offset.reset to PulsarKafkaConsumer
Date Thu, 03 Jan 2019 03:52:11 GMT
merlimat commented on a change in pull request #3273: Adding config auto.offset.reset to PulsarKafkaConsumer
URL: https://github.com/apache/pulsar/pull/3273#discussion_r244908804
 
 

 ##########
 File path: pulsar-client-kafka-compat/pulsar-client-kafka/src/main/java/org/apache/kafka/clients/consumer/PulsarKafkaConsumer.java
 ##########
 @@ -492,9 +508,21 @@ public void seekToEnd(Collection<TopicPartition> partitions) {
     @Override
     public long position(TopicPartition partition) {
         Long offset = lastReceivedOffset.get(partition);
-        return offset != null ? offset : -1l;
+        if (offset == null) {
+            return resetOffsets(partition).getValue();
+        }
+        return offset;
     }
 
+    private SubscriptionInitialPosition resetOffsets(final TopicPartition partition) {
+    	if (strategy == SubscriptionInitialPosition.Earliest) {
+    		seekToBeginning(Collections.singleton(partition));
 
 Review comment:
   There are still several cases with tabs instead of spaces

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message