Skip to content

[Issue 11846][Java client] Create a consumer in the paused state - #11974

Merged
michaeljmarshall merged 6 commits into
apache:masterfrom
zwalsh-toast:issue-11846-subscribe-paused
Dec 10, 2021
Merged

michaeljmarshall merged 6 commits into
apache:masterfrom
zwalsh-toast:issue-11846-subscribe-paused

Conversation

@zwalsh-toast

Copy link
Copy Markdown
Contributor

Fixes #11846

Motivation

Control the message flow when creating a consumer. Before this change, consumers would immediately send flow permits to the broker upon .subscribe(). Now, consumers can connect (which validates configuration/authentication) immediately, but wait to process messages until .resume() is called.

Modifications

  • Add a field private boolean startPaused to ConsumerConfigurationData
  • Use that boolean to set paused in the ConsumerImpl

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change added tests and can be verified as follows:

  • Added a unit test that confirms the paused state of the consumer based on the ConsumerConfigurationData

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API: (yes)
    • There is a new option paused(boolean) on the ConsumerBuilder
  • The schema: (no)
  • The default values of configurations: (no)
  • The wire protocol: (no)
  • The rest endpoints: (no)
  • The admin cli options: (no)
  • Anything that affects deployment: (no)

Documentation

Check the box below and label this PR (if you have committer privilege).

Need to update docs?

  • doc-required

    (If you need help on updating docs, create a doc issue)

  • no-need-doc

    This PR adds Javadoc to the new ConsumerBuilder option. There's no existing documentation I can find on the site for paused so this seems sufficient.

  • doc

    (If this PR contains doc changes)

@zwalsh-toast

Copy link
Copy Markdown
Contributor Author

Hi @codelipenghui, I think this change should address the issue #11846 we discussed - could you review?

@Anonymitaet Anonymitaet left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. I’ve left some comments, PTAL.

@Anonymitaet Anonymitaet added the doc Your PR contains doc changes, no matter whether the changes are in markdown or code files. label Sep 9, 2021

@michaeljmarshall michaeljmarshall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@michaeljmarshall

Copy link
Copy Markdown
Member

@eolivelli, @codelipenghui, @BewareMyPower, @sijie, @hangc0276, @merlimat - PTAL, thanks.

@zwalsh-toast

Copy link
Copy Markdown
Contributor Author

Bump on this PR! @eolivelli, @codelipenghui, @BewareMyPower, @sijie, @hangc0276, @merlimat - PTAL

@BewareMyPower

Copy link
Copy Markdown
Contributor

LGTM. But I'm wondering if it needs a PIP because it's a new feature for Pulsar client while it's very simple.

Please help confirm it. @merlimat @codelipenghui

@michaeljmarshall michaeljmarshall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zwalsh-toast - sorry this PR has been stale for so long. I just re-reviewed the PR and have a some questions for you. Please see my comments.

@BewareMyPower - while this PR updates the public ConsumerBuilder API, it is a very small and thoughtful extension of it, so I personally don't think it deserves a PIP.

@zwalsh-toast
zwalsh-toast force-pushed the issue-11846-subscribe-paused branch from 7cebf69 to f36d33c Compare December 9, 2021 22:41

@michaeljmarshall michaeljmarshall left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lhotari lhotari added this to the 2.10.0 milestone Dec 10, 2021
@michaeljmarshall michaeljmarshall added the type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages label Dec 10, 2021
@michaeljmarshall
michaeljmarshall merged commit f0da648 into apache:master Dec 10, 2021
fxbing pushed a commit to fxbing/pulsar that referenced this pull request Dec 19, 2021
…che#11974)

* Set paused() in ConsumerBuilder()

* Test that consumer is paused

* Remove todo

* Use present tense in paused Javadoc

Co-authored-by: Anonymitaet <[email protected]>

* Update method name and Javadoc

* ConsumerBuilderImpl test

Co-authored-by: Anonymitaet <[email protected]>
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. type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Java client] Allow consumer to be created in a paused state

5 participants