This repository has been archived by the owner on Dec 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Cassandra Install Using HowHow
thrx.de edited this page Apr 11, 2017
·
2 revisions
Using thrx-framework-dropwizard:
<dependency>
<groupId>org.thrx.service</groupId>
<artifactId>thrx-framework-bom</artifactId>
<version>${thrx.framework.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.thrx.service</groupId>
<artifactId>thrx-framework-cassandra</artifactId>
</dependency>
In your Configuration
class, just add a CassandraClusterFactory
member for
configuration of the cluster connection:
class MyConfiguration extends Configuration {
@NotNull
@Valid
private CassandraClusterFactory cassandra = new CassandraClusterFactory();
@JsonProperty("cassandra")
public CassandraClusterFactory getCassandraClusterFactory() {
return cassandra;
}
@JsonProperty("cassandra")
public void setCassandraClusterFactory(CassandraClusterFactory factory) {
this.cassandra = factory;
}
}
Finally, in your Application
class, build an instance of the client:
class MyApplication extends Application<MyConfiguration> {
@Override
public void run(MyConfiguration configuration, Environment environment) {
Cluster client = configuration
.getCassandraClusterFactory()
.build(environment);
}
}
Cluster
instances will be configured as defined by the
CassandraClusterFactory
and will automatically be managed as part of the
application lifecycle.
Links und Infos:
Dropwizard - Cassandra https://github.com/datasift/dropwizard-cassandra or https://github.com/composable-systems/dropwizard-cassandra
http://docs.datastax.com/en/developer/java-driver/3.1/manual/
ToDo review: https://github.com/comeara/pillar