public class CassandraFactory extends Object
| Name | Default | Description |
| clusterName | Defaults to the cluster name provided by the Cassandra driver. | The name of the cluster, as defined by the Cassandra driver; also used in metrics and health checks. |
| keyspace | No default. If provided, this will be included in the health check. | The name of the keyspace to connect to. |
| validationQuery | SELECT key FROM system.local | The query to execute against the cluster to determine whether it is healthy. |
| healthCheckTimeout | 2 seconds. | Sets the maximum time to wait for the validation query to respond. |
| contactPoints | No default. You must provide a list of contact points for the Cassandra driver. | Each contact point can be a DNS record resolving to multiple hosts. In this case all of them will be added to the Cluster. |
| port | 9042 | The port to use to connect to the Cassandra host. |
| protocolVersion | -1 | The native protocol version to use. |
| compression | NONE | Sets the compression to use for the transport. Must a value in the compression enum. |
| maxSchemaAgreementWait | No default. | Sets the maximum time to wait for schema agreement before returning from a DDL query. |
| reconnectionPolicy | No default. | The reconnection policy to use. |
| authProvider | No default. | The auth provider to use. |
| retryPolicy | No default. | The retry policy to use. |
| loadBalancingPolicy | No default. | The load balancing policy to use. |
| speculativeExecutionPolicy | No default. | The speculative execution policy to use. |
| queryOptions | No default. | The QueryOptions to use. |
| socketOptions | No default. | The SocketOptions to use |
| poolingOptions | No default. | The pooling options to use. |
| metricsEnabled | true | Whether or not to enable metrics reporting. |
| jmxEnabled | false | Whether or not to enable JMX metrics reporting. This should ideally remain disabled in a Dropwizard app,
as metrics reporters should be configured via the metrics configuration option. |
| shutdownGracePeriod | 30 seconds | The time to wait while the cluster closes gracefully; after which, the cluster will be forcefully terminated. |
| Constructor and Description |
|---|
CassandraFactory() |
| Modifier and Type | Method and Description |
|---|---|
com.datastax.driver.core.Cluster |
build(io.dropwizard.setup.Environment environment)
Builds a
Cluster instance for the given Environment. |
com.datastax.driver.core.Cluster |
build(com.codahale.metrics.MetricRegistry metrics,
com.codahale.metrics.health.HealthCheckRegistry healthChecks)
Builds a
Cluster instance. |
Optional<AuthProviderFactory> |
getAuthProvider() |
String |
getClusterName() |
com.datastax.driver.core.ProtocolOptions.Compression |
getCompression() |
String[] |
getContactPoints() |
io.dropwizard.util.Duration |
getHealthCheckTimeout() |
String |
getKeyspace() |
Optional<LoadBalancingPolicyFactory> |
getLoadBalancingPolicy() |
Optional<PoolingOptionsFactory> |
getPoolingOptions() |
int |
getPort() |
Optional<com.datastax.driver.core.ProtocolVersion> |
getProtocolVersion() |
Optional<com.datastax.driver.core.QueryOptions> |
getQueryOptions() |
Optional<ReconnectionPolicyFactory> |
getReconnectionPolicy() |
Optional<RetryPolicyFactory> |
getRetryPolicy() |
io.dropwizard.util.Duration |
getShutdownGracePeriod() |
Optional<com.datastax.driver.core.SocketOptions> |
getSocketOptions() |
Optional<SpeculativeExecutionPolicyFactory> |
getSpeculativeExecutionPolicy() |
Optional<SSLOptionsFactory> |
getSsl() |
String |
getValidationQuery() |
boolean |
isJmxEnabled() |
boolean |
isMetricsEnabled() |
void |
setAuthProvider(Optional<AuthProviderFactory> authProvider) |
void |
setClusterName(String clusterName) |
void |
setCompression(com.datastax.driver.core.ProtocolOptions.Compression compression) |
void |
setContactPoints(String[] contactPoints) |
void |
setHealthCheckTimeout(io.dropwizard.util.Duration healthCheckTimeout) |
void |
setJmxEnabled(boolean jmxEnabled) |
void |
setKeyspace(String keyspace) |
void |
setLoadBalancingPolicy(Optional<LoadBalancingPolicyFactory> loadBalancingPolicy) |
void |
setMaxSchemaAgreementWait(Optional<io.dropwizard.util.Duration> maxSchemaAgreementWait) |
void |
setMetricsEnabled(boolean metricsEnabled) |
void |
setPoolingOptions(Optional<PoolingOptionsFactory> poolingOptions) |
void |
setPort(int port) |
void |
setProtocolVersion(Optional<com.datastax.driver.core.ProtocolVersion> protocolVersion) |
void |
setQueryOptions(Optional<com.datastax.driver.core.QueryOptions> queryOptions) |
void |
setReconnectionPolicy(Optional<ReconnectionPolicyFactory> reconnectionPolicy) |
void |
setRetryPolicy(Optional<RetryPolicyFactory> retryPolicy) |
void |
setShutdownGracePeriod(io.dropwizard.util.Duration shutdownGracePeriod) |
void |
setSocketOptions(Optional<com.datastax.driver.core.SocketOptions> socketOptions) |
void |
setSpeculativeExecutionPolicy(Optional<SpeculativeExecutionPolicyFactory> speculativeExecutionPolicy) |
void |
setSsl(Optional<SSLOptionsFactory> ssl) |
void |
setValidationQuery(String validationQuery) |
public String getClusterName()
public void setClusterName(String clusterName)
public String getKeyspace()
public void setKeyspace(String keyspace)
public String getValidationQuery()
public void setValidationQuery(String validationQuery)
public String[] getContactPoints()
public void setContactPoints(String[] contactPoints)
public int getPort()
public void setPort(int port)
public Optional<com.datastax.driver.core.ProtocolVersion> getProtocolVersion()
public void setProtocolVersion(Optional<com.datastax.driver.core.ProtocolVersion> protocolVersion)
public Optional<SSLOptionsFactory> getSsl()
public void setSsl(Optional<SSLOptionsFactory> ssl)
public com.datastax.driver.core.ProtocolOptions.Compression getCompression()
public void setCompression(com.datastax.driver.core.ProtocolOptions.Compression compression)
public void setMaxSchemaAgreementWait(Optional<io.dropwizard.util.Duration> maxSchemaAgreementWait)
public Optional<ReconnectionPolicyFactory> getReconnectionPolicy()
public void setReconnectionPolicy(Optional<ReconnectionPolicyFactory> reconnectionPolicy)
public Optional<AuthProviderFactory> getAuthProvider()
public void setAuthProvider(Optional<AuthProviderFactory> authProvider)
public Optional<RetryPolicyFactory> getRetryPolicy()
public void setRetryPolicy(Optional<RetryPolicyFactory> retryPolicy)
public Optional<LoadBalancingPolicyFactory> getLoadBalancingPolicy()
public void setLoadBalancingPolicy(Optional<LoadBalancingPolicyFactory> loadBalancingPolicy)
public Optional<SpeculativeExecutionPolicyFactory> getSpeculativeExecutionPolicy()
public void setSpeculativeExecutionPolicy(Optional<SpeculativeExecutionPolicyFactory> speculativeExecutionPolicy)
public Optional<com.datastax.driver.core.QueryOptions> getQueryOptions()
public void setQueryOptions(Optional<com.datastax.driver.core.QueryOptions> queryOptions)
public Optional<com.datastax.driver.core.SocketOptions> getSocketOptions()
public void setSocketOptions(Optional<com.datastax.driver.core.SocketOptions> socketOptions)
public Optional<PoolingOptionsFactory> getPoolingOptions()
public void setPoolingOptions(Optional<PoolingOptionsFactory> poolingOptions)
public boolean isMetricsEnabled()
public void setMetricsEnabled(boolean metricsEnabled)
public boolean isJmxEnabled()
public void setJmxEnabled(boolean jmxEnabled)
public io.dropwizard.util.Duration getShutdownGracePeriod()
public void setShutdownGracePeriod(io.dropwizard.util.Duration shutdownGracePeriod)
public io.dropwizard.util.Duration getHealthCheckTimeout()
public void setHealthCheckTimeout(io.dropwizard.util.Duration healthCheckTimeout)
public com.datastax.driver.core.Cluster build(io.dropwizard.setup.Environment environment)
Cluster instance for the given Environment.
The environment will be used for lifecycle management, as well as metrics and
health-checks.environment - the environment to manage the lifecycle, metrics and health-checks.Cluster.public com.datastax.driver.core.Cluster build(com.codahale.metrics.MetricRegistry metrics,
com.codahale.metrics.health.HealthCheckRegistry healthChecks)
Cluster instance.
The MetricRegistry will be used to register client metrics, and the HealthCheckRegistry to register client health-checks.metrics - the registry to register client metrics.healthChecks - the registry to register client health-checks.Cluster.Copyright © 2016 Composable Systems Limited. All rights reserved.