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

hazelcast_client configuration class. More...

#include <client_config.h>

Public Member Functions

 client_config ()
 Constructor with default values. More...
 
 client_config (const client_config &rhs)=delete
 
client_configoperator= (const client_config &rhs)=delete
 
 client_config (client_config &&rhs)
 
client_configoperator= (client_config &&rhs)
 
const std::string & get_cluster_name () const
 Returns the configured cluster name. More...
 
client_configset_cluster_name (const std::string &cluster_name)
 
client_configset_credentials (const std::shared_ptr< security::credentials > &credential)
 There are two types of credentials you can provide, and . More...
 
const std::shared_ptr< security::credentials > & get_credentials () const
 
client_configset_redo_operation (bool redo_operation)
 If true, client will redo the operations that were executing on the server and client lost the connection. More...
 
bool is_redo_operation () const
 see setRedoOperation returns redoOperation
 
client_configset_socket_interceptor (socket_interceptor &&interceptor)
 Will be called with the Socket, each time client creates a connection to any Member. More...
 
const socket_interceptorget_socket_interceptor () const
 Will be called with the Socket, each time client creates a connection to any Member.
 
client_configadd_listener (lifecycle_listener &&listener)
 Adds a listener to configuration to be registered when hazelcast_client starts. More...
 
const std::vector< lifecycle_listener > & get_lifecycle_listeners () const
 
client_configadd_listener (membership_listener &&listener)
 Adds a listener to configuration to be registered when hazelcast_client starts. More...
 
const std::vector< membership_listener > & get_membership_listeners () const
 Returns registered membershipListeners. More...
 
load_balancerget_load_balancer ()
 Used to distribute the operations to multiple Endpoints. More...
 
client_configset_load_balancer (load_balancer &&load_balancer)
 Used to distribute the operations to multiple connections. More...
 
serialization_configget_serialization_config ()
 
client_configset_serialization_config (serialization_config const &serialization_config)
 SerializationConfig is used to. More...
 
const std::unordered_map< std::string, std::string > & get_properties () const
 Gets a reference to properties map. More...
 
client_configset_property (const std::string &name, const std::string &value)
 Sets the value of a named property. More...
 
client_configadd_reliable_topic_config (const config::reliable_topic_config &reliable_topic_config)
 Adds a ClientReliableTopicConfig. More...
 
const config::reliable_topic_configget_reliable_topic_config (const std::string &name)
 Gets the ClientReliableTopicConfig for a given reliable topic name. More...
 
client_configadd_near_cache_config (const config::near_cache_config &near_cache_config)
 Helper method to add a new NearCacheConfig. More...
 
const config::near_cache_configget_near_cache_config (const std::string &name) const
 Gets the NearCacheConfig configured for the map / cache with name. More...
 
config::client_network_configget_network_config ()
 Gets {}. More...
 
client_configset_network_config (const config::client_network_config &network_config)
 Sets {}. More...
 
const boost::optional< std::string > & get_instance_name () const
 
client_configset_instance_name (const std::string &instance_name)
 
int32_t get_executor_pool_size () const
 Pool size for internal ExecutorService which handles responses etc. More...
 
void set_executor_pool_size (int32_t executor_pool_size)
 Sets Client side Executor pool size. More...
 
config::client_connection_strategy_configget_connection_strategy_config ()
 
client_configset_connection_strategy_config (const config::client_connection_strategy_config &connection_strategy_config)
 
const config::client_flake_id_generator_configfind_flake_id_generator_config (const std::string &name)
 Returns a {} configuration for the given flake ID generator name. More...
 
const config::client_flake_id_generator_configget_flake_id_generator_config (const std::string &name)
 Returns the {} for the given name, creating one if necessary and adding it to the collection of known configurations. More...
 
client_configadd_flake_id_generator_config (const config::client_flake_id_generator_config &config)
 Adds a flake ID generator configuration. More...
 
config::logger_configget_logger_config ()
 
const std::unordered_set< std::string > & get_labels () const
 
client_configset_labels (const std::unordered_set< std::string > &labels)
 
client_configadd_label (const std::string &label)
 
client_configbackup_acks_enabled (bool enabled)
 This feature reduces number of hops and increase performance for smart clients. More...
 
bool backup_acks_enabled ()
 Note that backup acks to client can be enabled only for smart client. More...
 

Friends

class connection::ClientConnectionManagerImpl
 

Detailed Description

hazelcast_client configuration class.

Constructor & Destructor Documentation

◆ client_config()

hazelcast::client::client_config::client_config ( )

Constructor with default values.

smart(true) redoOperation(false) connectionAttemptLimit(2) attemptPeriod(3000) defaultLoadBalancer: round robin load balancer

Member Function Documentation

◆ add_flake_id_generator_config()

