pulsar-client-cpp
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
pulsar::ClientConfiguration Class Reference

Public Member Functions

 ClientConfiguration (const ClientConfiguration &)
 
ClientConfigurationoperator= (const ClientConfiguration &)
 
ClientConfigurationsetMemoryLimit (uint64_t memoryLimitBytes)
 
uint64_t getMemoryLimit () const
 
ClientConfigurationsetConnectionsPerBroker (int connectionsPerBroker)
 
int getConnectionsPerBroker () const
 
ClientConfigurationsetAuth (const AuthenticationPtr &authentication)
 
AuthenticationgetAuth () const
 
ClientConfigurationsetOperationTimeoutSeconds (int timeout)
 
int getOperationTimeoutSeconds () const
 
ClientConfigurationsetIOThreads (int threads)
 
int getIOThreads () const
 
ClientConfigurationsetMessageListenerThreads (int threads)
 
int getMessageListenerThreads () const
 
ClientConfigurationsetConcurrentLookupRequest (int concurrentLookupRequest)
 
int getConcurrentLookupRequest () const
 
ClientConfigurationsetMaxLookupRedirects (int maxLookupRedirects)
 
int getMaxLookupRedirects () const
 
ClientConfigurationsetInitialBackoffIntervalMs (int initialBackoffIntervalMs)
 
int getInitialBackoffIntervalMs () const
 
ClientConfigurationsetMaxBackoffIntervalMs (int maxBackoffIntervalMs)
 
int getMaxBackoffIntervalMs () const
 
ClientConfigurationsetLogger (LoggerFactory *loggerFactory)
 
ClientConfigurationsetUseTls (bool useTls)
 
bool isUseTls () const
 
ClientConfigurationsetTlsPrivateKeyFilePath (const std::string &tlsKeyFilePath)
 
const std::string & getTlsPrivateKeyFilePath () const
 
ClientConfigurationsetTlsCertificateFilePath (const std::string &tlsCertificateFilePath)
 
const std::string & getTlsCertificateFilePath () const
 
ClientConfigurationsetTlsTrustCertsFilePath (const std::string &tlsTrustCertsFilePath)
 
const std::string & getTlsTrustCertsFilePath () const
 
ClientConfigurationsetTlsAllowInsecureConnection (bool allowInsecure)
 
bool isTlsAllowInsecureConnection () const
 
ClientConfigurationsetValidateHostName (bool validateHostName)
 
bool isValidateHostName () const
 
ClientConfigurationsetListenerName (const std::string &listenerName)
 
const std::string & getListenerName () const
 
ClientConfigurationsetStatsIntervalInSeconds (const unsigned int &)
 
const unsigned int & getStatsIntervalInSeconds () const
 
ClientConfigurationsetPartititionsUpdateInterval (unsigned int intervalInSeconds)
 
unsigned int getPartitionsUpdateInterval () const
 
ClientConfigurationsetConnectionTimeout (int timeoutMs)
 
int getConnectionTimeout () const
 

Friends

class ClientImpl
 
class PulsarWrapper
 

Member Function Documentation

◆ getAuth()

Authentication & pulsar::ClientConfiguration::getAuth ( ) const
Returns
the authentication data

◆ getConcurrentLookupRequest()

int pulsar::ClientConfiguration::getConcurrentLookupRequest ( ) const
Returns
Get configured total allowed concurrent lookup-request.

◆ getConnectionsPerBroker()

int pulsar::ClientConfiguration::getConnectionsPerBroker ( ) const
Returns
the max number of connection that the client library will open to a single broker

◆ getConnectionTimeout()

int pulsar::ClientConfiguration::getConnectionTimeout ( ) const

The getter associated with setConnectionTimeout().

◆ getInitialBackoffIntervalMs()

int pulsar::ClientConfiguration::getInitialBackoffIntervalMs ( ) const
Returns
Get initial backoff interval in milliseconds.

◆ getIOThreads()

int pulsar::ClientConfiguration::getIOThreads ( ) const
Returns
the number of IO threads to use

◆ getListenerName()

const std::string & pulsar::ClientConfiguration::getListenerName ( ) const
Returns
the listener name for the broker

◆ getMaxBackoffIntervalMs()

int pulsar::ClientConfiguration::getMaxBackoffIntervalMs ( ) const
Returns
Get max backoff interval in milliseconds.

◆ getMaxLookupRedirects()

int pulsar::ClientConfiguration::getMaxLookupRedirects ( ) const
Returns
Get configured total allowed lookup redirecting.

