Skip to content
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

feat: expose partitions update interval configuration to C client #437

Merged
merged 2 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
Loading