-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature][client] PIP-184: Topic specific consumer priorityLevel #16715
Conversation
@nahguam Could you fix the checkstyle issue? |
...-client/src/main/java/org/apache/pulsar/client/impl/conf/TopicConsumerConfigurationData.java
Outdated
Show resolved
Hide resolved
...-client/src/main/java/org/apache/pulsar/client/impl/conf/TopicConsumerConfigurationData.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look to me. I left some minor questions to hope you can answer.
pulsar-client-api/src/main/java/org/apache/pulsar/client/api/ConsumerBuilder.java
Show resolved
Hide resolved
...-client/src/main/java/org/apache/pulsar/client/impl/conf/TopicConsumerConfigurationData.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure if adding the test coverage to actual usage is necessary. I mean to create the consumer with different priorities and then consume messages from the broker. Not just test the client configuration.
@nahguam Could you please take a look failed test? |
I would hope there are already tests to verify the priority level behaviour. This only changes how the priority level is wired in from the configuration. I added a test to |
@nahguam |
The PR can only merge after the proposal is closed https://lists.apache.org/thread/08olgc0bjr13ld3g0hz58p1sj9c4pk98 |
@nahguam Please help fix the check style, so that we can merge this PR. |
Resolves #16481
Motivation
The Pulsar Java consumer supports setting a priority level for priority message
dispatch in shared subscription consumers and priority assignment in failover
subscription consumers. See the ConsumerBuilder.html#priorityLevel(int)
Javadoc
for a detailed functional description. The Pulsar Java consumer also supports
consuming from multiple topics. However, it is not possible to set a different
priority level for different topics in the same Consumer instance.
This behaviour is desirable in some use cases. For example, a consumer
processing region specific topics might wish to configure region stickiness - A
multi-region application might be consuming from topics events-us-east-1 and
events-eu-west-1. Consumers in all regions should be configured to consume all
topics to ensure data completeness. However, to ensure low latency, the
us-east-1 consumer would need to set a higher priority level for the us-east-1
topic. Similarly, the eu-west-1 consumer would need to set a higher priority
level for the eu-west-1 topic.
Without the ability to configure different priority levels for different
topics, the developer would have to create multiple consumer instances and have
to manage the consumption from them in their application code. This feature
provides developer convenience to keep application code the same regardless of
whether this is a requirement or not.
Modifications
Introduce new methods and configuration to support setting different priority levels for different topics in the same consumer instance.
Verifying this change
This change added tests and can be verified as follows:
(example:)
ConsumerImplTest.testTopicPriorityLevel()
verifies the functionality.Does this pull request potentially affect one of the following parts:
If
yes
was chosen, please highlight the changesDocumentation
Check the box below or label this PR directly.
Need to update docs?
doc-required
(Your PR needs to update docs and you will update later)
doc-not-needed
(Please explain why)
doc
(Your PR contains doc changes)
doc-complete
(Docs have been already added)