Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.34k stars 1.98k forks source link

Questions relates to migration from Java sync v2 to V4 #15037

Closed xinlian12 closed 2 years ago

xinlian12 commented 4 years ago

Use this to keep tracking the migration questions from customer relates to sync v2 to v4.

xinlian12 commented 4 years ago

Missing Class

  1. SqlParameterCollection (com.microsoft.azure.documentdb.SqlParameterCollection has been removed)

This class has been removed from v4, can directly pass a list of sqlParameters: https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/src/main/java/com/azure/cosmos/examples/queries/sync/QueriesQuickstart.java#L403

Missing Methods

  1. getQueryIterable (missing from FeedResponse class)

Removed from v4. https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/src/main/java/com/azure/cosmos/examples/queries/sync/QueriesQuickstart.java#L237

  1. getRUPerMinuteUsed (missing from FeedResponse class)

Moved to response headers -> "x-ms-documentdb-is-ru-per-minute-used"

  1. Changes in IncludePath and ExcludePath (require path in argument and type to be list)

IncludedPath: https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/src/main/java/com/azure/cosmos/examples/indexmanagement/async/SampleIndexManagementAsync.java#L157

ExcludedPath: https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/src/main/java/com/azure/cosmos/examples/indexmanagement/async/SampleIndexManagementAsync.java#L162

  1. getRequestLatency (missing from ResourceResponse class)

https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/src/main/java/com/azure/cosmos/examples/indexmanagement/async/SampleIndexManagementAsync.java#L282

  1. getResponseContinuation (missing from FeedResponse class)

https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/src/main/java/com/azure/cosmos/examples/queries/sync/QueriesQuickstart.java#L259

  1. getReadEndpoint (missing from CosmosClient class)

Removed in V4.

  1. getWriteEndpoint (missing from CosmosClient class)

Removed in v4

  1. getConnectionPolicy (missing from CosmosClient class)

Removed in v4

  1. getPageSize (missing from CosmosQueryRequestOptions class)

Removed in v4

arun2803 commented 4 years ago

You mentioned that getReadEndpoint, getWriteEndpoint, getConnectionPolicy, getPageSize has been removed v4. I don't get it, functionality that all these methods provides has this been moved under some other class/method or these functionality has been complete removed? How will I get these informations in v4?

Also I using Sync DB connection and using "CosmosClient dbclient = new CosmosClientBuilder().endpoint(accountUrl).key(key).consistencyLevel(consistency).buildClient();"

now how can I do crud operations in this. In v2 we used "dbclient.deleteCollection()", "dbclient.readDocument", "dbclient.queryDocuments", "dbclient.createDocument", "dbclient.deleteDocument", "dbclient.replaceDocument" etc. Now how can I do these functionalities with CosmosClient ? All these methods are only available in Async mode

xinlian12 commented 2 years ago

getReadEndpoint, getWriteEndpoint, getConnectionPolicy, getPageSize has been removed completely in V4.

In V4, we support sync and async. Please find the sync examples here: https://docs.microsoft.com/en-us/azure/cosmos-db/sql/sql-api-java-sdk-samples

xinlian12 commented 2 years ago

Close of no activity