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] [C API] Expose Get/Set Listener Name in C API #370

Merged
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
5 changes: 5 additions & 0 deletions include/pulsar/c/client_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,11 @@ PULSAR_PUBLIC int pulsar_client_configuration_is_validate_hostname(pulsar_client
PULSAR_PUBLIC void pulsar_client_configuration_set_validate_hostname(pulsar_client_configuration_t *conf,
int validateHostName);

PULSAR_PUBLIC void pulsar_client_configuration_set_listener_name(pulsar_client_configuration_t *conf,
const char *listenerName);

PULSAR_PUBLIC const char *pulsar_client_configuration_get_listener_name(pulsar_client_configuration_t *conf);

/*
* Get the stats interval set in the client.
*/
Expand Down
9 changes: 9 additions & 0 deletions lib/c/c_ClientConfiguration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,12 @@ void pulsar_client_configuration_set_memory_limit(pulsar_client_configuration_t
unsigned long long pulsar_client_configuration_get_memory_limit(pulsar_client_configuration_t *conf) {
return conf->conf.getMemoryLimit();
}

void pulsar_client_configuration_set_listener_name(pulsar_client_configuration_t *conf,
const char *listenerName) {
conf->conf.setListenerName(listenerName);
}

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

ASSERT_STREQ(pulsar_client_configuration_get_tls_private_key_file_path(conf), "private.key");
ASSERT_STREQ(pulsar_client_configuration_get_tls_certificate_file_path(conf), "certificate.pem");

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