Skip to content

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

Closed

Description

@zwalsh-toast

Is your enhancement request related to a problem? Please describe.
Our applications currently start up and immediately subscribe and consume pulsar messages. We would like to decouple deployment from activation, and then use pause/resume to safely turn different deploys on and off.

Describe the solution you'd like
Add an option to the consumer builder to subscribe in a paused state, e.g.:

val consumer = pulsarClient.newConsumer()
    .topic(topic)
    .subscriptionName(name)
    .subscriptionType(SubscriptionType.Shared)
    .receiverQueueSize(1000)
    // ...
    .paused(true)
    .subscribe()

Describe alternatives you've considered

  • Subscribe and then pause immediately
    • This will increment the number of permits up to receiverQueueSize, making those messages inaccessible to active consumers
  • Override subscribeAsync to defer the initial subscribe
    • This is not backwards compatible for most of our applications
    • Can't verify authentication/configuration until the subscribe occurs
    • Adds unnecessary complexity

Activity

  1. added
    type/enhancement
    on Aug 30, 2021
  2. codelipenghui commented on Sep 6, 2021

    @codelipenghui
    Contributor

    @zwalsh-toast Are you interested in contributing the feature in Pulsar? Sounds good if we have an option to control the message flow when creating a consumer.

  3. zwalsh-toast commented on Sep 7, 2021

    @zwalsh-toast
    ContributorAuthor

    @zwalsh-toast Are you interested in contributing the feature in Pulsar? Sounds good if we have an option to control the message flow when creating a consumer.

    Hi @codelipenghui - yes, I'll be working on it this week!

  4. codelipenghui commented on Sep 9, 2021

    @codelipenghui
    Contributor

    @zwalsh-toast Cool! Looks forward to your great contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type/enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions