Package io.vertx.cassandra
Interface CassandraClient
-
public interface CassandraClient
Eclipse Vert.x Cassandra client.- Author:
- Pavel Drankou, Thomas Segismont
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_SHARED_CLIENT_NAME
The default shared client name.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description Future<Void>
close()
Closes this client.static CassandraClient
create(Vertx vertx)
Likecreate(Vertx, CassandraClientOptions)
with default options.static CassandraClient
create(Vertx vertx, CassandraClientOptions options)
Create a Cassandra client which maintains its own driver session.static CassandraClient
createShared(Vertx vertx)
LikecreateShared(Vertx, String, CassandraClientOptions)
with default options and client name.static CassandraClient
createShared(Vertx vertx, CassandraClientOptions options)
LikecreateShared(Vertx, String, CassandraClientOptions)
with default client name.static CassandraClient
createShared(Vertx vertx, String clientName)
LikecreateShared(Vertx, String, CassandraClientOptions)
with default options.static CassandraClient
createShared(Vertx vertx, String clientName, CassandraClientOptions options)
Create a Cassandra client that shares its driver session with any other client having the same name.Future<ResultSet>
execute(com.datastax.oss.driver.api.core.cql.Statement statement)
Execute the statement and provide a handler for consuming results.<R> Future<R>
execute(com.datastax.oss.driver.api.core.cql.Statement statement, java.util.stream.Collector<com.datastax.oss.driver.api.core.cql.Row,?,R> collector)
Execute a statement and produce a result by applying a collector to result set rows.Future<ResultSet>
execute(String query)
Execute the query and provide a handler for consuming results.<R> Future<R>
execute(String query, java.util.stream.Collector<com.datastax.oss.driver.api.core.cql.Row,?,R> collector)
Execute a query and produce a result by applying a collector to result set rows.Future<List<com.datastax.oss.driver.api.core.cql.Row>>
executeWithFullFetch(com.datastax.oss.driver.api.core.cql.Statement statement)
Execute the query and provide a handler for consuming results.Future<List<com.datastax.oss.driver.api.core.cql.Row>>
executeWithFullFetch(String query)
Execute the query and provide a handler for consuming results.boolean
isConnected()
Future<com.datastax.oss.driver.api.core.metadata.Metadata>
metadata()
GetMetadata
for the session.Future<com.datastax.oss.driver.api.core.cql.PreparedStatement>
prepare(com.datastax.oss.driver.api.core.cql.SimpleStatement statement)
Prepares the provided aSimpleStatement
.Future<com.datastax.oss.driver.api.core.cql.PreparedStatement>
prepare(String query)
Prepares the provided query string.Future<CassandraRowStream>
queryStream(com.datastax.oss.driver.api.core.cql.Statement statement)
Executes the given SQL statement which returns the results of the query as a read stream.Future<CassandraRowStream>
queryStream(String sql)
Executes the given SQLSELECT
statement which returns the results of the query as a read stream.
-
-
-
Field Detail
-
DEFAULT_SHARED_CLIENT_NAME
static final String DEFAULT_SHARED_CLIENT_NAME
The default shared client name.- See Also:
- Constant Field Values
-
-
Method Detail
-
create
static CassandraClient create(Vertx vertx)
Likecreate(Vertx, CassandraClientOptions)
with default options.
-
create
static CassandraClient create(Vertx vertx, CassandraClientOptions options)
Create a Cassandra client which maintains its own driver session.It is not recommended to create several non shared clients in an application.
- Parameters:
vertx
- the Vert.x instanceoptions
- the options- Returns:
- the client
-
createShared
static CassandraClient createShared(Vertx vertx)
LikecreateShared(Vertx, String, CassandraClientOptions)
with default options and client name.
-
createShared
static CassandraClient createShared(Vertx vertx, String clientName)
LikecreateShared(Vertx, String, CassandraClientOptions)
with default options.
-
createShared
static CassandraClient createShared(Vertx vertx, CassandraClientOptions options)
LikecreateShared(Vertx, String, CassandraClientOptions)
with default client name.
-
createShared
static CassandraClient createShared(Vertx vertx, String clientName, CassandraClientOptions options)
Create a Cassandra client that shares its driver session with any other client having the same name.- Parameters:
vertx
- the Vert.x instanceoptions
- the optionsclientName
- the shared client name- Returns:
- the client
-
isConnected
boolean isConnected()
- Returns:
- whether this Cassandra client instance is connected
-
executeWithFullFetch
Future<List<com.datastax.oss.driver.api.core.cql.Row>> executeWithFullFetch(String query)
Execute the query and provide a handler for consuming results.- Parameters:
query
- the query to execute- Returns:
- a future of the result
-
executeWithFullFetch
Future<List<com.datastax.oss.driver.api.core.cql.Row>> executeWithFullFetch(com.datastax.oss.driver.api.core.cql.Statement statement)
Execute the query and provide a handler for consuming results.- Parameters:
statement
- the statement to execute- Returns:
- a future of the result
-
execute
Future<ResultSet> execute(String query)
Execute the query and provide a handler for consuming results.- Parameters:
query
- the query to execute- Returns:
- a future of the result
-
execute
<R> Future<R> execute(String query, java.util.stream.Collector<com.datastax.oss.driver.api.core.cql.Row,?,R> collector)
Execute a query and produce a result by applying a collector to result set rows.- Type Parameters:
R
- the result type- Parameters:
query
- the query to executecollector
- the collector to use to produce a result- Returns:
- a future of the result
-
execute
Future<ResultSet> execute(com.datastax.oss.driver.api.core.cql.Statement statement)
Execute the statement and provide a handler for consuming results.- Parameters:
statement
- the statement to execute- Returns:
- a future of the result
-
execute
<R> Future<R> execute(com.datastax.oss.driver.api.core.cql.Statement statement, java.util.stream.Collector<com.datastax.oss.driver.api.core.cql.Row,?,R> collector)
Execute a statement and produce a result by applying a collector to result set rows.- Type Parameters:
R
- the result type- Parameters:
statement
- the statement to executecollector
- the collector to use to produce a result- Returns:
- a future of the result
-
prepare
Future<com.datastax.oss.driver.api.core.cql.PreparedStatement> prepare(String query)
Prepares the provided query string.- Parameters:
query
- the query to prepare- Returns:
- a future of the result
-
prepare
Future<com.datastax.oss.driver.api.core.cql.PreparedStatement> prepare(com.datastax.oss.driver.api.core.cql.SimpleStatement statement)
Prepares the provided aSimpleStatement
.- Parameters:
statement
- the statement to prepare- Returns:
- a future of the result
-
queryStream
Future<CassandraRowStream> queryStream(String sql)
Executes the given SQLSELECT
statement which returns the results of the query as a read stream.- Parameters:
sql
- the SQL to execute. For exampleSELECT * FROM table ...
.- Returns:
- a future of the result
-
queryStream
Future<CassandraRowStream> queryStream(com.datastax.oss.driver.api.core.cql.Statement statement)
Executes the given SQL statement which returns the results of the query as a read stream.- Parameters:
statement
- the statement to execute.- Returns:
- a future of the result
-
metadata
Future<com.datastax.oss.driver.api.core.metadata.Metadata> metadata()
GetMetadata
for the session.- Returns:
- a future of the result
-
-