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/09/13 03:26:11 UTC
[GitHub] [pulsar] poorbarcode commented on a diff in pull request #17443: [fix][client]Duplicate messages when use MultiTopicsConsumerImpl
poorbarcode commented on code in PR #17443:
URL: https://github.com/apache/pulsar/pull/17443#discussion_r969114272
##########
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiTopicsConsumerImpl.java:
##########
@@ -789,20 +804,31 @@ public CompletableFuture<Void> seekAsync(MessageId messageId) {
new PulsarClientException("Illegal messageId, messageId can only be earliest/latest")
);
}
- List<CompletableFuture<Void>> futures = new ArrayList<>(consumers.size());
- consumers.values().forEach(consumerImpl -> futures.add(consumerImpl.seekAsync(targetMessageId)));
-
- unAckedMessageTracker.clear();
- clearIncomingMessages();
-
- return FutureUtil.waitForAll(futures);
+ return internalSeekAsync(consumer -> consumer.seekAsync(messageId));
}
@Override
public CompletableFuture<Void> seekAsync(long timestamp) {
- List<CompletableFuture<Void>> futures = new ArrayList<>(consumers.size());
- consumers.values().forEach(consumer -> futures.add(consumer.seekAsync(timestamp)));
- return FutureUtil.waitForAll(futures);
+ return internalSeekAsync(consumer -> consumer.seekAsync(timestamp));
+ }
+
+ private CompletableFuture<Void> internalSeekAsync(Function<Consumer, CompletableFuture<Void>> childSeekFunction) {
+ pause();
+ CompletableFuture<Void> res = FutureUtil.waitForAll(receiveMessageFutures).thenCompose(__ -> {
Review Comment:
Good suggestion, but we don't have the operability of `cancel`
--
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