-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[improve][client] PIP-224: Add getLastMessageIds API #20040
Merged
BewareMyPower
merged 4 commits into
apache:master
from
BewareMyPower:bewaremypower/pip-224-get-last-msg-id
Apr 11, 2023
Merged
[improve][client] PIP-224: Add getLastMessageIds API #20040
BewareMyPower
merged 4 commits into
apache:master
from
BewareMyPower:bewaremypower/pip-224-get-last-msg-id
Apr 11, 2023
Conversation
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
…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.
lifepuzzlefun
approved these changes
Apr 8, 2023
codelipenghui
requested changes
Apr 10, 2023
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Consumer.java
Show resolved
Hide resolved
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/Consumer.java
Show resolved
Hide resolved
b6e118a
to
fd129bb
Compare
fd129bb
to
0960047
Compare
shibd
approved these changes
Apr 10, 2023
pulsar-broker/src/test/java/org/apache/pulsar/client/impl/TopicsConsumerImplTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Baodi Shi <[email protected]>
codelipenghui
approved these changes
Apr 10, 2023
/pulsarbot run-failure-checks |
Demogorgon314
pushed a commit
to Demogorgon314/pulsar
that referenced
this pull request
Apr 11, 2023
Co-authored-by: Baodi Shi <[email protected]>
1 task
RobertIndie
pushed a commit
to apache/pulsar-client-go
that referenced
this pull request
May 28, 2024
### Motivation To keep consistent with the Java client. Releted PR: apache/pulsar#20040 ### Modifications - Add `GetLastMessageIDs`api for consumer.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/client
doc
Your PR contains doc changes, no matter whether the changes are in markdown or code files.
ready-to-test
type/enhancement
The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Master Issue: #18616
Fixes #4940
NOTE: This implementation is different from the original design of PIP-224 that the method name is
getLastMessageIds
instead ofgetLastTopicMessageId
.Motivation
When a multi-topics consumer calls
getLastMessageId
, aMultiMessageIdImpl
instance will be returned. It contains a map of the topic name and the latest message id of the topic. However, theMultiMessageIdImpl
cannot be used in any place of the API that accepts aMessageId
because all methods of theMessageId
interface are not implemented, includingcompareTo
andtoByteArray
.Therefore, users cannot do anything on such a
MessageId
implementation except castingMessageId
toMultiMessageIdImpl
and get the internal map.Modifications
getLastMessageIds
methods toConsumer
. It returns a list ofTopicMessageId
instances, each of them represents the last message id of the owner topic.getLastMessageId
APIs as deprecated.Verifications
TopicsConsumerImplTest#testGetLastMessageId
to test thegetLastMessageIds
for a multi-topics consumer.TopicReaderTest#testHasMessageAvailable
to test thegetLastMessageIds
for a single topic consumer.Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: BewareMyPower#25