Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[feat][ws]Add support for initialSubscriptionPosition in Websocket Consumer #23013

Conversation

moinessim
Copy link
Contributor

Fixes #22969

Motivation

As a websocket client, I need to subscribe to a persistent topic that has existing messages.
I need to consume all messages, starting from the first (earliest) one, and keep consuming messages as they become available.
Persistent subscription cursor is needed, hence the use of consumer api.

There is no parameter available for this setting shown in the documentation, or in the code that creates the subscription.

There is a similar setting messageId for the Reader endpoint.
But not for the Consumer endpoint.

Modifications

Passthru the SubscriptionInitialPosition query parameter to the Consumer java API.

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

Matching PR in forked repository

PR in forked repository:

@github-actions github-actions bot added the doc-required Your PR changes impact docs and you will update later. label Jul 8, 2024
@lhotari
Copy link
Member

lhotari commented Jul 9, 2024

[INFO] There are 2 errors reported by Checkstyle 10.14.2 with /home/runner/work/pulsar/pulsar/buildtools/src/main/resources/pulsar/checkstyle.xml ruleset.
Error:  src/main/java/org/apache/pulsar/websocket/ConsumerHandler.java:[436] (sizes) LineLength: Line is longer than 120 characters (found 140).
Error:  src/main/java/org/apache/pulsar/websocket/ConsumerHandler.java:[438] (sizes) LineLength: Line is longer than 120 characters (found 133).

instructions to setup IDE code style

Avoid multiple gets by using a variable
@Technoboy- Technoboy- added ready-to-test and removed doc-required Your PR changes impact docs and you will update later. labels Jul 15, 2024
@Technoboy- Technoboy- added this to the 3.4.0 milestone Jul 15, 2024
@github-actions github-actions bot added the doc-required Your PR changes impact docs and you will update later. label Jul 15, 2024
@Technoboy- Technoboy- added area/websocket and removed doc-required Your PR changes impact docs and you will update later. labels Jul 16, 2024
@Technoboy- Technoboy- merged commit 23163f9 into apache:master Jul 16, 2024
52 of 53 checks passed
@github-actions github-actions bot added the doc-required Your PR changes impact docs and you will update later. label Jul 16, 2024
hanmz pushed a commit to hanmz/pulsar that referenced this pull request Feb 12, 2025
…nsumer (apache#23013)

Co-authored-by: Moises Nessim <moises.nessim@topmanage.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area/websocket doc-required Your PR changes impact docs and you will update later. ready-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

As a websocket consumer I need to set InitialSubscriptionPosition to earliest
4 participants