Class Cluster
java.lang.Object
com.couchbase.analytics.client.java.Cluster
- All Implemented Interfaces:
Queryable,Closeable,AutoCloseable
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidcredential(Credential newCredential) Sets the credential to use for future requests.Returns the database in this cluster with the given name.executeQuery(String statement, Consumer<QueryOptions> options) Executes a query statement using the specified options (query parameters, etc.), and buffers all result rows in memory.executeStreamingQuery(String statement, Consumer<Row> rowAction, Consumer<QueryOptions> options) Executes a query statement using the specified options, (query parameters, etc.), and passes result rows to the givenrowActioncallback, one by one as they arrive from the server.static ClusternewInstance(String connectionString, Credential credential) static ClusternewInstance(String connectionString, Credential credential, Consumer<ClusterOptions> options) startQuery(String statement, Consumer<StartQueryOptions> options) Starts executing a query statement using the specified options (query parameters, etc.), and returns a "handle" for fetching the results later.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.couchbase.analytics.client.java.Queryable
executeQuery, executeStreamingQuery, startQuery
-
Method Details
-
toString
-
newInstance
-
newInstance
public static Cluster newInstance(String connectionString, Credential credential, Consumer<ClusterOptions> options) -
credential
Sets the credential to use for future requests.- Throws:
IllegalStateException- if the given credential is of a different type than the current credential (username and password / client certificate).
-
database
Returns the database in this cluster with the given name.A database is a container for
Scopes.If the database does not exist, this method still returns a non-null object, but operations using that object fail with an exception indicating the database does not exist.
-
startQuery
Description copied from interface:QueryableStarts executing a query statement using the specified options (query parameters, etc.), and returns a "handle" for fetching the results later.Use this execution mode to ensure resilience against network interruptions during long-running queries.
- Specified by:
startQueryin interfaceQueryable- Parameters:
statement- The Analytics SQL++ statement to execute.options- A callback for specifying custom query options.- Returns:
- A handle for fetching the result later.
-
executeQuery
Description copied from interface:QueryableExecutes a query statement using the specified options (query parameters, etc.), and buffers all result rows in memory.If the results are not known to fit in memory, consider using the streaming version that takes a row action callback:
Queryable.executeStreamingQuery(String, Consumer, Consumer).- Specified by:
executeQueryin interfaceQueryable- Parameters:
statement- The Analytics SQL++ statement to execute.options- A callback for specifying custom query options.- Returns:
- A query result consisting of metadata and a list of rows.
-
executeStreamingQuery
public QueryMetadata executeStreamingQuery(String statement, Consumer<Row> rowAction, Consumer<QueryOptions> options) Description copied from interface:QueryableExecutes a query statement using the specified options, (query parameters, etc.), and passes result rows to the givenrowActioncallback, one by one as they arrive from the server.The callback action is guaranteed to execute in the same thread (or virtual thread) that called this method. If the callback throws an exception, the query is cancelled and the exception is re-thrown by this method.
- Specified by:
executeStreamingQueryin interfaceQueryable- Parameters:
statement- The Analytics SQL++ statement to execute.options- A callback for specifying custom query options.- Returns:
- Query metadata.
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-