BewareMyPower commented on code in PR #19158:
URL: https://github.com/apache/pulsar/pull/19158#discussion_r1090410931


##########
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/MessageAcknowledger.java:
##########
@@ -49,6 +49,8 @@ public interface MessageAcknowledger {
      *
      * @throws PulsarClientException.AlreadyClosedException}
      *             if the consumer was already closed
+     * @throws PulsarClientException.NotAllowedException
+     *             if `messageId` is not a {@link TopicMessageId} when 
multiple topics are subscribed

Review Comment:
   > Does the TopicMessageId interface is intentionally exposed to users? 
   
   Yes. The new `getLastTopicMessageId` APIs will return `TopicMessageId` 
instances, they will be introduced in another PR, see the [original PIP 
issue](https://github.com/apache/pulsar/issues/18616).. And users can avoid 
touching the `pulsar-client` module (internal implementations) to get the topic 
name of a message ID.
   
   ```java
   if (msgId instanceof TopicMessageId) {
       multiTopicsConsumer.seek(msgId);
   } else {
       multiTopicsConsumer.seek(TopicMessageId.create(topic, msgId));
   }
   ```
   
   > Which one should be suggested in the future?
   
   `fromByteArrayWithTopic` should be deprecated. The `MessageId` that is not a 
`TopicMessageId` could be retrieved from other ways, not only the 
deserialization. But `fromByteArrayWithTopic` assumes it (e.g. a 
`MessageIdImpl`) was retrieved from deserialization.
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to