pulsar-client-cpp
Loading...
Searching...
No Matches
ClientConfiguration.h
1
19#ifndef PULSAR_CLIENTCONFIGURATION_H_
20#define PULSAR_CLIENTCONFIGURATION_H_
21
22#include <pulsar/Authentication.h>
23#include <pulsar/Logger.h>
24#include <pulsar/defines.h>
25
26namespace pulsar {
27class PulsarWrapper;
28struct ClientConfigurationImpl;
29class PULSAR_PUBLIC ClientConfiguration {
30 public:
35
42 ClientConfiguration& setMemoryLimit(uint64_t memoryLimitBytes);
43
47 uint64_t getMemoryLimit() const;
48
54 ClientConfiguration& setAuth(const AuthenticationPtr& authentication);
55
60
68
73
81
85 int getIOThreads() const;
86
98
103
112 ClientConfiguration& setConcurrentLookupRequest(int concurrentLookupRequest);
113
118
126
131
138 ClientConfiguration& setInitialBackoffIntervalMs(int initialBackoffIntervalMs);
139
144
152
157
170
179
183 bool isUseTls() const;
184
190 ClientConfiguration& setTlsPrivateKeyFilePath(const std::string& tlsKeyFilePath);
191
195 const std::string& getTlsPrivateKeyFilePath() const;
196
202 ClientConfiguration& setTlsCertificateFilePath(const std::string& tlsCertificateFilePath);
203
207 const std::string& getTlsCertificateFilePath() const;
208
214 ClientConfiguration& setTlsTrustCertsFilePath(const std::string& tlsTrustCertsFilePath);
215
219 const std::string& getTlsTrustCertsFilePath() const;
220
229
234
249
253 bool isValidateHostName() const;
254
260 ClientConfiguration& setListenerName(const std::string& listenerName);
261
265 const std::string& getListenerName() const;
266
275
279 const unsigned int& getStatsIntervalInSeconds() const;
280
290 ClientConfiguration& setPartititionsUpdateInterval(unsigned int intervalInSeconds);
291
295 unsigned int getPartitionsUpdateInterval() const;
296
307
312
313 friend class ClientImpl;
314 friend class PulsarWrapper;
315
316 private:
317 const AuthenticationPtr& getAuthPtr() const;
318 std::shared_ptr<ClientConfigurationImpl> impl_;
319
320 // By default, when the client connects to the broker, a version string like "Pulsar-CPP-v<x.y.z>" will be
321 // carried and saved by the broker. The client version string could be queried from the topic stats.
322 //
323 // This method provides a way to add more description to a specific `Client` instance. If it's configured,
324 // the description will be appended to the original client version string, with '-' as the separator.
325 //
326 // For example, if the client version is 3.2.0, and the description is "forked", the final client version
327 // string will be "Pulsar-CPP-v3.2.0-forked".
328 //
329 // NOTE: This method should only be called by the PulsarWrapper and the length should not exceed 64.
330 //
331 // For example, you can add a PulsarWrapper class like:
332 //
333 // ```c++
334 // namespace pulsar {
335 // class PulsarWrapper {
336 // static ClientConfiguration clientConfig() {
337 // ClientConfiguration conf;
338 // conf.setDescription("forked");
339 // return conf;
340 // }
341 // };
342 // }
343 // ```
344 //
345 // Then, call the method before passing the `conf` to the constructor of `Client`:
346 //
347 // ```c++
348 // auto conf = PulsarWrapper::clientConfig();
349 // // Set other attributes of `conf` here...
350 // Client client{"pulsar://localhost:6650", conf);
351 // ```
352 ClientConfiguration& setDescription(const std::string& description);
353
354 const std::string& getDescription() const noexcept;
355};
356} // namespace pulsar
357
358#endif /* PULSAR_CLIENTCONFIGURATION_H_ */
Definition Authentication.h:88
Definition ClientConfiguration.h:29
ClientConfiguration & setStatsIntervalInSeconds(const unsigned int &)
int getInitialBackoffIntervalMs() const
ClientConfiguration & setValidateHostName(bool validateHostName)
bool isTlsAllowInsecureConnection() const
ClientConfiguration & setLogger(LoggerFactory *loggerFactory)
const std::string & getTlsTrustCertsFilePath() const
ClientConfiguration & setAuth(const AuthenticationPtr &authentication)
const std::string & getListenerName() const
Authentication & getAuth() const
const unsigned int & getStatsIntervalInSeconds() const
ClientConfiguration & setMaxBackoffIntervalMs(int maxBackoffIntervalMs)
const std::string & getTlsCertificateFilePath() const
ClientConfiguration & setPartititionsUpdateInterval(unsigned int intervalInSeconds)
ClientConfiguration & setMessageListenerThreads(int threads)
ClientConfiguration & setTlsTrustCertsFilePath(const std::string &tlsTrustCertsFilePath)
ClientConfiguration & setConnectionTimeout(int timeoutMs)
int getMaxBackoffIntervalMs() const
ClientConfiguration & setIOThreads(int threads)
int getOperationTimeoutSeconds() const
ClientConfiguration & setTlsCertificateFilePath(const std::string &tlsCertificateFilePath)
int getMessageListenerThreads() const
const std::string & getTlsPrivateKeyFilePath() const
ClientConfiguration & setTlsPrivateKeyFilePath(const std::string &tlsKeyFilePath)
ClientConfiguration & setConcurrentLookupRequest(int concurrentLookupRequest)
unsigned int getPartitionsUpdateInterval() const
ClientConfiguration & setTlsAllowInsecureConnection(bool allowInsecure)
uint64_t getMemoryLimit() const
int getConcurrentLookupRequest() const
ClientConfiguration & setMaxLookupRedirects(int maxLookupRedirects)
ClientConfiguration & setOperationTimeoutSeconds(int timeout)
ClientConfiguration & setListenerName(const std::string &listenerName)
ClientConfiguration & setMemoryLimit(uint64_t memoryLimitBytes)
ClientConfiguration & setUseTls(bool useTls)
ClientConfiguration & setInitialBackoffIntervalMs(int initialBackoffIntervalMs)
Definition Logger.h:58
Definition Authentication.h:31