nahguam opened a new pull request, #16715:
URL: https://github.com/apache/pulsar/pull/16715
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
- [x] Make sure that the change passes the CI checks.
This change added tests and can be verified as follows:
*(example:)*
- Unit test `ConsumerImplTest.testTopicPriorityLevel()` verifies the
functionality.
### 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)
- 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 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)
- [x] `doc`
(Your PR contains doc changes)
- [ ] `doc-complete`
(Docs have been already added)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]