AsyncDocumentClient Interface

Definition

Provides a client-side logical representation of the Azure Cosmos DB database service. This async client is used to configure and execute requests against the service.

AsyncDocumentClient async APIs return rxJava'sObservable  , and so you can use rxJava Observable functionality. The async Observable based APIs perform the requested operation only after subscription.

The service client encapsulates the endpoint and credentials used to access the Cosmos DB service.

To instantiate you can use the Builder

ConnectionPolicy connectionPolicy = new ConnectionPolicy();
    connectionPolicy.setConnectionMode(ConnectionMode.Direct);
    AsyncDocumentClient client = new AsyncDocumentClient.Builder()
            .withServiceEndpoint(serviceEndpoint)
            .withMasterKeyOrResourceToken(masterKey)
            .withConnectionPolicy(connectionPolicy)
            .withConsistencyLevel(ConsistencyLevel.Session)
            .build();
    

public interface AsyncDocumentClient

Methods

close()

Close this AsyncDocumentClient instance and cleans up the resources.

createAttachment(String documentLink, Attachment attachment, RequestOptions options)

Creates an attachment.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the created attachment. In case of failure the Observable will error.

createAttachment(String documentLink, InputStream mediaStream, MediaOptions options, RequestOptions requestOptions)

Creates an attachment.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the created attachment. In case of failure the Observable will error.

createCollection(String databaseLink, DocumentCollection collection, RequestOptions options)

Creates a document collection.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the created collection. In case of failure the Observable will error.

createDatabase(Database database, RequestOptions options)

Creates a database.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the created database. In case of failure the Observable will error.

createDocument(String collectionLink, Object document, RequestOptions options, boolean disableAutomaticIdGeneration)

Creates a document.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the created document. In case of failure the Observable will error.

createPermission(String userLink, Permission permission, RequestOptions options)

Creates a permission.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the created permission. In case of failure the Observable will error.

createStoredProcedure(String collectionLink, StoredProcedure storedProcedure, RequestOptions options)

Creates a stored procedure.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the created stored procedure. In case of failure the Observable will error.

createTrigger(String collectionLink, Trigger trigger, RequestOptions options)

Creates a trigger.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the created trigger. In case of failure the Observable will error.

createUser(String databaseLink, User user, RequestOptions options)

Creates a user.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the created user. In case of failure the Observable will error.

createUserDefinedFunction(String collectionLink, UserDefinedFunction udf, RequestOptions options)

Creates a user defined function.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the created user defined function. In case of failure the Observable will error.

deleteAttachment(String attachmentLink, RequestOptions options)

Deletes an attachment.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response for the deleted attachment. In case of failure the Observable will error.

deleteCollection(String collectionLink, RequestOptions options)

Deletes a document collection by the collection link.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response for the deleted database. In case of failure the Observable will error.

deleteConflict(String conflictLink, RequestOptions options)

Deletes a conflict.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response for the deleted conflict. In case of failure the Observable will error.

deleteDatabase(String databaseLink, RequestOptions options)

Deletes a database.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the deleted database. In case of failure the Observable will error.

deleteDocument(String documentLink, RequestOptions options)

Deletes a document by the document link.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response for the deleted document. In case of failure the Observable will error.

deletePermission(String permissionLink, RequestOptions options)

Deletes a permission.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response for the deleted permission. In case of failure the Observable will error.

deleteStoredProcedure(String storedProcedureLink, RequestOptions options)

Deletes a stored procedure by the stored procedure link.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response for the deleted stored procedure. In case of failure the Observable will error.

deleteTrigger(String triggerLink, RequestOptions options)

Deletes a trigger.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response for the deleted trigger. In case of failure the Observable will error.

deleteUser(String userLink, RequestOptions options)

Deletes a user.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response for the deleted user. In case of failure the Observable will error.

deleteUserDefinedFunction(String udfLink, RequestOptions options)

Deletes a user defined function.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response for the deleted user defined function. In case of failure the Observable will error.

executeStoredProcedure(String storedProcedureLink, Object[] procedureParams)

Executes a stored procedure by the stored procedure link.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the stored procedure response. In case of failure the Observable will error.

executeStoredProcedure(String storedProcedureLink, RequestOptions options, Object[] procedureParams)

Executes a stored procedure by the stored procedure link.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the stored procedure response. In case of failure the Observable will error.

getConnectionPolicy()

Gets the connection policy

getDatabaseAccount()

Gets database account information.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the database account. In case of failure the Observable will error.

getReadEndpoint()

Gets the current read endpoint chosen based on availability and preference.

getServiceEndpoint()

Gets the default service endpoint as passed in by the user during construction.

getWriteEndpoint()

Gets the current write endpoint chosen based on availability and preference.

queryAttachments(String documentLink, SqlQuerySpec querySpec, FeedOptions options)

Query for attachments.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the obtained attachments. In case of failure the Observable will error.

queryAttachments(String documentLink, String query, FeedOptions options)

Query for attachments.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the obtained attachments. In case of failure the Observable will error.

