codelipenghui commented on code in PR #20040:
URL: https://github.com/apache/pulsar/pull/20040#discussion_r1161606167
##########
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Consumer.java:
##########
@@ -536,19 +537,38 @@ CompletableFuture<Void>
reconsumeLaterCumulativeAsync(Message<?> message,
CompletableFuture<Void> seekAsync(long timestamp);
/**
- * Get the last message id available for consume.
+ * Get the last message id of the topic subscribed.
*
- * @return the last message id.
+ * @return the last message id of the topic subscribed
+ * @throws PulsarClientException if multiple topics or partitioned topics
are subscribed or failed because of a
+ * network issue
+ * NOTE: Use {@link Consumer#getLastMessageIds()} instead.
*/
+ @Deprecated
MessageId getLastMessageId() throws PulsarClientException;
/**
- * Get the last message id available for consume.
- *
- * @return a future that can be used to track the completion of the
operation.
+ * The asynchronous version of {@link Consumer#getLastMessageId()}.
+ * NOTE: Use {@link Consumer#getLastMessageIdsAsync()} instead.
*/
+ @Deprecated
CompletableFuture<MessageId> getLastMessageIdAsync();
+ /**
+ * Get all the last message id of the topics the consumer subscribed.
+ *
+ * @return the list of TopicMessageId instances of all the topics that the
consumer subscribed
+ * @throws PulsarClientException if failed to get last message id.
+ * @apiNote It's guaranteed that the owner topic of each TopicMessageId in
the returned list is different from owner
+ * topics of other TopicMessageId instances
+ */
+ List<TopicMessageId> getLastMessageIds() throws PulsarClientException;
Review Comment:
Please also update the proposal according to the new method name.
##########
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Consumer.java:
##########
@@ -536,19 +537,38 @@ CompletableFuture<Void>
reconsumeLaterCumulativeAsync(Message<?> message,
CompletableFuture<Void> seekAsync(long timestamp);
/**
- * Get the last message id available for consume.
+ * Get the last message id of the topic subscribed.
*
- * @return the last message id.
+ * @return the last message id of the topic subscribed
+ * @throws PulsarClientException if multiple topics or partitioned topics
are subscribed or failed because of a
+ * network issue
+ * NOTE: Use {@link Consumer#getLastMessageIds()} instead.
*/
+ @Deprecated
Review Comment:
If we mark the API as deprecated, we should not change the behavior of the
API. The `@Deprecated` annotation helped us to tell users the API will be
removed in the future, but not now. Users can migrate to the new API after
upgrading to the new version without any compatibility issues. We should mark
it as `@Deprecated` first and remove it in the future.
--
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]