Skip to content

Commit

Permalink
[CAPI] Support setting priority for consumers (#12526)
Browse files Browse the repository at this point in the history
### Motivation

We would like to make it possible for C API based client library to set the priority level for consumers.

### Modifications

Add methods to set/get priority level for consumers.

Co-authored-by: k2la <yfuruta@yahoo-corp.jp>
  • Loading branch information
k2la and k2la authored Nov 2, 2021
1 parent 3eec833 commit a75a974
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pulsar-client-cpp/include/pulsar/c/consumer_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@ PULSAR_PUBLIC void pulsar_consumer_set_subscription_initial_position(
PULSAR_PUBLIC void pulsar_consumer_configuration_set_property(pulsar_consumer_configuration_t *conf,
const char *name, const char *value);

PULSAR_PUBLIC void pulsar_consumer_configuration_set_priority_level(
pulsar_consumer_configuration_t *consumer_configuration, int priority_level);

PULSAR_PUBLIC int pulsar_consumer_configuration_get_priority_level(
pulsar_consumer_configuration_t *consumer_configuration);

// const CryptoKeyReaderPtr getCryptoKeyReader()
//
// const;
Expand Down
10 changes: 10 additions & 0 deletions pulsar-client-cpp/lib/c/c_ConsumerConfiguration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,13 @@ int pulsar_consumer_get_subscription_initial_position(
pulsar_consumer_configuration_t *consumer_configuration) {
return consumer_configuration->consumerConfiguration.getSubscriptionInitialPosition();
}

void pulsar_consumer_configuration_set_priority_level(pulsar_consumer_configuration_t *consumer_configuration,
int priority_level) {
consumer_configuration->consumerConfiguration.setPriorityLevel(priority_level);
}

int pulsar_consumer_configuration_get_priority_level(
pulsar_consumer_configuration_t *consumer_configuration) {
return consumer_configuration->consumerConfiguration.getPriorityLevel();
}

0 comments on commit a75a974

Please sign in to comment.