Lanayx commented on a change in pull request #6345: [Java Reader Client] Start 
reader inside batch result in read first message in batch.
URL: https://github.com/apache/pulsar/pull/6345#discussion_r394281751
 
 

 ##########
 File path: 
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ConsumerImpl.java
 ##########
 @@ -1520,7 +1536,10 @@ public void seek(long timestamp) throws 
PulsarClientException {
         cnx.sendRequestWithId(seek, requestId).thenRun(() -> {
             log.info("[{}][{}] Successfully reset subscription to message id 
{}", topic, subscription, messageId);
             acknowledgmentsGroupingTracker.flushAndClean();
-            lastDequeuedMessage = messageId;
+
+            seekMessageId = new BatchMessageIdImpl((MessageIdImpl) messageId);
+            duringSeek.set(true);
 
 Review comment:
   Yes, I like this improvement, just want to add that additional effort needs 
to be done here to make it work properly, since Seek+Read is a very common 
reader pattern. If I put a small delay between 2 and 3 step, then everything 
works properly, because connection `State` changes to `Connecting` and 
`getLastMessageId` is retried, but if `hasMessageAvailableAsync` is called 
before state change, then I get the error.
   To make it clear - I don't run the code from the branch, but porting changes 
to .net client library, so this is how I found the issue, but it looks like 
this issue logically exists for Java client as well.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to