Class CassandraDb
java.lang.Object
kieker.extension.cassandra.writer.CassandraDb
public class CassandraDb
extends java.lang.Object
- Since:
- 1.16
- Author:
- Armin Moebius, Sven Ulrich, Reiner Jung
-
Constructor Summary
Constructors Constructor Description CassandraDb(java.lang.String keyspace, java.util.List<java.net.InetSocketAddress> contactPoints, java.lang.String tablePrefix, boolean dropTables)Creates a new instance of this class using the given parameter. -
Method Summary
Modifier and Type Method Description booleanconnect()Establishes a connection to the database.voiddisconnect()Closes all open connections to the database.com.datastax.oss.driver.api.core.cql.BoundStatementgetBoundStatement(com.datastax.oss.driver.api.core.cql.PreparedStatement statement)Returns a BoundStatement from the given String.voidinsert(IMonitoringRecord record, java.lang.String benchmarkId)Insert a record into the database.
-
Constructor Details
-
CassandraDb
public CassandraDb(java.lang.String keyspace, java.util.List<java.net.InetSocketAddress> contactPoints, java.lang.String tablePrefix, boolean dropTables)Creates a new instance of this class using the given parameter.- Parameters:
keyspace-contactPoints-tablePrefix-dropTables-
-
-
Method Details
-
connect
public boolean connect()Establishes a connection to the database.- Returns:
- true when the connection could be established
-
disconnect
public void disconnect()Closes all open connections to the database. -
insert
public void insert(IMonitoringRecord record, java.lang.String benchmarkId) throws MonitoringRecordExceptionInsert a record into the database.- Parameters:
record- the recordbenchmarkId- the current benchmarkId- Throws:
MonitoringRecordException- failed to insert the record or creating and registring the record table in the first place.
-
getBoundStatement
public com.datastax.oss.driver.api.core.cql.BoundStatement getBoundStatement(com.datastax.oss.driver.api.core.cql.PreparedStatement statement)Returns a BoundStatement from the given String. Uses the default Session to the keyspace.- Parameters:
statement-- Returns:
- bound statement
-