◆ getMemoryLimit()

uint64_t pulsar::ClientConfiguration::getMemoryLimit ( ) const
Returns
the client memory limit in bytes

◆ getMessageListenerThreads()

int pulsar::ClientConfiguration::getMessageListenerThreads ( ) const
Returns
the number of IO threads to use

◆ getOperationTimeoutSeconds()

int pulsar::ClientConfiguration::getOperationTimeoutSeconds ( ) const
Returns
the client operations timeout in seconds

◆ getPartitionsUpdateInterval()

unsigned int pulsar::ClientConfiguration::getPartitionsUpdateInterval ( ) const

Get partitions update interval in seconds.

◆ getStatsIntervalInSeconds()

const unsigned int & pulsar::ClientConfiguration::getStatsIntervalInSeconds ( ) const
Returns
the stats interval configured for the client

◆ getTlsCertificateFilePath()

const std::string & pulsar::ClientConfiguration::getTlsCertificateFilePath ( ) const
Returns
the path to the TLS certificate file

◆ getTlsPrivateKeyFilePath()

const std::string & pulsar::ClientConfiguration::getTlsPrivateKeyFilePath ( ) const
Returns
the path to the TLS private key file

◆ getTlsTrustCertsFilePath()

const std::string & pulsar::ClientConfiguration::getTlsTrustCertsFilePath ( ) const
Returns
the path to the trusted TLS certificate file

◆ isTlsAllowInsecureConnection()

bool pulsar::ClientConfiguration::isTlsAllowInsecureConnection ( ) const
Returns
whether the Pulsar client accepts untrusted TLS certificates from brokers

◆ isUseTls()

bool pulsar::ClientConfiguration::isUseTls ( ) const
Returns
whether the TLS encryption is used on the connections

◆ isValidateHostName()

bool pulsar::ClientConfiguration::isValidateHostName ( ) const
Returns
true if the TLS hostname verification is enabled

◆ setAuth()

ClientConfiguration & pulsar::ClientConfiguration::setAuth ( const AuthenticationPtr &  authentication)

Set the authentication method to be used with the broker

Parameters
authenticationthe authentication data to use

◆ setConcurrentLookupRequest()

ClientConfiguration & pulsar::ClientConfiguration::setConcurrentLookupRequest ( int  concurrentLookupRequest)

Number of concurrent lookup-requests allowed on each broker-connection to prevent overload on broker. (default: 50000) It should be configured with higher value only in case of it requires to produce/subscribe on thousands of topic using created PulsarClient

Parameters
concurrentLookupRequest

◆ setConnectionsPerBroker()

ClientConfiguration & pulsar::ClientConfiguration::setConnectionsPerBroker ( int  connectionsPerBroker)

Sets the max number of connection that the client library will open to a single broker. By default, the connection pool will use a single connection for all the producers and consumers. Increasing this parameter may improve throughput when using many producers over a high latency connection.

Parameters
connectionsPerBrokermax number of connections per broker (needs to be greater than 0)

◆ setConnectionTimeout()

ClientConfiguration & pulsar::ClientConfiguration::setConnectionTimeout ( int  timeoutMs)

Set the duration of time to wait for a connection to a broker to be established. If the duration passes without a response from the broker, the connection attempt is dropped.

Default: 10000

Parameters
timeoutMsthe duration in milliseconds
Returns

◆ setInitialBackoffIntervalMs()

ClientConfiguration & pulsar::ClientConfiguration::setInitialBackoffIntervalMs ( int  initialBackoffIntervalMs)

Initial backoff interval in milliseconds. (default: 100)

Parameters
initialBackoffIntervalMs

◆ setIOThreads()

ClientConfiguration & pulsar::ClientConfiguration::setIOThreads ( int  threads)

Set the number of IO threads to be used by the Pulsar client. Default is 1 thread.

Parameters
threadsnumber of threads

◆ setListenerName()

ClientConfiguration & pulsar::ClientConfiguration::setListenerName ( const std::string &  listenerName)

Configure the listener name that the broker returns the corresponding advertisedListener.

Parameters
namethe listener name

◆ setLogger()

ClientConfiguration & pulsar::ClientConfiguration::setLogger ( LoggerFactory loggerFactory)

Configure a custom logger backend to route of Pulsar client library to a different logger implementation.

By default, log messages are printed on standard output.

When passed in, the configuration takes ownership of the loggerFactory object. The logger factory can only be set once per process. Any subsequent calls to set the logger factory will have no effect, though the logger factory object will be cleaned up.

