ConcurrencyPractitioner commented on a change in pull request #3273: Adding
config auto.offset.reset to PulsarKafkaConsumer
URL: https://github.com/apache/pulsar/pull/3273#discussion_r244795893
##########
File path:
pulsar-client-kafka-compat/pulsar-client-kafka/src/main/java/org/apache/kafka/clients/consumer/PulsarKafkaConsumer.java
##########
@@ -311,6 +325,9 @@ public void unsubscribe() {
long offset = MessageIdUtils.getOffset(msgId);
TopicPartition tp = new TopicPartition(topic, partition);
+ if (lastReceivedOffset.get(tp) == null) {
Review comment:
Well, I noticed that lastReceivedOffset is cleared whenever a seek-to-end or
seek-to-front is called. So looking into it, I found that whenever
lastReceivedOffset.get(tp) returns null, it would indicate the current offset
position is invalid (or could not be found since we are using a map). Taking
advantage of this fact, I would just call seekToEnd or seekToFront to achieve
the same behavior as KafkaConsumer. Because in KafkaConsumer internals, their
position() method and seekToEnd() and seekToStart() uses the same approach.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services