pulsar-client-cpp
Loading...
Searching...
No Matches
client_configuration.h
1
20#pragma once
21
22#include <pulsar/defines.h>
23#include <stdbool.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29typedef enum
30{
31 pulsar_DEBUG = 0,
32 pulsar_INFO = 1,
33 pulsar_WARN = 2,
34 pulsar_ERROR = 3
35} pulsar_logger_level_t;
36
37typedef void (*pulsar_logger)(pulsar_logger_level_t level, const char *file, int line, const char *message,
38 void *ctx);
39
40typedef struct pulsar_logger_t {
41 // The context that will be passed into `is_enabled` and `log` as the last argument
42 void *ctx;
43 // Whether to log for the given log level
44 bool (*is_enabled)(pulsar_logger_level_t level, void *ctx);
45 // How to log the message
46 pulsar_logger log;
48
49typedef struct _pulsar_client_configuration pulsar_client_configuration_t;
50typedef struct _pulsar_authentication pulsar_authentication_t;
51
52PULSAR_PUBLIC pulsar_client_configuration_t *pulsar_client_configuration_create();
53
54PULSAR_PUBLIC void pulsar_client_configuration_free(pulsar_client_configuration_t *conf);
55
61PULSAR_PUBLIC void pulsar_client_configuration_set_auth(pulsar_client_configuration_t *conf,
62 pulsar_authentication_t *authentication);
63
70PULSAR_PUBLIC void pulsar_client_configuration_set_memory_limit(pulsar_client_configuration_t *conf,
71 unsigned long long memoryLimitBytes);
72
76PULSAR_PUBLIC unsigned long long pulsar_client_configuration_get_memory_limit(
77 pulsar_client_configuration_t *conf);
78
85PULSAR_PUBLIC void pulsar_client_configuration_set_operation_timeout_seconds(
86 pulsar_client_configuration_t *conf, int timeout);
87
91PULSAR_PUBLIC int pulsar_client_configuration_get_operation_timeout_seconds(
92 pulsar_client_configuration_t *conf);
93
100PULSAR_PUBLIC void pulsar_client_configuration_set_io_threads(pulsar_client_configuration_t *conf,
101 int threads);
102
106PULSAR_PUBLIC int pulsar_client_configuration_get_io_threads(pulsar_client_configuration_t *conf);
107
118PULSAR_PUBLIC void pulsar_client_configuration_set_message_listener_threads(
119 pulsar_client_configuration_t *conf, int threads);
120
124PULSAR_PUBLIC int pulsar_client_configuration_get_message_listener_threads(
125 pulsar_client_configuration_t *conf);
126
135PULSAR_PUBLIC void pulsar_client_configuration_set_concurrent_lookup_request(
136 pulsar_client_configuration_t *conf, int concurrentLookupRequest);
137
141PULSAR_PUBLIC int pulsar_client_configuration_get_concurrent_lookup_request(
142 pulsar_client_configuration_t *conf);
143
144PULSAR_PUBLIC void pulsar_client_configuration_set_logger(pulsar_client_configuration_t *conf,
145 pulsar_logger logger, void *ctx);
146
147PULSAR_PUBLIC void pulsar_client_configuration_set_logger_t(pulsar_client_configuration_t *conf,
148 pulsar_logger_t logger);
149
150PULSAR_PUBLIC void pulsar_client_configuration_set_use_tls(pulsar_client_configuration_t *conf, int useTls);
151
152PULSAR_PUBLIC int pulsar_client_configuration_is_use_tls(pulsar_client_configuration_t *conf);
153
154PULSAR_PUBLIC void pulsar_client_configuration_set_tls_trust_certs_file_path(
155 pulsar_client_configuration_t *conf, const char *tlsTrustCertsFilePath);
156
157PULSAR_PUBLIC const char *pulsar_client_configuration_get_tls_trust_certs_file_path(
158 pulsar_client_configuration_t *conf);
159
160PULSAR_PUBLIC void pulsar_client_configuration_set_tls_allow_insecure_connection(
161 pulsar_client_configuration_t *conf, int allowInsecure);
162
163PULSAR_PUBLIC void pulsar_client_configuration_set_tls_private_key_file_path(
164 pulsar_client_configuration_t *conf, const char *private_key_file_path);
165
166PULSAR_PUBLIC const char *pulsar_client_configuration_get_tls_private_key_file_path(
167 pulsar_client_configuration_t *conf);
168
169PULSAR_PUBLIC void pulsar_client_configuration_set_tls_certificate_file_path(
170 pulsar_client_configuration_t *conf, const char *certificateFilePath);
171
172PULSAR_PUBLIC const char *pulsar_client_configuration_get_tls_certificate_file_path(
173 pulsar_client_configuration_t *conf);
174
175PULSAR_PUBLIC int pulsar_client_configuration_is_tls_allow_insecure_connection(
176 pulsar_client_configuration_t *conf);
177
178/*
179 * Initialize stats interval in seconds. Stats are printed and reset after every 'statsIntervalInSeconds'.
180 * Set to 0 in order to disable stats collection.
181 */
182PULSAR_PUBLIC void pulsar_client_configuration_set_stats_interval_in_seconds(
183 pulsar_client_configuration_t *conf, const unsigned int interval);
184
185PULSAR_PUBLIC int pulsar_client_configuration_is_validate_hostname(pulsar_client_configuration_t *conf);
186
187PULSAR_PUBLIC void pulsar_client_configuration_set_validate_hostname(pulsar_client_configuration_t *conf,
188 int validateHostName);
189
190/*
191 * Get the stats interval set in the client.
192 */
193PULSAR_PUBLIC const unsigned int pulsar_client_configuration_get_stats_interval_in_seconds(
194 pulsar_client_configuration_t *conf);
195
196#ifdef __cplusplus
197}
198#endif
Definition client_configuration.h:40