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 2022/10/13 04:43:11 UTC

[GitHub] [pulsar] nodece commented on a diff in pull request #16171: [fix][client] Fix duplicate messages caused by seek

nodece commented on code in PR #16171:
URL: https://github.com/apache/pulsar/pull/16171#discussion_r994136417


##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java:
##########
@@ -252,6 +252,10 @@ private void receiveMessageFromConsumer(ConsumerImpl<T> consumer, boolean batchR
             messagesFuture = consumer.receiveAsync().thenApply(Collections::singletonList);
         }
         messagesFuture.thenAcceptAsync(messages -> {
+            if (consumer.isDuringSeek()) {
+                receiveMessageFromConsumer(consumer, batchReceive);

Review Comment:
   > 2\. If `ConsumerImpl.seek` fails, the messages have popped from `incomingMessages` cannot be consumed until `redeliver` executes
   
   Good catch! We need to consider this.
   
   > It looks like not only from the MultiTopicConsumer.
   
   Yes. 
   
   >  If it is from the user side, using a consumer to receive the messages and another thread try to seek the subscription to another position, they will also receive the duplicated messages right?
   
   For `MultiTopicConsumer`, this is right, because the `MultiTopicConsumer` has a loop to pulling the messsage.
   
   
   
   
   
   
   



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

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org