public class CassandraEmbeddedServerBuilder extends Object
CassandraEmbeddedServerBuilder
.builder()
.withListenAdress("127.0.0.1")
.withRpcAdress("127.0.0.1")
.withBroadcastAdress("127.0.0.1")
.withBroadcastRPCAdress("127.0.0.1")
.withClusterName("Test Cluster")
.withDataFolder("/home/user/cassandra/data")
.withCommitLogFolder("/home/user/cassandra/commitlog")
.withSavedCachesFolder("/home/user/cassandra/saved_caches")
.cleanDataFilesAtStartup(true)
.withClusterName("Test Cluster")
.withKeyspaceName("achilles_test")
.withCQLPort(9042)
.withThriftPort(9160)
.withStoragePort(7990)
.withStorageSSLPort(7999)
.withDurableWrite(true)
.withScript("init_script.cql")
.buildNativeCluster();
| Modifier and Type | Method and Description |
|---|---|
static CassandraEmbeddedServerBuilder |
builder()
Create a new CassandraEmbeddedServerBuilder
|
Cluster |
buildNativeCluster()
Start an embedded Cassandra server but DO NOT bootstrap Achilles
|
Session |
buildNativeSession()
Start an embedded Cassandra server but DO NOT bootstrap Achilles
|
CassandraEmbeddedServer |
buildServer() |
CassandraEmbeddedServerBuilder |
cleanDataFilesAtStartup(boolean cleanDataFilesAtStartup)
Whether to clean all data files in data folder, commit log folder and
saved caches folder at startup or not.
|
CassandraEmbeddedServerBuilder |
useUnsafeCassandraDeamon()
Use an unsafe version of the Cassandra daemon.
|
CassandraEmbeddedServerBuilder |
useUnsafeCassandraDeamon(boolean useUnsafeCassandraDaemon)
Use an unsafe version of the Cassandra daemon.
|
CassandraEmbeddedServerBuilder |
withBroadcastAddress(String broadcastAddress)
Specify the broadcast address.
|
CassandraEmbeddedServerBuilder |
withBroadcastRpcAddress(String broadcastRpcAddress)
Specify the broadcast RPC address.
|
CassandraEmbeddedServerBuilder |
withCdcRawFolder(String cdcRawFolder)
Specify cdc_raw folder for the embedded Cassandra server.
|
CassandraEmbeddedServerBuilder |
withClusterName(String clusterName)
Specify the cluster name for the embedded Cassandra server.
|
CassandraEmbeddedServerBuilder |
withCommitLogFolder(String commitLogFolder)
Specify commit log folder for the embedded Cassandra server.
|
CassandraEmbeddedServerBuilder |
withConcurrentReads(int concurrentReads)
Specify the number threads for concurrent reads for the embedded Cassandra
server.
|
CassandraEmbeddedServerBuilder |
withConcurrentWrites(int concurrentWrites)
Specify the number threads for concurrent writes for the embedded Cassandra
server.
|
CassandraEmbeddedServerBuilder |
withConnectionProtocol(ProtocolVersion protocolVersion)
Specify the connection protocol version for the embedded Cassandra
server.
|
CassandraEmbeddedServerBuilder |
withCQLPort(int clqPort)
Specify the native transport port (CQL port) for the embedded Cassandra
server.
|
CassandraEmbeddedServerBuilder |
withDataFolder(String dataFolder)
Specify data folder for the embedded Cassandra server.
|
CassandraEmbeddedServerBuilder |
withDurableWrite(boolean durableWrite)
Specify the 'durable write' property for the embedded Cassandra server.
|
CassandraEmbeddedServerBuilder |
withHintsFolder(String hintsFolder)
Specify hints folder for the embedded Cassandra server.
|
CassandraEmbeddedServerBuilder |
withJMXPort(int jmxPort)
Specify the JMX port for the embedded Cassandra
server.
|
CassandraEmbeddedServerBuilder |
withKeyspaceName(String keyspaceName)
Specify the keyspace name for the embedded Cassandra server.
|
CassandraEmbeddedServerBuilder |
withListenAddress(String listenAddress)
Specify the listen address.
|
CassandraEmbeddedServerBuilder |
withParams(info.archinnov.achilles.type.TypedMap cassandraParams)
Inject Cassandra parameters
|
CassandraEmbeddedServerBuilder |
withRpcAddress(String rpcAddress)
Specify the rpc address.
|
CassandraEmbeddedServerBuilder |
withSavedCachesFolder(String savedCachesFolder)
Specify saved caches folder for the embedded Cassandra server.
|
CassandraEmbeddedServerBuilder |
withScript(String scriptLocation)
Load an CQL script in the class path and execute it upon initialization
of the embedded Cassandra server
Call this method as many times as there are CQL scripts to be executed. |
CassandraEmbeddedServerBuilder |
withScriptTemplate(String scriptTemplateLocation,
Map<String,Object> values)
Load an CQL script template in the class path, inject the values into the template
to produce the final script and execute it upon initialization
of the embedded Cassandra server
Call this method as many times as there are CQL templates to be executed. |
CassandraEmbeddedServerBuilder |
withShutdownHook(CassandraShutDownHook cassandraShutDownHook)
Inject a shutdown hook to control when to shutdown the embedded Cassandra process.
|
CassandraEmbeddedServerBuilder |
withStoragePort(int storagePort)
Specify the storage port for the embedded Cassandra server.
|
CassandraEmbeddedServerBuilder |
withStorageSSLPort(int storageSSLPort)
Specify the storage SSL port for the embedded Cassandra server.
|
CassandraEmbeddedServerBuilder |
withThriftPort(int thriftPort)
Specify the rpc port (Thrift port) for the embedded Cassandra server.
|
public static CassandraEmbeddedServerBuilder builder()
public CassandraEmbeddedServerBuilder withListenAddress(String listenAddress)
listenAddress - the listen addresspublic CassandraEmbeddedServerBuilder withRpcAddress(String rpcAddress)
rpcAddress - the RPC addresspublic CassandraEmbeddedServerBuilder withBroadcastAddress(String broadcastAddress)
broadcastAddress - the address to broadcast to other Cassandra nodes.public CassandraEmbeddedServerBuilder withBroadcastRpcAddress(String broadcastRpcAddress)
broadcastRpcAddress - the RPC address to broadcast to drivers and other Cassandra nodespublic CassandraEmbeddedServerBuilder withShutdownHook(CassandraShutDownHook cassandraShutDownHook)
CassandraShutDownHook shutdownHook = new CassandraShutDownHook();
Session session = CassandraEmbeddedServerBuilder.builder()
.withShutdownHook(shutdownHook)
...
.buildNativeSession();
...
shutdownHook.shutdownNow();
cassandraShutDownHook - shutdown hook to control the shutdown of the embedded Cassandra process;public CassandraEmbeddedServerBuilder withDataFolder(String dataFolder)
dataFolder - data folder for the embedded Cassandra serverpublic CassandraEmbeddedServerBuilder withCommitLogFolder(String commitLogFolder)
commitLogFolder - commit log folder for the embedded Cassandra serverpublic CassandraEmbeddedServerBuilder withSavedCachesFolder(String savedCachesFolder)
savedCachesFolder - saved caches folder for the embedded Cassandra serverpublic CassandraEmbeddedServerBuilder withHintsFolder(String hintsFolder)
hintsFolder - hints folder for the embedded Cassandra serverpublic CassandraEmbeddedServerBuilder withCdcRawFolder(String cdcRawFolder)
cdcRawFolder - cdc_raw folder for the embedded Cassandra serverpublic CassandraEmbeddedServerBuilder cleanDataFilesAtStartup(boolean cleanDataFilesAtStartup)
cleanDataFilesAtStartup - whether to clean all data files at startup or notpublic CassandraEmbeddedServerBuilder withClusterName(String clusterName)
clusterName - cluster namepublic CassandraEmbeddedServerBuilder withKeyspaceName(String keyspaceName)
keyspaceName - keyspace namepublic CassandraEmbeddedServerBuilder withCQLPort(int clqPort)
clqPort - native transport portpublic CassandraEmbeddedServerBuilder withConnectionProtocol(ProtocolVersion protocolVersion)
protocolVersion - connection protocol versionpublic CassandraEmbeddedServerBuilder withJMXPort(int jmxPort)
jmxPort - JMX portpublic CassandraEmbeddedServerBuilder withThriftPort(int thriftPort)
thriftPort - rpc portpublic CassandraEmbeddedServerBuilder withStoragePort(int storagePort)
storagePort - storage portpublic CassandraEmbeddedServerBuilder withStorageSSLPort(int storageSSLPort)
storageSSLPort - storage SSL portpublic CassandraEmbeddedServerBuilder withConcurrentReads(int concurrentReads)
concurrentReads - the number threads for concurrent readspublic CassandraEmbeddedServerBuilder withConcurrentWrites(int concurrentWrites)
concurrentWrites - the number threads for concurrent writespublic CassandraEmbeddedServerBuilder withDurableWrite(boolean durableWrite)
durableWrite - whether to activate 'durable write' or notpublic CassandraEmbeddedServerBuilder withScript(String scriptLocation)
CassandraEmbeddedServerBuilder
.withScript("script1.cql")
.withScript("script2.cql")
...
.build();
scriptLocation - location of the CQL script in the class pathpublic CassandraEmbeddedServerBuilder withScriptTemplate(String scriptTemplateLocation, Map<String,Object> values)
Map<String, Object> map1 = new HashMap<>();
map1.put("id", 100L);
map1.put("date", new Date());
...
CassandraEmbeddedServerBuilder
.withScriptTemplate("script1.cql", map1)
.withScriptTemplate("script2.cql", map2)
...
.build();
scriptTemplateLocation - location of the CQL script in the class pathvalues - values to inject into the template.public CassandraEmbeddedServerBuilder withParams(info.archinnov.achilles.type.TypedMap cassandraParams)
cassandraParams - cassandra parameterpublic CassandraEmbeddedServerBuilder useUnsafeCassandraDeamon()
public CassandraEmbeddedServerBuilder useUnsafeCassandraDeamon(boolean useUnsafeCassandraDaemon)
public Cluster buildNativeCluster()
public Session buildNativeSession()
public CassandraEmbeddedServer buildServer()
Copyright © 2012-2021. All Rights Reserved.