You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2017/11/14 00:10:25 UTC

[GitHub] merlimat closed pull request #900: Fixed getting the position in PulsarKafkaConsumer when we don't have an offset yet

merlimat closed pull request #900: Fixed getting the position in PulsarKafkaConsumer when we don't have an offset yet
URL: https://github.com/apache/incubator-pulsar/pull/900
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pulsar-client-kafka-compat/pulsar-client-kafka/src/main/java/org/apache/kafka/clients/consumer/PulsarKafkaConsumer.java b/pulsar-client-kafka-compat/pulsar-client-kafka/src/main/java/org/apache/kafka/clients/consumer/PulsarKafkaConsumer.java
index 6ece7fa0f..379bde4ce 100644
--- a/pulsar-client-kafka-compat/pulsar-client-kafka/src/main/java/org/apache/kafka/clients/consumer/PulsarKafkaConsumer.java
+++ b/pulsar-client-kafka-compat/pulsar-client-kafka/src/main/java/org/apache/kafka/clients/consumer/PulsarKafkaConsumer.java
@@ -456,7 +456,8 @@ public void seekToEnd(Collection<TopicPartition> partitions) {
 
     @Override
     public long position(TopicPartition partition) {
-        return lastReceivedOffset.get(partition);
+        Long offset = lastReceivedOffset.get(partition);
+        return offset != null ? offset : -1l;
     }
 
     @Override


 

----------------------------------------------------------------
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