Class BaseClientConfiguration
- java.lang.Object
-
- glide.api.models.configuration.BaseClientConfiguration
-
- Direct Known Subclasses:
GlideClientConfiguration,GlideClusterClientConfiguration
public abstract class BaseClientConfiguration extends java.lang.ObjectConfiguration settings class for creating a client. Shared settings for standalone and cluster clients.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBaseClientConfiguration.BaseClientConfigurationBuilder<C extends BaseClientConfiguration,B extends BaseClientConfiguration.BaseClientConfigurationBuilder<C,B>>
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseClientConfiguration(BaseClientConfiguration.BaseClientConfigurationBuilder<?,?> b)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.util.List<NodeAddress>getAddresses()java.util.Optional<AddressResolver>getAddressResolver()Returns the address resolver if configured.abstract AdvancedBaseClientConfigurationgetAdvancedConfiguration()Returns the advanced configuration settings for the client.java.lang.StringgetClientAZ()Availability Zone of the client.ClientCircuitBreakerConfigurationgetClientCircuitBreakerConfiguration()Configuration for the client-wide circuit breaker.java.lang.StringgetClientName()Client name to be used for the client.abstract ClientSideCachegetClientSideCache()Client-side cache configuration.CompressionConfigurationgetCompressionConfiguration()ServerCredentialsgetCredentials()Credentials for authentication process.java.lang.IntegergetDatabaseId()Index of the logical database to connect to.java.lang.IntegergetInflightRequestsLimit()The maximum number of concurrent requests allowed to be in-flight (sent but not yet completed).java.lang.StringgetLibName()Library name to be used for the client.ProtocolVersiongetProtocol()Serialization protocol to be used with the server.@NonNull ReadFromgetReadFrom()Represents the client's read from strategy.BackoffStrategygetReconnectStrategy()Strategy used to determine how and when to reconnect, in case of connection failures.java.lang.IntegergetRequestTimeout()The duration in milliseconds that the client should wait for a request to complete.abstract BaseSubscriptionConfigurationgetSubscriptionConfiguration()Returns the subscription configuration for the client.booleanisLazyConnect()Enables lazy connection mode, where physical connections to the server(s) are deferred until the first command is sent.booleanisUseTLS()True if communication with the cluster should use Transport Level Security.
-
-
-
Constructor Detail
-
BaseClientConfiguration
protected BaseClientConfiguration(BaseClientConfiguration.BaseClientConfigurationBuilder<?,?> b)
-
-
Method Detail
-
getClientSideCache
public abstract ClientSideCache getClientSideCache()
Client-side cache configuration. If provided, enables caching for this client.
-
getSubscriptionConfiguration
public abstract BaseSubscriptionConfiguration getSubscriptionConfiguration()
Returns the subscription configuration for the client.
-
getAdvancedConfiguration
public abstract AdvancedBaseClientConfiguration getAdvancedConfiguration()
Returns the advanced configuration settings for the client.
-
getAddresses
public java.util.List<NodeAddress> getAddresses()
-
getAddressResolver
public java.util.Optional<AddressResolver> getAddressResolver()
Returns the address resolver if configured.- Returns:
- An Optional containing the AddressResolver, or empty if not configured
-
isUseTLS
public boolean isUseTLS()
True if communication with the cluster should use Transport Level Security.If the server/cluster requires TLS, not setting this will cause the connection attempt to fail.
If the server/cluster doesn't require TLS, setting this will also cause the connection attempt to fail.
-
getReadFrom
@NonNull public @NonNull ReadFrom getReadFrom()
Represents the client's read from strategy.
-
getCredentials
public ServerCredentials getCredentials()
Credentials for authentication process. If none are set, the client will not authenticate itself with the server.
-
getRequestTimeout
public java.lang.Integer getRequestTimeout()
The duration in milliseconds that the client should wait for a request to complete. This duration encompasses sending the request, awaiting for a response from the server, and any required reconnection or retries. If the specified timeout is exceeded for a pending request, it will result in a timeout error. If not explicitly set, a default value of 250 milliseconds will be used.
-
getClientName
public java.lang.String getClientName()
Client name to be used for the client. Will be used with CLIENT SETNAME command during connection establishment.
-
getLibName
public java.lang.String getLibName()
Library name to be used for the client. Will be used with CLIENT SETINFO LIB-NAME command during connection establishment.
-
getProtocol
public ProtocolVersion getProtocol()
Serialization protocol to be used with the server. If not set,ProtocolVersion.RESP3will be used.
-
getInflightRequestsLimit
public java.lang.Integer getInflightRequestsLimit()
The maximum number of concurrent requests allowed to be in-flight (sent but not yet completed). This limit is used to control the memory usage and prevent the client from overwhelming the server or getting stuck in case of a queue backlog. If not set, a default value of 1000 will be used.
-
getClientCircuitBreakerConfiguration
public ClientCircuitBreakerConfiguration getClientCircuitBreakerConfiguration()
Configuration for the client-wide circuit breaker. When set, enables the circuit breaker which detects sustained error rates and rejects requests at the FFI boundary before threads park.If null (default), the circuit breaker is disabled.
-
getClientAZ
public java.lang.String getClientAZ()
Availability Zone of the client. If ReadFrom strategy is AZAffinity or AZAffinityReplicasAndPrimary, this setting ensures that readonly commands are directed to nodes within the specified AZ if exits.
-
getReconnectStrategy
public BackoffStrategy getReconnectStrategy()
Strategy used to determine how and when to reconnect, in case of connection failures.
-
getDatabaseId
public java.lang.Integer getDatabaseId()
Index of the logical database to connect to. Must be non-negative and within the range supported by the server configuration. If not specified, defaults to database 0.
-
isLazyConnect
public boolean isLazyConnect()
Enables lazy connection mode, where physical connections to the server(s) are deferred until the first command is sent. This can reduce startup latency and allow for client creation in disconnected environments.When set to
true, the client will not attempt to connect to the specified nodes during initialization. Instead, connections will be established only when a command is actually executed.Note that the first command executed with lazy connections may experience additional latency as it needs to establish the connection first. During this initial connection, the standard request timeout does not apply yet - instead, the connection establishment is governed by
connectionTimeout. The request timeout (requestTimeout) only begins counting after the connection has been successfully established. This behavior can effectively increase the total time needed for the first command to complete.This setting applies to both standalone and cluster modes. Note that if an operation is attempted and connection fails (e.g., unreachable nodes), errors will surface at that point.
If not set, connections are established immediately during client creation (equivalent to
false).
-
getCompressionConfiguration
public CompressionConfiguration getCompressionConfiguration()
-
-