Hazelcast C++ Client
Public Member Functions | Friends | List of all members
hazelcast::client::ClientConfig Class Reference

HazelcastClient configuration class. More...

#include <ClientConfig.h>

Public Member Functions

 ClientConfig ()
 Constructor with default values. More...
 
ClientConfigaddAddress (const Address &address)
 
ClientConfigaddAddresses (const std::vector< Address > &addresses)
 
std::set< AddressgetAddresses ()
 
ClientConfigsetGroupConfig (const GroupConfig &groupConfig)
 The Group Configuration properties like: Name and Password that is used to connect to the cluster. More...
 
GroupConfiggetGroupConfig ()
 
ClientConfigsetCredentials (Credentials *credentials)
 Can be used instead of GroupConfig in Hazelcast Extensions. More...
 
const CredentialsgetCredentials ()
 Can be used instead of GroupConfig in Hazelcast Extensions.
 
ClientConfigsetConnectionAttemptLimit (int connectionAttemptLimit)
 
int getConnectionAttemptLimit () const
 
ClientConfigsetConnectionTimeout (int connectionTimeoutInMillis)
 Use ClientNetworkConfig#setConnectionTimeout instead .
 
int getConnectionTimeout () const
 Use ClientNetworkConfig#getConnectionTimeout instead .
 
ClientConfigsetAttemptPeriod (int attemptPeriodInMillis)
 
int getAttemptPeriod () const
 
ClientConfigsetRedoOperation (bool redoOperation)
 If true, client will redo the operations that were executing on the server and client lost the connection. More...
 
bool isRedoOperation () const
 see setRedoOperation returns redoOperation
 
bool isSmart () const
 
ClientConfigsetSmart (bool smart)
 
ClientConfigsetSocketInterceptor (SocketInterceptor *socketInterceptor)
 Will be called with the Socket, each time client creates a connection to any Member. More...
 
SocketInterceptorgetSocketInterceptor ()
 Will be called with the Socket, each time client creates a connection to any Member.
 
ClientConfigaddListener (LifecycleListener *listener)
 Adds a listener to configuration to be registered when HazelcastClient starts. More...
 
const std::set< LifecycleListener * > & getLifecycleListeners () const
 
ClientConfigaddListener (MembershipListener *listener)
 
ClientConfigaddListener (const boost::shared_ptr< MembershipListener > &listener)
 Adds a listener to configuration to be registered when HazelcastClient starts. More...
 
const std::set< MembershipListener * > & getMembershipListeners () const
 Returns registered membershipListeners. More...
 
const std::set< boost::shared_ptr< MembershipListener > > & getManagedMembershipListeners () const
 Returns registered membershipListeners. More...
 
ClientConfigaddListener (InitialMembershipListener *listener)
 
ClientConfigaddListener (const boost::shared_ptr< InitialMembershipListener > &listener)
 Adds a listener to configuration to be registered when HazelcastClient starts. More...
 
LoadBalancer *const getLoadBalancer ()
 Used to distribute the operations to multiple Endpoints. More...
 
ClientConfigsetLoadBalancer (LoadBalancer *loadBalancer)
 Used to distribute the operations to multiple Endpoints. More...
 
ClientConfigsetLogLevel (LogLevel loggerLevel)
 enum LogLevel { SEVERE, WARNING, INFO, FINEST }; set INFO to see every log. More...
 
SerializationConfiggetSerializationConfig ()
 
ClientConfigsetSerializationConfig (SerializationConfig const &serializationConfig)
 SerializationConfig is used to. More...
 
std::map< std::string, std::string > & getProperties ()
 Gets a reference to properties map. More...
 
ClientConfigsetProperty (const std::string &name, const std::string &value)
 Sets the value of a named property. More...
 
ClientConfigaddReliableTopicConfig (const config::ReliableTopicConfig &reliableTopicConfig)
 Adds a ClientReliableTopicConfig. More...
 
const config::ReliableTopicConfiggetReliableTopicConfig (const std::string &name)
 Gets the ClientReliableTopicConfig for a given reliable topic name. More...
 
template<typename K , typename V >
ClientConfigaddNearCacheConfig (const boost::shared_ptr< config::NearCacheConfig< K, V > > nearCacheConfig)
 Helper method to add a new NearCacheConfig. More...
 
ClientConfigaddMixedNearCacheConfig (const boost::shared_ptr< mixedtype::config::MixedNearCacheConfig > nearCacheConfig)
 Helper method to add a new NearCacheConfig. More...
 