◆ setMaxBackoffIntervalMs()

ClientConfiguration & pulsar::ClientConfiguration::setMaxBackoffIntervalMs ( int  maxBackoffIntervalMs)

Max backoff interval in milliseconds. (default: 60000)

Parameters
maxBackoffIntervalMs

◆ setMaxLookupRedirects()

ClientConfiguration & pulsar::ClientConfiguration::setMaxLookupRedirects ( int  maxLookupRedirects)

Max number of lookup redirection allowed on each look request to prevent overload on broker. (default: 20)

Parameters
maxLookupRedirects

◆ setMemoryLimit()

ClientConfiguration & pulsar::ClientConfiguration::setMemoryLimit ( uint64_t  memoryLimitBytes)

Configure a limit on the amount of memory that will be allocated by this client instance. Setting this to 0 will disable the limit. By default this is disabled.

Parameters
memoryLimitBytesthe memory limit

◆ setMessageListenerThreads()

ClientConfiguration & pulsar::ClientConfiguration::setMessageListenerThreads ( int  threads)

Set the number of threads to be used by the Pulsar client when delivering messages through message listener. Default is 1 thread per Pulsar client.

If using more than 1 thread, messages for distinct MessageListener will be delivered in different threads, however a single MessageListener will always be assigned to the same thread.

Parameters
threadsnumber of threads

◆ setOperationTimeoutSeconds()

ClientConfiguration & pulsar::ClientConfiguration::setOperationTimeoutSeconds ( int  timeout)

Set timeout on client operations (subscribe, create producer, close, unsubscribe) Default is 30 seconds.

Parameters
timeoutthe timeout after which the operation will be considered as failed

◆ setPartititionsUpdateInterval()

ClientConfiguration & pulsar::ClientConfiguration::setPartititionsUpdateInterval ( unsigned int  intervalInSeconds)

Set partitions update interval in seconds. If a partitioned topic is produced or subscribed and intervalInSeconds is not 0, every intervalInSeconds seconds the partition number will be retrieved by sending lookup requests. If partition number has been increased, more producer/consumer of increased partitions will be created. Default is 60 seconds.

Parameters
intervalInSecondsthe seconds between two lookup request for partitioned topic's metadata

◆ setStatsIntervalInSeconds()

ClientConfiguration & pulsar::ClientConfiguration::setStatsIntervalInSeconds ( const unsigned int &  )

Initialize stats interval in seconds. Stats are printed and reset after every statsIntervalInSeconds.

Default: 600

Set to 0 means disabling stats collection.

◆ setTlsAllowInsecureConnection()

ClientConfiguration & pulsar::ClientConfiguration::setTlsAllowInsecureConnection ( bool  allowInsecure)

Configure whether the Pulsar client accepts untrusted TLS certificates from brokers.

The default value is false.

Parameters
tlsAllowInsecureConnection

◆ setTlsCertificateFilePath()

ClientConfiguration & pulsar::ClientConfiguration::setTlsCertificateFilePath ( const std::string &  tlsCertificateFilePath)

Set the path to the TLS certificate file.

Parameters
tlsCertificateFilePath

◆ setTlsPrivateKeyFilePath()

ClientConfiguration & pulsar::ClientConfiguration::setTlsPrivateKeyFilePath ( const std::string &  tlsKeyFilePath)

Set the path to the TLS private key file.

Parameters
tlsPrivateKeyFilePath

◆ setTlsTrustCertsFilePath()

ClientConfiguration & pulsar::ClientConfiguration::setTlsTrustCertsFilePath ( const std::string &  tlsTrustCertsFilePath)

Set the path to the trusted TLS certificate file.

Parameters
tlsTrustCertsFilePath

◆ setUseTls()

ClientConfiguration & pulsar::ClientConfiguration::setUseTls ( bool  useTls)

Configure whether to use the TLS encryption on the connections.

The default value is false.

Parameters
useTls

◆ setValidateHostName()

ClientConfiguration & pulsar::ClientConfiguration::setValidateHostName ( bool  validateHostName)

Configure whether it allows validating hostname verification when a client connects to a broker over TLS.

It validates the incoming x509 certificate and matches the provided hostname (CN/SAN) with the expected broker's hostname. It follows the server identity hostname verification in RFC 2818.

The default value is false.

See also
RFC 2818.
Parameters
validateHostNamewhether to enable the TLS hostname verification

The documentation for this class was generated from the following file: