Class ClientConfig
- Direct Known Subclasses:
ClientClasspathXmlConfig
,ClientClasspathYamlConfig
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds a flake ID generator configuration.Adds a label for this clientClient
availableaddListenerConfig
(ListenerConfig listenerConfig) Helper method to add a new ListenerConfigaddNearCacheConfig
(NearCacheConfig nearCacheConfig) Helper method to add a new NearCacheConfigaddProxyFactoryConfig
(ProxyFactoryConfig proxyFactoryConfig) Helper method to add a newProxyFactoryConfig
addReliableTopicConfig
(ClientReliableTopicConfig reliableTopicConfig) Adds a ClientReliableTopicConfig.boolean
Returns aClientFlakeIdGeneratorConfig
configuration for the given flake ID generator name.Gets the classLoaderReturns the configured cluster name.Returns the pattern matcher which is used to match item names to configuration objects.Returns theClientFlakeIdGeneratorConfig
for the given name, creating one if necessary and adding it to the collection of known configurations.Returns the map ofFlakeIdGenerator
configurations, mapped by config name.Returns the configuration for tracking use of this Hazelcast instance.Gets list of all configuredListenerConfig
'sGets LoadBalancerGets load balancer class nameGetsManagedContext
Returns the metrics collection config.getNearCacheConfig
(String name) Gets theNearCacheConfig
configured for the map / cache with nameMap of all configured NearCacheConfig's with the name key and configuration as the valueGetsClientNetworkConfig
GetsProperties
objectgetProperty
(String name) Gets a named property already set or from system properties if not exists.Gets list ofProxyFactoryConfig
getReliableTopicConfig
(String name) Gets the ClientReliableTopicConfig for a given reliable topic name.Returns the map of reliable topic configurations, mapped by config name.GetsClientSecurityConfig
object which allows client credentials configuration.GetsSerializationConfig
Get current configuration of User Code Deployment.int
hashCode()
boolean
Note that backup acks to client can be enabled only for all members routing client.boolean
Returns whether CP direct-to-leader operation sending is enabled for this client.static ClientConfig
load()
Populates HazelcastClientConfig
object from an external configuration file.setBackupAckToClientEnabled
(boolean backupAckToClientEnabled) This feature reduces number of hops and increases performance forRoutingMode.ALL_MEMBERS
routing clients.setClassLoader
(ClassLoader classLoader) Sets the classLoader which is used by serialization and listener configurationsetClusterName
(String clusterName) setConfigPatternMatcher
(ConfigPatternMatcher configPatternMatcher) Sets the pattern matcher which is used to match item names to configuration objects.setConnectionStrategyConfig
(ClientConnectionStrategyConfig connectionStrategyConfig) setCPDirectToLeaderRoutingEnabled
(boolean cpDirectToLeaderRoutingEnabled) Sets whether CP direct-to-leader operation sending is enabled.Sets the map ofFlakeIdGenerator
configurations, mapped by config name.setInstanceName
(String instanceName) Set labels for the client.setListenerConfigs
(List<ListenerConfig> listenerConfigs) Sets allListenerConfig
'ssetLoadBalancer
(LoadBalancer loadBalancer) Sets theLoadBalancer
.setLoadBalancerClassName
(String loadBalancerClassName) Sets load balancer class name.setManagedContext
(ManagedContext managedContext) SetsManagedContext
setMetricsConfig
(ClientMetricsConfig metricsConfig) Sets the metrics collection config.setNativeMemoryConfig
(NativeMemoryConfig nativeMemoryConfig) setNearCacheConfigMap
(Map<String, NearCacheConfig> nearCacheConfigMap) Sets allNearCacheConfig
's with the provided mapsetNetworkConfig
(ClientNetworkConfig networkConfig) SetsClientNetworkConfig
setProperties
(Properties properties) sets all propertiessetProperty
(String name, String value) Sets the value of a named property.setProxyFactoryConfigs
(List<ProxyFactoryConfig> proxyFactoryConfigs) Sets theProxyFactoryConfig
Sets the map ofClientReliableTopicConfig
, mapped by config name.setSecurityConfig
(ClientSecurityConfig securityConfig) SetsClientSecurityConfig
objectsetSerializationConfig
(SerializationConfig serializationConfig) SetsSerializationConfig
setUserCodeDeploymentConfig
(ClientUserCodeDeploymentConfig userCodeDeploymentConfig) Set User Code Deployment configurationsetUserContext
(ConcurrentMap<String, Object> userContext) toString()
-
Field Details
-
DEFAULT_CLUSTER_NAME
Default cluster name.- See Also:
-
-
Constructor Details
-
ClientConfig
public ClientConfig() -
ClientConfig
-
-
Method Details
-
load
Populates HazelcastClientConfig
object from an external configuration file.It tries to load Hazelcast Client configuration from a list of well-known locations, and then applies overrides found in environment variables/system properties
When no location contains Hazelcast Client configuration then it returns default.
Note that the same mechanism is used when calling
HazelcastClient.newHazelcastClient()
.- Returns:
- ClientConfig created from a file when exists, otherwise default.
-
setConfigPatternMatcher
Sets the pattern matcher which is used to match item names to configuration objects. By default, theMatchingPointConfigPatternMatcher
is used.- Parameters:
configPatternMatcher
- the pattern matcher- Returns:
- this configuration
- Throws:
IllegalArgumentException
- if the pattern matcher isnull
-
getConfigPatternMatcher
Returns the pattern matcher which is used to match item names to configuration objects. By default, theMatchingPointConfigPatternMatcher
is used.- Returns:
- the pattern matcher
-
getProperty
Gets a named property already set or from system properties if not exists.- Parameters:
name
- property name- Returns:
- value of the property
-
setProperty
Sets the value of a named property.- Parameters:
name
- property namevalue
- value of the property- Returns:
- configured
ClientConfig
for chaining
-
getProperties
GetsProperties
object- Returns:
Properties
object
-
setProperties
sets all properties- Parameters:
properties
-Properties
object- Returns:
- configured
ClientConfig
for chaining
-
getSecurityConfig
GetsClientSecurityConfig
object which allows client credentials configuration.- Returns:
ClientSecurityConfig
instance
-
setSecurityConfig
SetsClientSecurityConfig
object- Parameters:
securityConfig
-ClientSecurityConfig
to be set- Returns:
- configured
ClientConfig
for chaining - See Also:
-
getNetworkConfig
GetsClientNetworkConfig
- Returns:
ClientNetworkConfig
ClientNetworkConfig
-
setNetworkConfig
SetsClientNetworkConfig
- Parameters:
networkConfig
-ClientNetworkConfig
to be set- Returns:
- configured
ClientConfig
for chaining ClientNetworkConfig
-
findFlakeIdGeneratorConfig
Returns aClientFlakeIdGeneratorConfig
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:
name
- name of the flake ID generator config- Returns:
- the flake ID generator configuration
- Throws:
InvalidConfigurationException
- if ambiguous configurations are found- See Also:
-
getFlakeIdGeneratorConfigMap
Returns the map ofFlakeIdGenerator
configurations, mapped by config name. The config name may be a pattern with which the configuration was initially obtained.- Returns:
- the map configurations mapped by config name
-
getFlakeIdGeneratorConfig
Returns theClientFlakeIdGeneratorConfig
for the given name, creating one if necessary and adding it to the collection of known configurations.The configuration is found by matching 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. Afterward, newly added configurations may be ignored.
- Parameters:
name
- name of the flake ID generator config- Returns:
- the cache configuration
- Throws:
InvalidConfigurationException
- if ambiguous configurations are found- See Also:
-
addFlakeIdGeneratorConfig
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:
config
- the flake ID configuration- Returns:
- this config instance
-
setFlakeIdGeneratorConfigMap
Sets the map ofFlakeIdGenerator
configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future.- Parameters:
map
- the FlakeIdGenerator configuration map to set- Returns:
- this config instance
-
addReliableTopicConfig
Adds a ClientReliableTopicConfig.- Parameters:
reliableTopicConfig
- the ClientReliableTopicConfig to add- Returns:
- configured
ClientConfig
for chaining
-
getReliableTopicConfig
Gets the ClientReliableTopicConfig for a given reliable topic name.- Parameters:
name
- the name of the reliable topic- Returns:
- the found config. If none is found, a default configured one is returned.
-
setReliableTopicConfigMap
Sets the map ofClientReliableTopicConfig
, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future.- Parameters:
map
- the FlakeIdGenerator configuration map to set- Returns:
- this config instance
-
getReliableTopicConfigMap
Returns the map of reliable topic configurations, mapped by config name. The config name may be a pattern with which the configuration was initially obtained.- Returns:
- the map configurations mapped by config name
-
addListenerConfig
Helper method to add a new ListenerConfig- Parameters:
listenerConfig
- ListenerConfig- Returns:
- configured
ClientConfig
for chaining - See Also:
-
getListenerConfigs
Gets list of all configuredListenerConfig
's- Returns:
ListenerConfig
- See Also:
-
getLoadBalancer
Gets LoadBalancer- Returns:
- LoadBalancer
- See Also:
-
setLoadBalancer
Sets theLoadBalancer
.If a load balancer class name was set, it will be removed.
- Parameters:
loadBalancer
-LoadBalancer
- Returns:
- configured
ClientConfig
for chaining - See Also:
-
getLoadBalancerClassName
Gets load balancer class name- Returns:
- load balancer class name
- See Also:
-
setLoadBalancerClassName
Sets load balancer class name.If a load balancer implementation was set, it will be removed.
- Parameters:
loadBalancerClassName
-LoadBalancer
- Returns:
- configured
ClientConfig
for chaining - See Also:
-
addProxyFactoryConfig
Helper method to add a newProxyFactoryConfig
- Parameters:
proxyFactoryConfig
-ProxyFactoryConfig
- Returns:
- configured
ClientConfig
for chaining ProxyFactoryConfig
-
getNearCacheConfig
Gets theNearCacheConfig
configured for the map / cache with name- Parameters:
name
- name of the map / cache- Returns:
- Configured
NearCacheConfig
- See Also:
-
getNearCacheConfigMap
Map of all configured NearCacheConfig's with the name key and configuration as the value- Returns:
- map of NearCacheConfig
- See Also:
-
setNearCacheConfigMap
Sets allNearCacheConfig
's with the provided map- Parameters:
nearCacheConfigMap
- map of (name,NearCacheConfig
)- Returns:
- configured
ClientConfig
for chaining
-
addNearCacheConfig
Helper method to add a new NearCacheConfig- Parameters:
nearCacheConfig
-NearCacheConfig
- Returns:
- configured
ClientConfig
for chaining - See Also:
-
setListenerConfigs
Sets allListenerConfig
's- Parameters:
listenerConfigs
- list ofListenerConfig
- Returns:
- configured
ClientConfig
for chaining - See Also:
-
getClassLoader
Gets the classLoader- Returns:
- configured classLoader, null if not yet configured
-
setClassLoader
Sets the classLoader which is used by serialization and listener configuration- Parameters:
classLoader
- the classLoader- Returns:
- configured
ClientConfig
for chaining
-
getManagedContext
GetsManagedContext
- Returns:
ManagedContext
ManagedContext
-
setManagedContext
SetsManagedContext
- Parameters:
managedContext
-ManagedContext
- Returns:
- configured
ClientConfig
for chaining ManagedContext
-
getProxyFactoryConfigs
Gets list ofProxyFactoryConfig
- Returns:
- list of
ProxyFactoryConfig
ProxyFactoryConfig
-
setProxyFactoryConfigs
Sets theProxyFactoryConfig
- Parameters:
proxyFactoryConfigs
- list to assign- Returns:
- configured
ClientConfig
for chaining
-
getSerializationConfig
GetsSerializationConfig
- Returns:
- SerializationConfig SerializationConfig
-
setSerializationConfig
SetsSerializationConfig
- Parameters:
serializationConfig
- SerializationConfig- Returns:
- configured
ClientConfig
for chaining - See Also:
-
getNativeMemoryConfig
-
setNativeMemoryConfig
-
getInstanceName
-
setInstanceName
-
getClusterName
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
-
setClusterName
-
getConnectionStrategyConfig
-
setConnectionStrategyConfig
public ClientConfig setConnectionStrategyConfig(ClientConnectionStrategyConfig connectionStrategyConfig) -
getUserCodeDeploymentConfig
Get current configuration of User Code Deployment.- Returns:
- User Code Deployment configuration
- Since:
- 3.9
-
setUserCodeDeploymentConfig
public ClientConfig setUserCodeDeploymentConfig(ClientUserCodeDeploymentConfig userCodeDeploymentConfig) Set User Code Deployment configuration- Parameters:
userCodeDeploymentConfig
- the configuration of User Code Deployment- Returns:
- configured
ClientConfig
for chaining - Since:
- 3.9
-
addLabel
Adds a label for this clientClient
available- Parameters:
label
- The label to be added.- Returns:
- configured
ClientConfig
for chaining
-
getLabels
- Returns:
- all the labels assigned to this client
-
setLabels
Set labels for the client. Deletes old labels if added earlier.- Parameters:
labels
- The labels to be set- Returns:
- configured
ClientConfig
for chaining
-
setUserContext
-
getUserContext
-
setBackupAckToClientEnabled
This feature reduces number of hops and increases performance forRoutingMode.ALL_MEMBERS
routing clients. It is enabled by default forRoutingMode.ALL_MEMBERS
routing clients. This config has no effect forRoutingMode.MULTI_MEMBER
orRoutingMode.SINGLE_MEMBER
routing clients.- Parameters:
backupAckToClientEnabled
- enables client to get backup acknowledgements directly from the member that backups are applied- Returns:
- configured
ClientConfig
for chaining
-
isBackupAckToClientEnabled
public boolean isBackupAckToClientEnabled()Note that backup acks to client can be enabled only for all members routing client. This config has no effect for single member or multi member clients.- Returns:
true
means backup acknowledgements come to client, otherwisefalse
indicates that acknowledgements go to members
-
isCPDirectToLeaderRoutingEnabled
public boolean isCPDirectToLeaderRoutingEnabled()Returns whether CP direct-to-leader operation sending is enabled for this client. This functionality requires Hazelcast Enterprise license components. The default setting isfalse
.- Returns:
true
if CP direct-to-leader operation sending is enabled, otherwisefalse
- Since:
- 5.5
-
setCPDirectToLeaderRoutingEnabled
Sets whether CP direct-to-leader operation sending is enabled. SeeisCPDirectToLeaderRoutingEnabled()
.- Parameters:
cpDirectToLeaderRoutingEnabled
- the boolean value to set- Returns:
- configured
ClientConfig
for chaining - Since:
- 5.5
-
getMetricsConfig
Returns the metrics collection config. -
setMetricsConfig
Sets the metrics collection config. -
getInstanceTrackingConfig
Returns the configuration for tracking use of this Hazelcast instance. -
hashCode
public int hashCode() -
equals
-
toString
-