template<typename K , typename V >
const boost::shared_ptr< config::NearCacheConfig< K, V > > getNearCacheConfig (const std::string &name)
 Gets the NearCacheConfig configured for the map / cache with name. More...
 
const boost::shared_ptr< mixedtype::config::MixedNearCacheConfiggetMixedNearCacheConfig (const std::string &name)
 
config::ClientNetworkConfiggetNetworkConfig ()
 Gets com.hazelcast.client.config.ClientNetworkConfig. More...
 
ClientConfigsetNetworkConfig (const config::ClientNetworkConfig &networkConfig)
 Sets com.hazelcast.client.config.ClientNetworkConfig. More...
 
const boost::shared_ptr< std::string > & getInstanceName () const
 
void setInstanceName (const boost::shared_ptr< std::string > &instanceName)
 
int32_t getExecutorPoolSize () const
 Pool size for internal ExecutorService which handles responses etc. More...
 
void setExecutorPoolSize (int32_t executorPoolSize)
 Sets Client side Executor pool size. More...
 
config::ClientConnectionStrategyConfiggetConnectionStrategyConfig ()
 
ClientConfigsetConnectionStrategyConfig (const config::ClientConnectionStrategyConfig &connectionStrategyConfig)
 
boost::shared_ptr< config::ClientFlakeIdGeneratorConfigfindFlakeIdGeneratorConfig (const std::string &name)
 Returns a ClientFlakeIdGeneratorConfig configuration for the given flake ID generator name. More...
 
boost::shared_ptr< config::ClientFlakeIdGeneratorConfiggetFlakeIdGeneratorConfig (const std::string &name)
 Returns the ClientFlakeIdGeneratorConfig for the given name, creating one if necessary and adding it to the collection of known configurations. More...
 
ClientConfigaddFlakeIdGeneratorConfig (const boost::shared_ptr< config::ClientFlakeIdGeneratorConfig > &config)
 Adds a flake ID generator configuration. More...
 
config::LoggerConfiggetLoggerConfig ()
 

Friends

class spi::impl::ClientClusterServiceImpl
 

Detailed Description

HazelcastClient configuration class.

Constructor & Destructor Documentation

◆ ClientConfig()

hazelcast::client::ClientConfig::ClientConfig ( )

Constructor with default values.

smart(true) redoOperation(false) connectionAttemptLimit(2) attemptPeriod(3000) defaultLoadBalancer(impl::RoundRobinLB)

Member Function Documentation

◆ addAddress()

ClientConfig & hazelcast::client::ClientConfig::addAddress ( const Address address)
Deprecated:
Please use ClientNetworkConfig#addAddress(const Address &).

Adds an address to list of the initial addresses. Client will use this list to find a running Member, connect to it.

Parameters
address
Returns
itself ClientConfig

◆ addAddresses()

ClientConfig & hazelcast::client::ClientConfig::addAddresses ( const std::vector< Address > &  addresses)
Deprecated:
Please use ClientNetworkConfig#addAddresses(const std::vector<Address> &).

Adds all address in given vector to list of the initial addresses. Client will use this list to find a running Member, connect to it.

Parameters
addressesvector of addresses
Returns
itself ClientConfig

◆ addFlakeIdGeneratorConfig()

ClientConfig & hazelcast::client::ClientConfig::addFlakeIdGeneratorConfig ( const boost::shared_ptr< config::ClientFlakeIdGeneratorConfig > &  config)

Adds a flake ID generator configuration.

The configuration is saved under the config name, which may be a pattern with which the configuration will be obtained in the future.

Parameters
configthe flake ID configuration
Returns
this config instance

◆ addListener() [1/5]

ClientConfig & hazelcast::client::ClientConfig::addListener ( LifecycleListener listener)

Adds a listener to configuration to be registered when HazelcastClient starts.

Warning 1: If listener should do a time consuming operation, off-load the operation to another thread. otherwise it will slow down the system.

Warning 2: Do not make a call to hazelcast. It can cause deadlock.

Parameters
listenerLifecycleListener *listener
Returns
itself ClientConfig

◆ addListener() [2/5]

ClientConfig & hazelcast::client::ClientConfig::addListener ( MembershipListener listener)
Deprecated:
Please use addListener(const boost::shared_ptr<MembershipListener> &listener) instead.

Adds a listener to configuration to be registered when HazelcastClient starts. Warning 1: If listener should do a time consuming operation, off-load the operation to another thread. otherwise it will slow down the system.

