CosmosAsyncClient Class
- java.
lang. Object - com.
azure. cosmos. CosmosAsyncClient
- com.
Implements
public final class CosmosAsyncClient
implements Closeable
Provides a client-side logical representation of the Azure Cosmos DB service. This asynchronous client is used to configure and execute requests against the service.
CosmosAsyncClient is thread-safe. It's recommended to maintain a single instance of CosmosAsyncClient per lifetime of the application which enables efficient connection management and performance. CosmosAsyncClient initialization is a heavy operation - don't use initialization CosmosAsyncClient instances as credentials or network connectivity validations.
Method Summary
Methods inherited from java.lang.Object
Method Details
close
public void close()
Close this CosmosAsyncClient instance and cleans up the resources.
createDatabase
public Mono<CosmosDatabaseResponse> createDatabase(CosmosDatabaseProperties databaseProperties)
Creates a database. After subscription the operation will be performed. The Mono upon successful completion will contain a single resource response with the created database. In case of failure the Mono will error.
Parameters:
Returns:
createDatabase
public Mono<CosmosDatabaseResponse> createDatabase(CosmosDatabaseProperties databaseProperties, CosmosDatabaseRequestOptions options)
Creates a database. After subscription the operation will be performed. The Mono upon successful completion will contain a single resource response with the created database. In case of failure the Mono will error.
Parameters:
Returns:
createDatabase
public Mono<CosmosDatabaseResponse> createDatabase(CosmosDatabaseProperties databaseProperties, ThroughputProperties throughputProperties)
Creates a database. After subscription the operation will be performed. The Mono upon successful completion will contain a single resource response with the created database. In case of failure the Mono will error.
Parameters:
Returns:
createDatabase
public Mono<CosmosDatabaseResponse> createDatabase(CosmosDatabaseProperties databaseProperties, ThroughputProperties throughputProperties, CosmosDatabaseRequestOptions options)
Creates a database. After subscription the operation will be performed. The Mono upon successful completion will contain a single resource response with the created database. In case of failure the Mono will error.
Parameters:
Returns:
createDatabase
public Mono<CosmosDatabaseResponse> createDatabase(String id)
Creates a database. After subscription the operation will be performed. The Mono upon successful completion will contain a single resource response with the created database. In case of failure the Mono will error.
Parameters:
Returns:
createDatabase
public Mono<CosmosDatabaseResponse> createDatabase(String id, ThroughputProperties throughputProperties)
Creates a database.
Parameters:
Returns:
createDatabaseIfNotExists
public Mono<CosmosDatabaseResponse> createDatabaseIfNotExists(CosmosDatabaseProperties databaseProperties)
CREATE a Database if it does not already exist on the service. The Mono upon successful completion will contain a single cosmos database response with the created or existing database.
Parameters:
Returns:
createDatabaseIfNotExists
public Mono<CosmosDatabaseResponse> createDatabaseIfNotExists(String id)
Create a Database if it does not already exist on the service. The Mono upon successful completion will contain a single cosmos database response with the created or existing database.
Parameters:
Returns:
createDatabaseIfNotExists
public Mono<CosmosDatabaseResponse> createDatabaseIfNotExists(String id, ThroughputProperties throughputProperties)
Create a Database if it does not already exist on the service. The throughputProperties will only be used if the specified database does not exist and therefor a new database will be created with throughputProperties. The Mono upon successful completion will contain a single cosmos database response with the created or existing database.
Parameters:
Returns:
createGlobalThroughputControlConfigBuilder
public GlobalThroughputControlConfigBuilder createGlobalThroughputControlConfigBuilder(String databaseId, String containerId)
Create global throughput control config builder which will be used to build GlobalThroughputControlConfig.
Parameters:
Returns:
getDatabase
public CosmosAsyncDatabase getDatabase(String id)
Gets a database object without making a service call.
Parameters:
Returns:
queryDatabases
public CosmosPagedFlux<CosmosDatabaseProperties> queryDatabases(SqlQuerySpec querySpec, CosmosQueryRequestOptions options)
Query for databases. After subscription the operation will be performed. The CosmosPagedFlux<T> will contain one or several feed response of the read databases. In case of failure the CosmosPagedFlux<T> will error.
Parameters:
Returns:
queryDatabases
public CosmosPagedFlux<CosmosDatabaseProperties> queryDatabases(String query, CosmosQueryRequestOptions options)
Query for databases. After subscription the operation will be performed. The CosmosPagedFlux<T> will contain one or several feed response of the read databases. In case of failure the CosmosPagedFlux<T> will error.
Parameters:
Returns:
readAllDatabases
public CosmosPagedFlux<CosmosDatabaseProperties> readAllDatabases()
Reads all databases. After subscription the operation will be performed. The CosmosPagedFlux<T> will contain one or several feed response of the read databases. In case of failure the CosmosPagedFlux<T> will error.
Returns: