Hazelcast C++ Client
Hazelcast C++ Client Library
Loading...
Searching...
No Matches
hazelcast::client::config::client_network_config Class Reference

Contains configuration parameters for client network related behaviour. More...

#include <client_network_config.h>

Public Member Functions

 client_network_config ()
 Constructor with default values.
ssl_configget_ssl_config ()
 Returns the current \ssl_config .
client_network_configset_ssl_config (const config::ssl_config &config)
 Sets the ssl_config.
client_network_configset_connection_timeout (const std::chrono::milliseconds &timeout)
std::chrono::milliseconds get_connection_timeout () const
 Connection timeout value for connecting to a member server.
client_network_configset_aws_config (const client_aws_config &client_aws_config)
 Sets configuration to connect nodes in aws environment.
client_aws_configget_aws_config ()
 Returns the current client_aws_config.
cloud_configget_cloud_config ()
 Returns the current cloud_config.
bool is_smart_routing () const
 See client_network_config#setSmartRouting(boolean) for details.
client_network_configset_smart_routing (bool smart_routing)
 If true, client will route the key based operations to owner of the key on best-effort basis.
std::vector< addressget_addresses () const
 Returns the list of candidate addresses that client will use to establish initial connection.
client_network_configadd_addresses (const std::vector< address > &addresses)
 Adds given addresses to candidate address list that client will use to establish initial connection.
client_network_configset_addresses (const std::vector< address > &addresses)
 Adds given addresses to candidate address list that client will use to establish initial connection.
client_network_configadd_address (const address &address)
 Adds given address to candidate address list that client will use to establish initial connection.
socket_optionsget_socket_options ()
bool use_public_address () const
client_network_configuse_public_address (bool should_use_public_address)

Detailed Description

Contains configuration parameters for client network related behaviour.

Definition at line 35 of file client_network_config.h.

Constructor & Destructor Documentation

◆ client_network_config()

hazelcast::client::config::client_network_config::client_network_config ( )

Constructor with default values.

connectionTimeout(5000)

Definition at line 319 of file config.cpp.

320 : connection_timeout_(5000)
321 , smart_routing_(true)
322{}

Member Function Documentation

◆ add_address()

client_network_config & hazelcast::client::config::client_network_config::add_address ( const address & address)

Adds given address to candidate address list that client will use to establish initial connection.

Parameters
addressto be added to initial address list
Returns
configured \client_network_config for chaining

Definition at line 398 of file config.cpp.

399{
400 address_list_.push_back(address);
401 return *this;
402}

◆ add_addresses()

client_network_config & hazelcast::client::config::client_network_config::add_addresses ( const std::vector< address > & addresses)

Adds given addresses to candidate address list that client will use to establish initial connection.

Parameters
addressesto be added to initial address list
Returns
configured \client_network_config for chaining

Definition at line 383 of file config.cpp.

384{
385 address_list_.insert(
386 address_list_.end(), addresses.begin(), addresses.end());
387 return *this;
388}

◆ get_addresses()

std::vector< address > hazelcast::client::config::client_network_config::get_addresses ( ) const

Returns the list of candidate addresses that client will use to establish initial connection.

Returns
list of addresses

Definition at line 377 of file config.cpp.

378{
379 return address_list_;
380}

◆ get_aws_config()

client_aws_config & hazelcast::client::config::client_network_config::get_aws_config ( )

Returns the current client_aws_config.

Returns
client_aws_config

Definition at line 352 of file config.cpp.

353{
354 return client_aws_config_;
355}

◆ get_cloud_config()

cloud_config & hazelcast::client::config::client_network_config::get_cloud_config ( )

Returns the current cloud_config.

Returns
cloud_config

Definition at line 358 of file config.cpp.

359{
360 return cloud_config_;
361}

◆ get_connection_timeout()

std::chrono::milliseconds hazelcast::client::config::client_network_config::get_connection_timeout ( ) const

Connection timeout value for connecting to a member server.

Returns
connection timeout set for a single connection attempt.

Definition at line 338 of file config.cpp.

339{
340 return connection_timeout_;
341}

◆ get_socket_options()

socket_options & hazelcast::client::config::client_network_config::get_socket_options ( )

Definition at line 405 of file config.cpp.

406{
407 return socket_options_;
408}

◆ get_ssl_config()

ssl_config & hazelcast::client::config::client_network_config::get_ssl_config ( )

Returns the current \ssl_config .

Returns
the ssl_config .
See also
# set_ssl_config (ssl_config )

Definition at line 325 of file config.cpp.

326{
327 return ssl_config_;
328}

◆ is_smart_routing()

bool hazelcast::client::config::client_network_config::is_smart_routing ( ) const

See client_network_config#setSmartRouting(boolean) for details.

Returns
true if client is smart

Definition at line 364 of file config.cpp.

365{
366 return smart_routing_;
367}

◆ set_addresses()

client_network_config & hazelcast::client::config::client_network_config::set_addresses ( const std::vector< address > & addresses)

Adds given addresses to candidate address list that client will use to establish initial connection.

Parameters
addressesto be added to initial address list
Returns
configured \client_network_config for chaining

Definition at line 391 of file config.cpp.

392{
393 address_list_ = addresses;
394 return *this;
395}

◆ set_aws_config()

client_network_config & hazelcast::client::config::client_network_config::set_aws_config ( const client_aws_config & client_aws_config)

Sets configuration to connect nodes in aws environment.

Parameters
clientAwsConfigthe client_aws_config
See also
get_aws_config()

Definition at line 344 of file config.cpp.

346{
347 this->client_aws_config_ = client_aws_config;
348 return *this;
349}

◆ set_connection_timeout()

client_network_config & hazelcast::client::config::client_network_config::set_connection_timeout ( const std::chrono::milliseconds & timeout)
Parameters
connectionTimeoutTimeout value for nodes to accept client connection requests. A zero value means wait until connection established or an error occurs. The resolution of time is up to milliseconds.
Returns
itself client_network_config

Definition at line 411 of file config.cpp.

413{
414 connection_timeout_ = timeout;
415 return *this;
416}

◆ set_smart_routing()

client_network_config & hazelcast::client::config::client_network_config::set_smart_routing ( bool smart_routing)

If true, client will route the key based operations to owner of the key on best-effort basis.

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.

If smartRouting == false, all operations will be routed to single member. Operations will need two hops if the chosen member is not owner of the key. Client will have only single open connection. Useful, if there are many clients and we want to avoid each of them connecting to each member.

Default value is true.

Parameters
smartRoutingtrue if smart routing should be enabled.
Returns
configured client_network_config for chaining

Definition at line 370 of file config.cpp.

371{
372 client_network_config::smart_routing_ = smart_routing;
373 return *this;
374}

◆ set_ssl_config()

client_network_config & hazelcast::client::config::client_network_config::set_ssl_config ( const config::ssl_config & config)

Sets the ssl_config.

Parameters
configthe ssl_config .
Returns
the updated client_network_config.
See also
# get_ssl_config ()

Definition at line 331 of file config.cpp.

332{
333 ssl_config_ = config;
334 return *this;
335}

◆ use_public_address() [1/2]

bool hazelcast::client::config::client_network_config::use_public_address ( ) const
Returns
true if the public address of the server needs to be used when connecting to the cluster.

Definition at line 419 of file config.cpp.

420{
421 return use_public_address_;
422}

◆ use_public_address() [2/2]

client_network_config & hazelcast::client::config::client_network_config::use_public_address ( bool should_use_public_address)
Parameters
should_use_public_addresstrue mean force usage of the public address of the server when connecting to the server. Otherwise, set to false to use the private address. Default is false.
Returns
configured \client_network_config for chaining

Definition at line 425 of file config.cpp.

426{
427 use_public_address_ = should_use_public_address;
428 return *this;
429}

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