Warning 2: Do not make a call to hazelcast. It can cause deadlock.

Parameters
listenerMembershipListener *listener
Returns
itself ClientConfig

◆ addListener() [3/5]

ClientConfig & hazelcast::client::ClientConfig::addListener ( const boost::shared_ptr< MembershipListener > &  listener)

Adds a listener to configuration to be registered when HazelcastClient starts.

Warning 1: If listener should do a time consuming operation, off-load the operation to another thread. otherwise it will slow down the system.

Warning 2: Do not make a call to hazelcast. It can cause deadlock.

Parameters
listenerMembershipListener *listener
Returns
itself ClientConfig

◆ addListener() [4/5]

ClientConfig & hazelcast::client::ClientConfig::addListener ( InitialMembershipListener listener)
Deprecated:
Please use addListener(const boost::shared_ptr<InitialMembershipListener> &listener)

Adds a listener to configuration to be registered when HazelcastClient starts.

Parameters
listenerInitialMembershipListener *listener
Returns
itself ClientConfig

◆ addListener() [5/5]

ClientConfig & hazelcast::client::ClientConfig::addListener ( const boost::shared_ptr< InitialMembershipListener > &  listener)

Adds a listener to configuration to be registered when HazelcastClient starts.

Parameters
listenerInitialMembershipListener *listener
Returns
itself ClientConfig

◆ addMixedNearCacheConfig()

ClientConfig& hazelcast::client::ClientConfig::addMixedNearCacheConfig ( const boost::shared_ptr< mixedtype::config::MixedNearCacheConfig nearCacheConfig)
inline

Helper method to add a new NearCacheConfig.

Parameters
nearCacheConfigcom.hazelcast.config.NearCacheConfig to be added
Returns
configured com.hazelcast.client.config.ClientConfig for chaining
See also
com.hazelcast.config.NearCacheConfig

Memory ownership of the config is passed to the client config

◆ addNearCacheConfig()

template<typename K , typename V >
ClientConfig& hazelcast::client::ClientConfig::addNearCacheConfig ( const boost::shared_ptr< config::NearCacheConfig< K, V > >  nearCacheConfig)
inline

Helper method to add a new NearCacheConfig.

Parameters
nearCacheConfigcom.hazelcast.config.NearCacheConfig to be added
Returns
configured com.hazelcast.client.config.ClientConfig for chaining
See also
com.hazelcast.config.NearCacheConfig

Memory ownership of the config is passed to the client config

◆ addReliableTopicConfig()

ClientConfig & hazelcast::client::ClientConfig::addReliableTopicConfig ( const config::ReliableTopicConfig reliableTopicConfig)

Adds a ClientReliableTopicConfig.

Parameters
reliableTopicConfigthe ReliableTopicConfig to add
Returns
configured ClientConfig for chaining

◆ findFlakeIdGeneratorConfig()

boost::shared_ptr< config::ClientFlakeIdGeneratorConfig > hazelcast::client::ClientConfig::findFlakeIdGeneratorConfig ( const std::string &  name)

Returns a ClientFlakeIdGeneratorConfig configuration for the given flake ID generator name.

The name is matched by pattern to the configuration and by stripping the partition ID qualifier from the given

name

. If there is no config found by the name, it will return the configuration with the name

"default"

.

Parameters
namename of the flake ID generator config
Returns
the flake ID generator configuration
Exceptions
ConfigurationExceptionif ambiguous configurations are found
See also
StringPartitioningStrategy::getBaseName(std::string)
#setConfigPatternMatcher(ConfigPatternMatcher)
#getConfigPatternMatcher()

◆ getAddresses()

std::set< Address > hazelcast::client::ClientConfig::getAddresses ( )
Deprecated:
Please use ClientNetworkConfig#getAddresses().

Returns set of the initial addresses. Client will use this vector to find a running Member, connect to it.

Returns
vector of addresses

◆ getAttemptPeriod()

int hazelcast::client::ClientConfig::getAttemptPeriod ( ) const
Deprecated:
Please use ClientNetworkConfig#getAttemptPeriod()

Period for the next attempt to find a member to connect. (see ClientConfig::connectionAttemptLimit ).

Returns
int attemptPeriodInMillis

◆ getConnectionAttemptLimit()

int hazelcast::client::ClientConfig::getConnectionAttemptLimit ( ) const
Deprecated:
Please use ClientNetworkConfig#getConnectionAttemptLimit()