queryCollections(String databaseLink, SqlQuerySpec querySpec, FeedOptions options)

Query for document collections in a database.

After subscription the operation will be performed. The Observable will contain one or several feed response of the obtained collections. In case of failure the Observable will error.

queryCollections(String databaseLink, String query, FeedOptions options)

Query for document collections in a database.

After subscription the operation will be performed. The Observable will contain one or several feed response of the obtained collections. In case of failure the Observable will error.

queryConflicts(String collectionLink, SqlQuerySpec querySpec, FeedOptions options)

Query for conflicts.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the obtained conflicts. In case of failure the Observable will error.

queryConflicts(String collectionLink, String query, FeedOptions options)

Query for conflicts.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the obtained conflicts. In case of failure the Observable will error.

queryDatabases(SqlQuerySpec querySpec, FeedOptions options)

Query for databases.

After subscription the operation will be performed. The Observable will contain one or several feed response of the obtained databases. In case of failure the Observable will error.

queryDatabases(String query, FeedOptions options)

Query for databases.

After subscription the operation will be performed. The Observable will contain one or several feed response of the read databases. In case of failure the Observable will error.

queryDocumentChangeFeed(String collectionLink, ChangeFeedOptions changeFeedOptions)

Query for documents change feed in a document collection. After subscription the operation will be performed. The Observable will contain one or several feed response pages of the obtained documents. In case of failure the Observable will error.

queryDocuments(String collectionLink, SqlQuerySpec querySpec, FeedOptions options)

Query for documents in a document collection.

After subscription the operation will be performed. The Observable will contain one or several feed response of the obtained documents. In case of failure the Observable will error.

queryDocuments(String collectionLink, String query, FeedOptions options)

Query for documents in a document collection.

After subscription the operation will be performed. The Observable will contain one or several feed response of the obtained documents. In case of failure the Observable will error.

queryOffers(SqlQuerySpec querySpec, FeedOptions options)

Query for offers in a database.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of obtained obtained offers. In case of failure the Observable will error.

queryOffers(String query, FeedOptions options)

Query for offers in a database.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of obtained obtained offers. In case of failure the Observable will error.

queryPermissions(String permissionLink, SqlQuerySpec querySpec, FeedOptions options)

Query for permissions.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the obtained permissions. In case of failure the Observable will error.

queryPermissions(String permissionLink, String query, FeedOptions options)

Query for permissions.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the obtained permissions. In case of failure the Observable will error.

queryStoredProcedures(String collectionLink, SqlQuerySpec querySpec, FeedOptions options)

Query for stored procedures in a document collection.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the obtained stored procedures. In case of failure the Observable will error.

queryStoredProcedures(String collectionLink, String query, FeedOptions options)

Query for stored procedures in a document collection.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the obtained stored procedures. In case of failure the Observable will error.

queryTriggers(String collectionLink, SqlQuerySpec querySpec, FeedOptions options)

Query for triggers.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the obtained triggers. In case of failure the Observable will error.

queryTriggers(String collectionLink, String query, FeedOptions options)

Query for triggers.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the obtained triggers. In case of failure the Observable will error.

queryUserDefinedFunctions(String collectionLink, SqlQuerySpec querySpec, FeedOptions options)

Query for user defined functions.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the obtained user defined functions. In case of failure the Observable will error.

queryUserDefinedFunctions(String collectionLink, String query, FeedOptions options)

Query for user defined functions.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the obtained user defined functions. In case of failure the Observable will error.

queryUsers(String databaseLink, SqlQuerySpec querySpec, FeedOptions options)

Query for users.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the obtained users. In case of failure the Observable will error.

queryUsers(String databaseLink, String query, FeedOptions options)

Query for users.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the obtained users. In case of failure the Observable will error.

readAttachment(String attachmentLink, RequestOptions options)

Reads an attachment.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the read attachment. In case of failure the Observable will error.

readAttachments(String documentLink, FeedOptions options)

Reads all attachments in a document.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the read attachments. In case of failure the Observable will error.

readCollection(String collectionLink, RequestOptions options)

Reads a document collection by the collection link.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the read collection. In case of failure the Observable will error.

readCollections(String databaseLink, FeedOptions options)

Reads all document collections in a database.

After subscription the operation will be performed. The Observable will contain one or several feed response of the read collections. In case of failure the Observable will error.

readConflict(String conflictLink, RequestOptions options)

Reads a conflict.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the read conflict. In case of failure the Observable will error.

readConflicts(String collectionLink, FeedOptions options)

Reads all conflicts in a document collection.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the read conflicts. In case of failure the Observable will error.

readDatabase(String databaseLink, RequestOptions options)

Reads a database.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the read database. In case of failure the Observable will error.

readDatabases(FeedOptions options)

Reads all databases.

After subscription the operation will be performed. The Observable will contain one or several feed response of the read databases. In case of failure the Observable will error.

readDocument(String documentLink, RequestOptions options)

Reads a document by the document link.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the read document. In case of failure the Observable will error.

readDocuments(String collectionLink, FeedOptions options)

