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)` | Like `create(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)` | Like `createShared(Vertx, String, CassandraClientOptions)` with default options and client name.
    `static CassandraClient` | `createShared​(Vertx vertx, CassandraClientOptions options)` | Like `createShared(Vertx, String, CassandraClientOptions)` with default client name.
    `static CassandraClient` | `createShared​(Vertx vertx, String clientName)` | Like `createShared(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()` | Get `Metadata` 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 a `SimpleStatement`.
    `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 SQL `SELECT` 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)

      Like `create(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 instance
        `options` - the options
      Returns:
        the client

    - #### createShared

          static CassandraClient createShared​(Vertx vertx)

      Like `createShared(Vertx, String, CassandraClientOptions)` with default options and client name.

    - #### createShared

          static CassandraClient createShared​(Vertx vertx,
                                              String clientName)

      Like `createShared(Vertx, String, CassandraClientOptions)` with default options.

    - #### createShared

          static CassandraClient createShared​(Vertx vertx,
                                              CassandraClientOptions options)

      Like `createShared(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 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