While client is trying to connect initially to one of the members in the ClientConfig::addressList, all might be not available. Instead of giving up, throwing Exception and stopping client, it will attempt to retry as much as ClientConfig::connectionAttemptLimit times.

return int connectionAttemptLimit

◆ getExecutorPoolSize()

int32_t hazelcast::client::ClientConfig::getExecutorPoolSize ( ) const

Pool size for internal ExecutorService which handles responses etc.

Returns
int Executor pool size.

◆ getFlakeIdGeneratorConfig()

boost::shared_ptr< config::ClientFlakeIdGeneratorConfig > hazelcast::client::ClientConfig::getFlakeIdGeneratorConfig ( const std::string &  name)

Returns the ClientFlakeIdGeneratorConfig for the given name, creating one if necessary and adding it to the collection of known configurations.

The configuration is found by matching the the configuration name pattern to the provided

name

without the partition qualifier (the part of the name after

'@'

). If no configuration matches, it will create one by cloning the

"default"

configuration and add it to the configuration collection.

This method is intended to easily and fluently create and add configurations more specific than the default configuration without explicitly adding it by invoking addFlakeIdGeneratorConfig(ClientFlakeIdGeneratorConfig).

Because it adds new configurations if they are not already present, this method is intended to be used before this config is used to create a hazelcast instance. Afterwards, newly added configurations may be ignored.

Parameters
namename of the flake ID generator config
Returns
the cache configuration
Exceptions
ConfigurationExceptionif ambiguous configurations are found
See also
StringPartitioningStrategy::getBaseName(std::string)

◆ getGroupConfig()

GroupConfig & hazelcast::client::ClientConfig::getGroupConfig ( )
Returns
groupConfig

◆ getLifecycleListeners()

const std::set< LifecycleListener * > & hazelcast::client::ClientConfig::getLifecycleListeners ( ) const
Returns
registered lifecycleListeners

◆ getLoadBalancer()

LoadBalancer *const hazelcast::client::ClientConfig::getLoadBalancer ( )

Used to distribute the operations to multiple Endpoints.

Returns
loadBalancer

◆ getLoggerConfig()

config::LoggerConfig & hazelcast::client::ClientConfig::getLoggerConfig ( )
Returns
The logger configuration.

◆ getManagedMembershipListeners()

const std::set< boost::shared_ptr< MembershipListener > > & hazelcast::client::ClientConfig::getManagedMembershipListeners ( ) const

Returns registered membershipListeners.

Returns
registered membership listeners. This method returns the same list as the getMembershipListeners method but as a set of shared_ptr.

◆ getMembershipListeners()

const std::set< MembershipListener * > & hazelcast::client::ClientConfig::getMembershipListeners ( ) const

Returns registered membershipListeners.

Returns
registered membershipListeners

◆ getNearCacheConfig()

template<typename K , typename V >
const boost::shared_ptr<config::NearCacheConfig<K, V> > hazelcast::client::ClientConfig::getNearCacheConfig ( const std::string &  name)
inline

Gets the NearCacheConfig configured for the map / cache with name.

Parameters
namename of the map / cache
Returns
Configured NearCacheConfig
See also
com.hazelcast.config.NearCacheConfig

◆ getNetworkConfig()

config::ClientNetworkConfig & hazelcast::client::ClientConfig::getNetworkConfig ( )

Gets com.hazelcast.client.config.ClientNetworkConfig.

Returns
com.hazelcast.client.config.ClientNetworkConfig
See also
com.hazelcast.client.config.ClientNetworkConfig

◆ getProperties()

std::map< std::string, std::string > & hazelcast::client::ClientConfig::getProperties ( )

Gets a reference to properties map.

Returns
properties map

◆ getReliableTopicConfig()

const config::ReliableTopicConfig * hazelcast::client::ClientConfig::getReliableTopicConfig ( const std::string &  name)

Gets the ClientReliableTopicConfig for a given reliable topic name.

Parameters
namethe name of the reliable topic
Returns
the found config. If none is found, a default configured one is returned.

◆ getSerializationConfig()

SerializationConfig & hazelcast::client::ClientConfig::getSerializationConfig ( )
Returns
serializationConfig

◆ isSmart()

bool hazelcast::client::ClientConfig::isSmart ( ) const
Deprecated:
Please use ClientNetworkConfig::isSmartRouting
Returns
true if client configured as smart see setSmart()

◆ setAttemptPeriod()

ClientConfig & hazelcast::client::ClientConfig::setAttemptPeriod ( int  attemptPeriodInMillis)
Deprecated:
Please use ClientNetworkConfig#setAttemptPeriod(int32_t)

