Skip to content

Commit

Permalink
feat: expose partitions update interval configuration to C client (#437)
Browse files Browse the repository at this point in the history
* feat: expose partitions update interval configuration to C client

* code format
  • Loading branch information
shibd authored Jul 22, 2024
1 parent 35bf161 commit 2a69168
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/pulsar/c/client_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ PULSAR_PUBLIC void pulsar_client_configuration_set_listener_name(pulsar_client_c

PULSAR_PUBLIC const char *pulsar_client_configuration_get_listener_name(pulsar_client_configuration_t *conf);

PULSAR_PUBLIC void pulsar_client_configuration_set_partitions_update_interval(
pulsar_client_configuration_t *conf, const unsigned int intervalInSeconds);

PULSAR_PUBLIC const unsigned int pulsar_client_configuration_get_partitions_update_interval(
pulsar_client_configuration_t *conf);

/*
* Get the stats interval set in the client.
*/
Expand Down
10 changes: 10 additions & 0 deletions lib/c/c_ClientConfiguration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,13 @@ void pulsar_client_configuration_set_listener_name(pulsar_client_configuration_t
const char *pulsar_client_configuration_get_listener_name(pulsar_client_configuration_t *conf) {
return conf->conf.getListenerName().c_str();
}

void pulsar_client_configuration_set_partitions_update_interval(pulsar_client_configuration_t *conf,
const unsigned int intervalInSeconds) {
conf->conf.setPartititionsUpdateInterval(intervalInSeconds);
}

const unsigned int pulsar_client_configuration_get_partitions_update_interval(
pulsar_client_configuration_t *conf) {
return conf->conf.getPartitionsUpdateInterval();
}
3 changes: 3 additions & 0 deletions tests/c/c_ClientConfigurationTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,7 @@ TEST(C_ClientConfigurationTest, testCApiConfig) {

pulsar_client_configuration_set_listener_name(conf, "listenerName");
ASSERT_STREQ(pulsar_client_configuration_get_listener_name(conf), "listenerName");

pulsar_client_configuration_set_partitions_update_interval(conf, 10);
ASSERT_EQ(pulsar_client_configuration_get_partitions_update_interval(conf), 10);
}

0 comments on commit 2a69168

Please sign in to comment.