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/12/21 08:33:31 UTC

[GitHub] [pulsar-client-go] Gleiphir2769 opened a new issue, #919: The Go Client behavior of `Seek` is different with Java Client

Gleiphir2769 opened a new issue, #919:
URL: https://github.com/apache/pulsar-client-go/issues/919

   Hi all, I find that the behavior of go client `Seek` is different with Java client recently, which may confuse the users.
   
   For exmaple, when `Seek()` invoked.
   
   ``` java
   // Java Client
   // seek using the 4th message's id.
   consumer.seek(messageIds.get(3));
   // consumer will receive the 5th message when startMessageIdInclusive is false
   Message<byte[]> msg = consumer.receive();
   ```
   
   ``` golang
   // Go Client
   // seek using the 4th message's id.
   consumer.Seek(msgIDs[1])
   // consumer will receive the 4th message
   msg, err := consumer.Receive(ctx)
   ```
   
   In other words, go client create consumer with `startMessageIdInclusive=true` though the consumer option does not support `startMessageIdInclusive` now.
   
   Interestingly, the reader options support `startMessageIdInclusive` but it has different semantics compared with Java Client. This option only takes effect at reader startup and not after `Seek()` like Java Client. In other words, you will get the 4th message after seeking with the 4th message's id even though your reader option is `startMessageIdInclusive=false`.
   
   https://github.com/apache/pulsar-client-go/blob/d92fb1407d3d39c8a498dd7c7abdc0bbb3fc7e1a/pulsar/reader.go#L55-L57
   
   I think we should modify the code to make the behavior of Go Client keep same with the Java Client. So I want to start a discuss about it.
   
   The new `Seek` of consumer and reader should have the following behaviors.
   - `startMessageIdInclusive` is supported in consumer options and reader options and the default value is `false`.
   - The consumer and read should reset their position in `id+1` after `Seek(id)` when `startMessageIdInclusive=false`.
   
   It should be noted that the above modification will bring **breaking change**. If the user's code relies on Seek's old behavior, it will cause errors.
   
   Please feel free to leave your comments, Thanks.


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

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


[GitHub] [pulsar-client-go] RobertIndie commented on issue #919: The behavior of `Seek` is different with Java Client

Posted by GitBox <gi...@apache.org>.
RobertIndie commented on issue #919:
URL: https://github.com/apache/pulsar-client-go/issues/919#issuecomment-1361084342

   Thanks for your issue. I paste the email discussion about this issue here: https://lists.apache.org/thread/ryn7pq0ctfd5372ww1gsplkplz2sjc0d to add more context.


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


[GitHub] [pulsar-client-go] crossoverJie commented on issue #919: The behavior of `Seek` is different with Java Client

Posted by "crossoverJie (via GitHub)" <gi...@apache.org>.
crossoverJie commented on issue #919:
URL: https://github.com/apache/pulsar-client-go/issues/919#issuecomment-1478936014

   I am interested in implementing this, please assign it to me, thanks. @RobertIndie 


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