Period for the next attempt to find a member to connect. (see ClientConfig::connectionAttemptLimit ).

Parameters
attemptPeriodInMillis
Returns
itself ClientConfig

◆ setConnectionAttemptLimit()

ClientConfig & hazelcast::client::ClientConfig::setConnectionAttemptLimit ( int  connectionAttemptLimit)
Deprecated:
Please use ClientNetworkConfig#setConnectionAttemptLimit(int32_t)

While client is trying to connect initially to one of the members in the ClientConfig::addressList, all might be not available. Instead of giving up, throwing Exception and stopping client, it will attempt to retry as much as ClientConfig::connectionAttemptLimit times.

Parameters
connectionAttemptLimit
Returns
itself ClientConfig

◆ setCredentials()

ClientConfig & hazelcast::client::ClientConfig::setCredentials ( Credentials credentials)

Can be used instead of GroupConfig in Hazelcast Extensions.

Returns
itself ClientConfig

◆ setExecutorPoolSize()

void hazelcast::client::ClientConfig::setExecutorPoolSize ( int32_t  executorPoolSize)

Sets Client side Executor pool size.

Parameters
executorPoolSizepool size
Returns
configured com.hazelcast.client.config.ClientConfig for chaining

◆ setGroupConfig()

ClientConfig & hazelcast::client::ClientConfig::setGroupConfig ( const GroupConfig groupConfig)

The Group Configuration properties like: Name and Password that is used to connect to the cluster.

Parameters
groupConfig
Returns
itself ClientConfig

◆ setLoadBalancer()

ClientConfig & hazelcast::client::ClientConfig::setLoadBalancer ( LoadBalancer loadBalancer)

Used to distribute the operations to multiple Endpoints.

If not set, RoundRobin based load balancer is used

Parameters
loadBalancer
Returns
itself ClientConfig

◆ setLogLevel()

ClientConfig & hazelcast::client::ClientConfig::setLogLevel ( LogLevel  loggerLevel)

enum LogLevel { SEVERE, WARNING, INFO, FINEST }; set INFO to see every log.

set WARNING to see only possible warnings and serious errors. set SEVERE to see only serious errors set FINEST to see all messages including debug messages.

Parameters
loggerLevelThe log level to be set.
Returns
The configured client configuration for chaining.

◆ setNetworkConfig()

ClientConfig & hazelcast::client::ClientConfig::setNetworkConfig ( const config::ClientNetworkConfig networkConfig)

Sets com.hazelcast.client.config.ClientNetworkConfig.

Parameters
networkConfigcom.hazelcast.client.config.ClientNetworkConfig to be set
Returns
configured com.hazelcast.client.config.ClientConfig for chaining
See also
com.hazelcast.client.config.ClientNetworkConfig

◆ setProperty()

ClientConfig & hazelcast::client::ClientConfig::setProperty ( const std::string &  name,
const std::string &  value 
)

Sets the value of a named property.

See also
ClientProperties for properties that is used to configure client
Parameters
nameproperty name
valuevalue of the property
Returns
itself ClientConfig

◆ setRedoOperation()

ClientConfig & hazelcast::client::ClientConfig::setRedoOperation ( bool  redoOperation)

If true, client will redo the operations that were executing on the server and client lost the connection.

This can be because of network, or simply because the member died. However it is not clear whether the application is performed or not. For idempotent operations this is harmless, but for non idempotent ones retrying can cause to undesirable effects. Note that the redo can perform on any member.

If false, the operation will throw IOException.

Parameters
redoOperationreturn itself ClientConfig

◆ setSerializationConfig()

ClientConfig & hazelcast::client::ClientConfig::setSerializationConfig ( SerializationConfig const &  serializationConfig)

SerializationConfig is used to.

◆ setSmart()

ClientConfig & hazelcast::client::ClientConfig::setSmart ( bool  smart)
Deprecated:
Please use ClientNetworkConfig::setSmartRouting

If true, client will route the key based operations to owner of the key at the best effort. Note that it uses a cached version of PartitionService::getPartitions() and doesn't guarantee that the operation will always be executed on the owner. The cached table is updated every 10 seconds.

Parameters
smart
Returns
itself ClientConfig

◆ setSocketInterceptor()

ClientConfig & hazelcast::client::ClientConfig::setSocketInterceptor ( SocketInterceptor socketInterceptor)

Will be called with the Socket, each time client creates a connection to any Member.

Returns
itself ClientConfig

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