[improve][pip] PIP-332: peek messages from topic subscription with messagePosition value
PIP: 332
Motivation
Currently we are able to peek any number of messages of a topic subscription backlog using the Pulsar Java Admin API. However, we are only able to view these messages starting from the most recent message i.e messagePosition of 1. If we want to view the 100th message, we have to peek all the top 100 messages. When the number of messages is large, we want to split them by paging them and displaying them on the UI. So, we would like the ability to view any batch of messages instead of all of the top messages. With the messagePosition and numberOfMessages that should be fairly straightforward to do.
Modifications
The Pulsar Admin API in Java currently provides a way to peek messages using this This function includes a default hardcoded messagePosition value of 1. We want to give the user the option to input a different messagePosition value. The current peekMessages(String topic, String subName, int numMessages) method will remain the same and use messagePosition of 1. We will be overloading this method with messagePosition. It will default to 1 if not specified.
Verifying this change
- [x] Make sure that the change passes the CI checks.
This change is a trivial rework / code cleanup without any test coverage.
Does this pull request potentially affect one of the following parts:
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
- [ ]
doc - [x]
doc-required - [ ]
doc-not-needed - [ ]
doc-complete
PR for pulsar-site doc updates: [improve][site] Doc changes to support peekMessages with Offset in admin-api-topics pulsar-site#840
Matching PR in forked repository
PR in forked repository: