Skip to content

add shared subscription priority level - #783

Closed
fourhu wants to merge 5 commits into
apache:masterfrom
fourhu:master
Closed

fourhu wants to merge 5 commits into
apache:masterfrom
fourhu:master

Conversation

@fourhu

@fourhu fourhu commented May 31, 2022 •

Copy link
Copy Markdown

<--

Contribution Checklist

  • Name the pull request in the form "[Issue XYZ][component] Title of the pull request", where XYZ should be replaced by the actual issue number.
    Skip Issue XYZ if there is no associated github issue for this pull request.
    Skip component if you are unsure about which is the best component. E.g. [docs] Fix typo in produce method.

  • Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.

  • Each pull request should address only one issue, not mix up code from multiple issues.

  • Each commit in the pull request has a meaningful commit message

  • Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.

(The sections below can be removed for hotfixes of typos)
-->

(If this PR fixes a github issue, please add Fixes #<xyz>.)

Fixes #

(or if this PR is one task of a github issue, please add Master Issue: #<xyz> to link to the master issue.)

Master Issue: #134

Motivation

support priority level for subscription of shared subscription type

Explain here the context, and why you're making that change. What is the problem you're trying to solve.

Modifications

Describe the modifications you've done.
consumer options support priority level for subscription of shared subscription type

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

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: no
  • The schema: no
  • The default values of configurations: yes
  • The wire protocol: no

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not applicable / docs / GoDocs / not documented)
  • If a feature is not applicable for documentation, explain why?
  • If a feature is not documented yet in this PR, please create a followup issue for adding the documentation

@fourhu fourhu changed the title add shared subscription type priority level add shared subscription priority level May 31, 2022
@fourhu fourhu closed this Jun 2, 2022
@fourhu fourhu reopened this Jun 2, 2022

@liangyuanpeng liangyuanpeng left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for your work and added some comment.

Comment thread pulsar/consumer_impl.go Resolved
Comment thread pulsar/consumer_impl.go
options.PriorityLevel = 0
}

if options.Type != Shared {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does we need this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Is PriorityLevel effectived when SubscriptionType is Shared?

@merlimat merlimat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should have a unit test to check the priorities are applied correctly

@fourhu

fourhu commented Jun 24, 2022

Copy link
Copy Markdown
Author

or

ok, I will add unit test later.

@fourhu fourhu closed this Mar 8, 2023
grishaf added a commit to grishaf/pulsar-client-go that referenced this pull request Apr 27, 2026
Add PriorityLevel field to ConsumerOptions to allow setting the
priority level for consumers on Shared and Failover subscriptions,
matching the Java client's ConsumerBuilder.priorityLevel(int) API.

In Shared subscription mode, the broker dispatches messages to the
highest priority consumers first (0 = max priority). In Failover
subscription mode for partitioned topics, the broker selects the
active consumer based on priority level and lexicographic consumer
name sorting.

Previously the Go client hardcoded PriorityLevel to nil in the
CommandSubscribe protobuf message. This change threads the user-
provided priority level through ConsumerOptions -> partitionConsumerOpts
-> CommandSubscribe.

Negative priority levels are rejected with InvalidConfiguration error,
matching the Java client's IllegalArgumentException behavior.

Master Issue: apache/pulsar#134
Supersedes: apache#783 (closed without merge, lacked tests and had validation bugs)

Made-with: Cursor
grishaf added a commit to grishaf/pulsar-client-go that referenced this pull request Apr 27, 2026
    Add PriorityLevel field to ConsumerOptions to allow setting the
    priority level for consumers on Shared and Failover subscriptions,
    matching the Java client's ConsumerBuilder.priorityLevel(int) API.

    In Shared subscription mode, the broker dispatches messages to the
    highest priority consumers first (0 = max priority). In Failover
    subscription mode for partitioned topics, the broker selects the
    active consumer based on priority level and lexicographic consumer
    name sorting.

    Previously the Go client hardcoded PriorityLevel to nil in the
    CommandSubscribe protobuf message. This change threads the user-
    provided priority level through ConsumerOptions -> partitionConsumerOpts
    -> CommandSubscribe.

    Negative priority levels are rejected with InvalidConfiguration error,
    matching the Java client's IllegalArgumentException behavior.

    Master Issue: apache/pulsar#134
    Supersedes: apache#783 (closed without merge, lacked tests and had validation bugs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants