Class ClientRoutesConfig.Builder
- java.lang.Object
-
- com.datastax.oss.driver.api.core.config.ClientRoutesConfig.Builder
-
- Enclosing class:
- ClientRoutesConfig
public static final class ClientRoutesConfig.Builder extends Object
Builder forClientRoutesConfig.
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClientRoutesConfig.BuilderaddEndpoint(ClientRouteProxy endpoint)Adds an endpoint to the configuration.ClientRoutesConfigbuild()Builds theClientRoutesConfigwith the configured endpoints and table name.ClientRoutesConfig.BuilderwithEndpoints(List<ClientRouteProxy> endpoints)Sets the endpoints for the configuration, replacing any previously added endpoints.ClientRoutesConfig.BuilderwithNativeTransportPort(int port)Sets the native transport port of the cluster nodes.ClientRoutesConfig.BuilderwithShardAwareness(boolean shardAwareness)Sets whether shard awareness is enabled.
-
-
-
Method Detail
-
addEndpoint
@NonNull public ClientRoutesConfig.Builder addEndpoint(@NonNull ClientRouteProxy endpoint)
Adds an endpoint to the configuration.- Parameters:
endpoint- the endpoint to add (must not be null).- Returns:
- this builder.
- Throws:
IllegalArgumentException- if an endpoint with the same connection ID has already been added.
-
withEndpoints
@NonNull public ClientRoutesConfig.Builder withEndpoints(@NonNull List<ClientRouteProxy> endpoints)
Sets the endpoints for the configuration, replacing any previously added endpoints.- Parameters:
endpoints- the endpoints to set (must not be null or empty).- Returns:
- this builder.
-
withNativeTransportPort
@NonNull public ClientRoutesConfig.Builder withNativeTransportPort(int port)
Sets the native transport port of the cluster nodes. This is used as the fallback port forbroadcastRpcAddresswhen system tables do not include port information. Only needed for clusters using a non-standard native transport port. Defaults to 9042.- Parameters:
port- the native transport port.- Returns:
- this builder.
-
withShardAwareness
@NonNull public ClientRoutesConfig.Builder withShardAwareness(boolean shardAwareness)
Sets whether shard awareness is enabled.When
true, the driver assumes the load balancer is configured to forward the driver's original source port to ScyllaDB (e.g. via Proxy Protocol v2), enabling shard-aware connection routing end-to-end through the load balancer.Requires
advanced-shard-awareness.enabled = true(the default).- Parameters:
shardAwareness-trueto enable shard awareness.- Returns:
- this builder.
-
build
@NonNull public ClientRoutesConfig build()
Builds theClientRoutesConfigwith the configured endpoints and table name.- Returns:
- the new configuration instance.
- Throws:
IllegalArgumentException- if no endpoints have been added.
-
-