forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[improve][client] PIP-224: Add getLastMessageIds API to deprecate get…
…LastMessageId Master Issue: apache#18616 Fixes apache#4940 NOTE: This implementation is different from the original design of PIP-224 that the method name is `getLastMessageIds` instead of `getLastTopicMessageId`. ### Motivation When a multi-topics consumer calls `getLastMessageId`, a `MultiMessageIdImpl` instance will be returned. It contains a map of the topic name and the latest message id of the topic. However, the `MultiMessageIdImpl` cannot be used in any place of the API that accepts a `MessageId` because all methods of the `MessageId` interface are not implemented, including `compareTo` and `toByteArray`. Therefore, users cannot do anything on such a `MessageId` implementation except casting `MessageId` to `MultiMessageIdImpl` and get the internal map. ### Modifications - Throw an exception when calling `getLastMessageId` on a multi-topics consumer instead of returning a `MultiMessageIdImpl`. - Remove the `MultiMessageIdImpl` implementation and its related tests. - Add the `getLastMessageIds` methods to `Consumer`. It returns a list of `TopicMessageId` instances, each of them represents the last message id of the owner topic. - Mark the `getLastMessageId` API as deprecated. ### Verifications - Modify the `TopicsConsumerImplTest#testGetLastMessageId` to test the `getLastMessageIds` for a multi-topics consumer. - Modify the `TopicReaderTest#testHasMessageAvailable` to test the `getLastMessageIds` for a single topic consumer.
- Loading branch information
1 parent
3b118b6
commit 35b90d7
Showing
10 changed files
with
94 additions
and
411 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
108 changes: 0 additions & 108 deletions
108
pulsar-client/src/main/java/org/apache/pulsar/client/impl/MultiMessageIdImpl.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.