Skip to content

[improve][pip] PIP-332: peek messages from topic subscription with messagePosition value#22304

Open
shravannarayan-es wants to merge 2540 commits intoapache:branch-2.11from
shravannarayan-es:peekWithPosition-v2.11
Open

[improve][pip] PIP-332: peek messages from topic subscription with messagePosition value#22304
shravannarayan-es wants to merge 2540 commits intoapache:branch-2.11from
shravannarayan-es:peekWithPosition-v2.11

Conversation

@shravannarayan-es
Copy link

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

  • 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)
  • 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
  • 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:

thetumbled and others added 30 commits January 30, 2024 07:40
…Doc (apache#21980)

Co-authored-by: Matteo Merli <mmerli@apache.org>
…22022)

### Motivation

For some use case, the users need to store all the messages even though these message are acked by all subscription.
So they set the retention policy of the namespace to infinite retention (setting both time and size limits to `-1`).  But the data in the system topic does not need for infinite retention. 

### Modifications

For system topics, do not retain messages that have already been acknowledged.
…addTransaction (apache#22020)

### Motivation
According to the method signature, we should return true when the transaction is added to the tracker.
```
    /**
     * Add a txnID to the tracker.
     *
     * @param sequenceId
     *            the sequenceId
     * @param timeout
     *            the absolute timestamp for transaction timeout
     *
     * @return true if the transaction was added to the tracker or false if had timed out
     */
    CompletableFuture<Boolean> addTransaction(long sequenceId, long timeout);
```
But actually, we return false for any cases.

Update: Moreover, we do not use the return value anyway, it is useless. We have better remove it.

### Modifications

~~Return true when the transaction is added to the tracker.~~
Remove the return value as it is useless.
Co-authored-by: Zac Bentley <zbentley@users.noreply.github.com>
Co-authored-by: Matteo Merli <mmerli@apache.org>
…-io/solr (apache#22047)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- https://learn.microsoft.com/en-us/azure/data-explorer/

Co-authored-by: Ramachandran A G <106139410+ag-ramachandran@users.noreply.github.com>
…-404` when calling `Admin API` and the topic does not exist. (apache#21995)
… in expiryMon… (apache#21991)

Co-authored-by: atomchchen <atomchchen@tencent.com>
lhotari and others added 28 commits April 23, 2024 16:10
… an orphan replicator in the previous topic owner (apache#21948)
Signed-off-by: Zixuan Liu <nodeces@gmail.com>
…oad non-persistent topic fails and fix the flaky test testBrokerStatsTopicLoadFailed (apache#22580)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-required Your PR changes impact docs and you will update later.

Projects

None yet

Development

Successfully merging this pull request may close these issues.