Reads all documents in a document collection.

After subscription the operation will be performed. The Observable will contain one or several feed response of the read documents. In case of failure the Observable will error.

readMedia(String mediaLink)

Reads a media by the media link.

readOffer(String offerLink)

Reads an offer.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the read offer. In case of failure the Observable will error.

readOffers(FeedOptions options)

Reads offers.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the read offers. In case of failure the Observable will error.

readPartitionKeyRanges(String collectionLink, FeedOptions options)

Reads all partition key ranges in a document collection. After subscription the operation will be performed. The Observable will contain one or several feed response pages of the obtained partition key ranges. In case of failure the Observable will error.

readPermission(String permissionLink, RequestOptions options)

Reads a permission.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the read permission. In case of failure the Observable will error.

readPermissions(String permissionLink, FeedOptions options)

Reads all permissions.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the read permissions. In case of failure the Observable will error.

readStoredProcedure(String storedProcedureLink, RequestOptions options)

Read a stored procedure by the stored procedure link.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the read stored procedure. In case of failure the Observable will error.

readStoredProcedures(String collectionLink, FeedOptions options)

Reads all stored procedures in a document collection link.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the read stored procedures. In case of failure the Observable will error.

readTrigger(String triggerLink, RequestOptions options)

Reads a trigger by the trigger link.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response for the read trigger. In case of failure the Observable will error.

readTriggers(String collectionLink, FeedOptions options)

Reads all triggers in a document collection.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the read triggers. In case of failure the Observable will error.

readUser(String userLink, RequestOptions options)

Reads a user.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the read user. In case of failure the Observable will error.

readUserDefinedFunction(String udfLink, RequestOptions options)

Read a user defined function.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response for the read user defined function. In case of failure the Observable will error.

readUserDefinedFunctions(String collectionLink, FeedOptions options)

Reads all user defined functions in a document collection.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the read user defined functions. In case of failure the Observable will error.

readUsers(String databaseLink, FeedOptions options)

Reads all users in a database.

After subscription the operation will be performed. The Observable will contain one or several feed response pages of the read users. In case of failure the Observable will error.

replaceAttachment(Attachment attachment, RequestOptions options)

Replaces an attachment.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the replaced attachment. In case of failure the Observable will error.

replaceCollection(DocumentCollection collection, RequestOptions options)

Replaces a document collection.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the replaced document collection. In case of failure the Observable will error.

replaceDocument(Document document, RequestOptions options)

Replaces a document with the passed in document.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the replaced document. In case of failure the Observable will error.

replaceDocument(String documentLink, Object document, RequestOptions options)

Replaces a document using a POJO object.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the replaced document. In case of failure the Observable will error.

replaceOffer(Offer offer)

Replaces an offer.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the replaced offer. In case of failure the Observable will error.

replacePermission(Permission permission, RequestOptions options)

Replaces a permission.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the replaced permission. In case of failure the Observable will error.

replaceStoredProcedure(StoredProcedure storedProcedure, RequestOptions options)

Replaces a stored procedure.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the replaced stored procedure. In case of failure the Observable will error.

replaceTrigger(Trigger trigger, RequestOptions options)

Replaces a trigger.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the replaced trigger. In case of failure the Observable will error.

replaceUser(User user, RequestOptions options)

Replaces a user.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the replaced user. In case of failure the Observable will error.

replaceUserDefinedFunction(UserDefinedFunction udf, RequestOptions options)

Replaces a user defined function.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the replaced user defined function. In case of failure the Observable will error.

updateMedia(String mediaLink, InputStream mediaStream, MediaOptions options)

Updates a media by the media link.

upsertAttachment(String documentLink, Attachment attachment, RequestOptions options)

Upserts an attachment.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the upserted attachment. In case of failure the Observable will error.

upsertAttachment(String documentLink, InputStream mediaStream, MediaOptions options, RequestOptions requestOptions)

Upserts an attachment to the media stream

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the upserted attachment. In case of failure the Observable will error.

upsertDocument(String collectionLink, Object document, RequestOptions options, boolean disableAutomaticIdGeneration)

Upserts a document.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the upserted document. In case of failure the Observable will error.

upsertPermission(String userLink, Permission permission, RequestOptions options)

Upserts a permission.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the upserted permission. In case of failure the Observable will error.

upsertStoredProcedure(String collectionLink, StoredProcedure storedProcedure, RequestOptions options)

Upserts a stored procedure.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the upserted stored procedure. In case of failure the Observable will error.

upsertTrigger(String collectionLink, Trigger trigger, RequestOptions options)

Upserts a trigger.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the upserted trigger. In case of failure the Observable will error.

upsertUser(String databaseLink, User user, RequestOptions options)

Upserts a user.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the upserted user. In case of failure the Observable will error.

upsertUserDefinedFunction(String collectionLink, UserDefinedFunction udf, RequestOptions options)

Upserts a user defined function.

After subscription the operation will be performed. The Observable upon successful completion will contain a single resource response with the upserted user defined function. In case of failure the Observable will error.

Applies to