BewareMyPower opened a new pull request, #20040:
URL: https://github.com/apache/pulsar/pull/20040

   Master Issue: https://github.com/apache/pulsar/issues/18616
   
   Fixes https://github.com/apache/pulsar/issues/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.
   
   ### Does this pull request potentially affect one of the following parts:
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   *If the box was checked, please highlight the changes*
   
   - [ ] Dependencies (add or upgrade a dependency)
   - [x] The public API
   - [ ] The schema
   - [ ] The default values of configurations
   - [ ] The threading model
   - [ ] The binary protocol
   - [ ] The REST endpoints
   - [ ] The admin CLI options
   - [ ] The metrics
   - [ ] Anything that affects deployment
   
   ### Documentation
   
   <!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
   
   - [x] `doc` <!-- Your PR contains doc changes. -->
   - [ ] `doc-required` <!-- Your PR changes impact docs and you will update 
later -->
   - [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
   - [ ] `doc-complete` <!-- Docs have been already added -->
   
   ### Matching PR in forked repository
   
   PR in forked repository: https://github.com/BewareMyPower/pulsar/pull/25
   


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