public abstract class SentinelClientBuilder<C> extends AbstractClientBuilder<SentinelClientBuilder<C>,C>
This builder provides methods specific to Redis Sentinel deployments, including master name configuration, sentinel nodes configuration, and separate client configurations for master and sentinel connections.
cache, cacheConfig, clientConfig, commandExecutor, commandObjects, connectionProvider, jsonObjectMapper, keyPreProcessor, poolConfig, searchDialect| Constructor and Description |
|---|
SentinelClientBuilder() |
| Modifier and Type | Method and Description |
|---|---|
C |
build()
Builds the Redis client instance using the common build pattern.
|
protected ConnectionProvider |
createDefaultConnectionProvider()
Creates a default connection provider based on the current configuration.
|
SentinelClientBuilder<C> |
masterName(java.lang.String masterName)
Sets the master name for the Redis Sentinel configuration.
|
protected SentinelClientBuilder<C> |
self()
Returns the concrete builder instance for method chaining.
|
SentinelClientBuilder<C> |
sentinelClientConfig(JedisClientConfig sentinelClientConfig)
Sets the client configuration for Sentinel connections.
|
SentinelClientBuilder<C> |
sentinels(java.util.Set<HostAndPort> sentinels)
Sets the sentinel nodes to connect to.
|
protected void |
validateSpecificConfiguration()
Validates the builder-specific configuration.
|
applyCommandObjectsConfiguration, cache, cacheConfig, clientConfig, commandExecutor, connectionProvider, createClient, createDefaultClientConfig, createDefaultCommandExecutor, createDefaultCommandObjects, jsonObjectMapper, keyPreProcessor, poolConfig, searchDialect, validateCommonConfigurationpublic SentinelClientBuilder<C> masterName(java.lang.String masterName)
This is the name of the Redis master as configured in the Sentinel instances. The Sentinel will monitor this master and provide failover capabilities.
masterName - the master name (must not be null or empty)public SentinelClientBuilder<C> sentinels(java.util.Set<HostAndPort> sentinels)
At least one sentinel must be specified. The client will use these sentinels to discover the current master and monitor for failover events.
sentinels - the set of sentinel nodespublic SentinelClientBuilder<C> sentinelClientConfig(JedisClientConfig sentinelClientConfig)
This configuration is used for connections to the Sentinel instances. It may have different authentication credentials and settings than the master connections.
sentinelClientConfig - the client configuration for sentinel connectionsprotected SentinelClientBuilder<C> self()
AbstractClientBuilderself in class AbstractClientBuilder<SentinelClientBuilder<C>,C>protected ConnectionProvider createDefaultConnectionProvider()
AbstractClientBuildercreateDefaultConnectionProvider in class AbstractClientBuilder<SentinelClientBuilder<C>,C>protected void validateSpecificConfiguration()
AbstractClientBuilderThis method is called by the generic build() method to validate configuration specific to each builder type. Implementations should call validateCommonConfiguration() and then perform their own specific validation.
validateSpecificConfiguration in class AbstractClientBuilder<SentinelClientBuilder<C>,C>public C build()
AbstractClientBuilderThis method implements the common build pattern shared across all builder types:
build in class AbstractClientBuilder<SentinelClientBuilder<C>,C>Copyright © 2025. All rights reserved.