Interface CassandraClient


  • public interface CassandraClient
    Eclipse Vert.x Cassandra client.
    Author:
    Pavel Drankou, Thomas Segismont
    • 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,
                                      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 instance
        options - the options
        Returns:
        the client
      • 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 instance
        options - the options
        clientName - 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 execute
        collector - 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 execute
        collector - 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 a SimpleStatement.
        Parameters:
        statement - the statement to prepare
        Returns:
        a future of the result
      • queryStream

        Future<CassandraRowStream> queryStream​(String sql)
        Executes the given SQL SELECT statement which returns the results of the query as a read stream.
        Parameters:
        sql - the SQL to execute. For example SELECT * 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
      • close

        Future<Void> close()
        Closes this client.
        Returns:
        a future of the result
      • metadata

        Future<com.datastax.oss.driver.api.core.metadata.Metadata> metadata()
        Get Metadata for the session.
        Returns:
        a future of the result