client_config & hazelcast::client::client_config::add_flake_id_generator_config ( const config::client_flake_id_generator_config 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

◆ add_listener() [1/2]

client_config & hazelcast::client::client_config::add_listener ( lifecycle_listener &&  listener)

Adds a listener to configuration to be registered when hazelcast_client 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
listenerlifecycle_listener
Returns
itself ClientConfig

◆ add_listener() [2/2]

client_config & hazelcast::client::client_config::add_listener ( membership_listener &&  listener)

Adds a listener to configuration to be registered when hazelcast_client 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
Returns
itself ClientConfig

◆ add_near_cache_config()

client_config & hazelcast::client::client_config::add_near_cache_config ( const config::near_cache_config near_cache_config)

Helper method to add a new NearCacheConfig.

Parameters
nearCacheConfigNearCacheConfig to be added
Returns
configured client_config for chaining
See also
NearCacheConfig

Memory ownership of the config is passed to the client config

◆ add_reliable_topic_config()

client_config & hazelcast::client::client_config::add_reliable_topic_config ( const config::reliable_topic_config reliable_topic_config)

Adds a ClientReliableTopicConfig.

Parameters
reliableTopicConfigthe ReliableTopicConfig to add
Returns
configured {} for chaining

◆ backup_acks_enabled() [1/2]

client_config & hazelcast::client::client_config::backup_acks_enabled ( bool  enabled)

This feature reduces number of hops and increase performance for smart clients.

It is enabled by default for smart clients. This config has no effect for unisocket clients.

Parameters
enabledenables client to get backup acknowledgements directly from the member that backups are applied
Returns
configured for chaining

◆ backup_acks_enabled() [2/2]

bool hazelcast::client::client_config::backup_acks_enabled ( )

Note that backup acks to client can be enabled only for smart client.

This config has no effect for unisocket clients.

Returns
true if backup acknowledgements comes to client

◆ find_flake_id_generator_config()

const config::client_flake_id_generator_config * hazelcast::client::client_config::find_flake_id_generator_config ( const std::string &  name)

Returns a {} 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()

◆ get_cluster_name()

const std::string & hazelcast::client::client_config::get_cluster_name ( ) const

Returns the configured cluster name.

The name is sent as part of client authentication message and may be verified on the member.

Returns
the configured cluster name

◆ get_executor_pool_size()

int32_t hazelcast::client::client_config::get_executor_pool_size ( ) const

Pool size for internal ExecutorService which handles responses etc.

Returns
int Executor pool size.

◆ get_flake_id_generator_config()

const config::client_flake_id_generator_config * hazelcast::client::client_config::get_flake_id_generator_config ( const std::string &  name)

Returns the {} 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 {}. 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)

◆ get_lifecycle_listeners()

const std::vector< lifecycle_listener > & hazelcast::client::client_config::get_lifecycle_listeners ( ) const
Returns
registered lifecycleListeners

◆ get_load_balancer()

load_balancer & hazelcast::client::client_config::get_load_balancer ( )

Used to distribute the operations to multiple Endpoints.

Returns
load_balancer

◆ get_logger_config()

config::logger_config & hazelcast::client::client_config::get_logger_config ( )
Returns
The logger configuration.

◆ get_membership_listeners()

const std::vector< membership_listener > & hazelcast::client::client_config::get_membership_listeners ( ) const

Returns registered membershipListeners.

Returns
registered membershipListeners

◆ get_near_cache_config()

const config::near_cache_config * hazelcast::client::client_config::get_near_cache_config ( const std::string &  name) const

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

Parameters
namename of the map / cache
Returns
Configured NearCacheConfig
See also
NearCacheConfig

◆ get_network_config()

config::client_network_config & hazelcast::client::client_config::get_network_config ( )

◆ get_properties()

const std::unordered_map< std::string, std::string > & hazelcast::client::client_config::get_properties ( ) const

Gets a reference to properties map.

Returns
properties map

◆ get_reliable_topic_config()

const config::reliable_topic_config & hazelcast::client::client_config::get_reliable_topic_config ( 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.

◆ get_serialization_config()

serialization_config & hazelcast::client::client_config::get_serialization_config ( )
Returns
serializationConfig

◆ set_credentials()

client_config & hazelcast::client::client_config::set_credentials ( const std::shared_ptr< security::credentials > &  credential)

There are two types of credentials you can provide, and .

Returns
itself ClientConfig

◆ set_executor_pool_size()

void hazelcast::client::client_config::set_executor_pool_size ( int32_t  executor_pool_size)

Sets Client side Executor pool size.

Parameters
executorPoolSizepool size
Returns
configured client_config for chaining

◆ set_load_balancer()

client_config & hazelcast::client::client_config::set_load_balancer ( load_balancer &&  load_balancer)

Used to distribute the operations to multiple connections.

If not set, round robin based load balancer is used

Parameters
load_balancer
Returns
itself ClientConfig

◆ set_network_config()

client_config & hazelcast::client::client_config::set_network_config ( const config::client_network_config network_config)

◆ set_property()

client_config & hazelcast::client::client_config::set_property ( const std::string &  name,
const std::string &  value 
)

Sets the value of a named property.

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

◆ set_redo_operation()

client_config & hazelcast::client::client_config::set_redo_operation ( bool  redo_operation)

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 io_exception.

Parameters
redoOperationreturn itself ClientConfig

◆ set_serialization_config()

client_config & hazelcast::client::client_config::set_serialization_config ( serialization_config const &  serialization_config)

SerializationConfig is used to.

  • set version of portable classes in this client (
    See also
    versioned_portable_serializer)
    Parameters
    serializationConfig
    Returns
    itself ClientConfig

◆ set_socket_interceptor()

client_config & hazelcast::client::client_config::set_socket_interceptor ( socket_interceptor &&  interceptor)

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: