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
57 ClientConfiguration& setConnectionsPerBroker(int connectionsPerBroker);
58
63
69 ClientConfiguration& setAuth(const AuthenticationPtr& authentication);
70
75
83
88
96
100 int getIOThreads() const;
101
113
118
127 ClientConfiguration& setConcurrentLookupRequest(int concurrentLookupRequest);
128
133
141
146
153 ClientConfiguration& setInitialBackoffIntervalMs(int initialBackoffIntervalMs);
154
159
167
172
185
194
198 bool isUseTls() const;
199
205 ClientConfiguration& setTlsPrivateKeyFilePath(const std::string& tlsKeyFilePath);
206
210 const std::string& getTlsPrivateKeyFilePath() const;
211
217 ClientConfiguration& setTlsCertificateFilePath(const std::string& tlsCertificateFilePath);
218
222 const std::string& getTlsCertificateFilePath() const;
223
229 ClientConfiguration& setTlsTrustCertsFilePath(const std::string& tlsTrustCertsFilePath);
230
234 const std::string& getTlsTrustCertsFilePath() const;
235
244
249
264
268 bool isValidateHostName() const;
269
275 ClientConfiguration& setListenerName(const std::string& listenerName);
276
280 const std::string& getListenerName() const;
281
290
294 const unsigned int& getStatsIntervalInSeconds() const;
295
305 ClientConfiguration& setPartititionsUpdateInterval(unsigned int intervalInSeconds);
306
310 unsigned int getPartitionsUpdateInterval() const;
311
322
327
328 friend class ClientImpl;
329 friend class PulsarWrapper;
330
331 private:
332 const AuthenticationPtr& getAuthPtr() const;
333 std::shared_ptr<ClientConfigurationImpl> impl_;
334
335 // By default, when the client connects to the broker, a version string like "Pulsar-CPP-v<x.y.z>" will be
336 // carried and saved by the broker. The client version string could be queried from the topic stats.
337 //
338 // This method provides a way to add more description to a specific `Client` instance. If it's configured,
339 // the description will be appended to the original client version string, with '-' as the separator.
340 //
341 // For example, if the client version is 3.2.0, and the description is "forked", the final client version
342 // string will be "Pulsar-CPP-v3.2.0-forked".
343 //
344 // NOTE: This method should only be called by the PulsarWrapper and the length should not exceed 64.
345 //
346 // For example, you can add a PulsarWrapper class like:
347 //
348 // ```c++
349 // namespace pulsar {
350 // class PulsarWrapper {
351 // static ClientConfiguration clientConfig() {
352 // ClientConfiguration conf;
353 // conf.setDescription("forked");
354 // return conf;
355 // }
356 // };
357 // }
358 // ```
359 //
360 // Then, call the method before passing the `conf` to the constructor of `Client`:
361 //
362 // ```c++
363 // auto conf = PulsarWrapper::clientConfig();
364 // // Set other attributes of `conf` here...
365 // Client client{"pulsar://localhost:6650", conf);
366 // ```
367 ClientConfiguration& setDescription(const std::string& description);
368
369 const std::string& getDescription() const noexcept;
370};
371} // namespace pulsar
372
373#endif /* PULSAR_CLIENTCONFIGURATION_H_ */
Definition Authentication.h:88
Definition ClientConfiguration.h:29
int getConnectionsPerBroker() const
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
ClientConfiguration & setConnectionsPerBroker(int connectionsPerBroker)
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