You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/migrate-java-v4-sdk.md
+32-27Lines changed: 32 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,56 +1,60 @@
1
1
---
2
-
title: Migrate your application to use the Java V4 SDK in Azure Cosmos DB (com.azure.cosmos)
3
-
description: Learn how to upgrade your existing Java application from using the older Azure Cosmos DB Java SDK to the newer Java SDK 4.0 (com.azure.cosmos package)for Core (SQL) API.
2
+
title: Migrate your application to use the Azure Cosmos DB Java SDK v4 (com.azure.cosmos)
3
+
description: Learn how to upgrade your existing Java application from using the older Azure Cosmos DB Java SDKs to the newer Java SDK 4.0 (com.azure.cosmos package)for Core (SQL) API.
4
4
author: anfeldma-ms
5
5
ms.author: anfeldma
6
6
ms.service: cosmos-db
7
7
ms.topic: conceptual
8
-
ms.date: 05/07/2020
8
+
ms.date: 05/08/2020
9
9
ms.reviewer: sngun
10
10
---
11
11
12
-
# Migrate your application to use the Java V4 SDK
12
+
# Migrate your application to use the Azure Cosmos DB Java SDK v4
13
13
14
-
This article explains how to upgrade your existing Java application that is using older Azure Cosmos DB Java SDK to the newer Java SDK 4.0 for Core (SQL) API. The Java V4 SDK corresponds to the `com.azure.cosmos` package. You can use the instructions in this doc if you are migrating your application from any of the following SDKs:
14
+
> [!IMPORTANT]
15
+
> For more information about this SDK, please view the Azure Cosmos DB Java SDK v4 Release notes, [Maven repository](https://mvnrepository.com/artifact/com.azure/azure-cosmos), Azure Cosmos DB Java SDK v4 [performance tips](performance-tips-java-sdk-v4-sql.md), and Azure Cosmos DB Java SDK v4 [troubleshooting guide](troubleshoot-java-sdk-v4-sql.md).
16
+
>
15
17
16
-
* Legacy Sync Java SDK 2.x.x
18
+
This article explains how to upgrade your existing Java application that is using an older Azure Cosmos DB Java SDK to the newer Azure Cosmos DB Java SDK 4.0 for Core (SQL) API. Azure Cosmos DB Java SDK v4 corresponds to the `com.azure.cosmos` package. You can use the instructions in this doc if you are migrating your application from any of the following Azure Cosmos DB Java SDKs:
19
+
20
+
* Sync Java SDK 2.x.x
17
21
* Async Java SDK 2.x.x
18
22
* Java SDK 3.x.x
19
23
20
-
## Java SDK’s and package mappings
24
+
## Azure Cosmos DB Java SDK’s and package mappings
21
25
22
26
The following table lists different Azure Cosmos DB Java SDKs, the package name and the release information:
23
27
24
28
| Java SDK| Release Date | Bundled APIs | Maven Jar | Java package name |API Reference | Release Notes |
The following are the key implementation differences between different SDKs:
34
38
35
-
### RxJava is replaced with reactor in Java 3.x.x and 4.0 SDKs
39
+
### RxJava is replaced with reactor in Azure Cosmos DB Java SDK versions 3.x.x and 4.0
36
40
37
-
If you have been using the 3.x.x Java SDK or the preview versions of that SDK and migrating to the 4.0 SDK, see the [Reactor pattern guide](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-pattern-guide.md) for an introduction to async programming and Reactor.
41
+
If you are unfamiliar with asynchronous programming or Reactive Programming, see the [Reactor pattern guide](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-pattern-guide.md) for an introduction to async programming and Project Reactor. This guide may be useful if you have been using Azure Cosmos DB Sync Java SDK 2.x.x or Azure Cosmos DB Java SDK 3.x.x Sync API in the past.
38
42
39
-
If you have been using Async Java SDK 2.x.x, and migrating to the 4.0 SDK, see the [Reactor vs RxJava Guide](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-rxjava-guide.md) for guidance on converting RxJava code to use Reactor.
43
+
If you have been using Azure Cosmos DB Async Java SDK 2.x.x, and you plan on migrating to the 4.0 SDK, see the [Reactor vs RxJava Guide](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-rxjava-guide.md) for guidance on converting RxJava code to use Reactor.
40
44
41
-
### Java SDK 4.0 has direct connectivity mode in both Async and Sync APIs
45
+
### Azure Cosmos DB Java SDK v4 has direct connectivity mode in both Async and Sync APIs
42
46
43
-
If you have been using the legacy Sync Java SDK 2.x.x, note that the direct connection mode based on TCP (as opposed to HTTP) is implemented in Java SDK 4.0 for both the Async and Sync APIs.
47
+
If you have been using Azure Cosmos DB Sync Java SDK 2.x.x, note that the direct connection mode based on TCP (as opposed to HTTP) is implemented in Azure Cosmos DB Java SDK 4.0 for both the Async and Sync APIs.
44
48
45
49
## API level changes
46
50
47
-
The following are the API level changes between Java 3.x.x Vs 4.x.x SDK and Async Java SDK 2.x.x and Legacy sync Java SDK 2.x.x:
51
+
The following are the API level changes in Azure Cosmos DB Java SDK 4.x.x compared to previous SDKs (Java SDK 3.x.x, Async Java SDK 2.x.x, and Sync Java SDK 2.x.x):
48
52
49
53

50
54
51
-
* The Java SDK 3.x.x and 4.0 refer the client resources as `Cosmos<resourceName>`. For example, `CosmosClient`, `CosmosDatabase`, `CosmosContainer`. Whereas in version 2.x.x, the Java SDKs doesn’t have a uniform naming scheme.
55
+
* The Azure Cosmos DB Java SDK 3.x.x and 4.0 refer the client resources as `Cosmos<resourceName>`. For example, `CosmosClient`, `CosmosDatabase`, `CosmosContainer`. Whereas in version 2.x.x, the Azure Cosmos DB Java SDKs don’t have a uniform naming scheme.
52
56
53
-
*The Java SDK 3.x.x and 4.0 offer both Sync and Async APIs.
57
+
*Azure Cosmos DB Java SDK 3.x.x and 4.0 offer both Sync and Async APIs.
54
58
55
59
***Java SDK 4.0** : All the classes belong to the Sync API unless the class name is appended with `Async` after `Cosmos`.
56
60
@@ -60,31 +64,31 @@ The following are the API level changes between Java 3.x.x Vs 4.x.x SDK and Asyn
60
64
61
65
### Hierarchical API structure
62
66
63
-
The Java SDK 4.0 and Java SDK 3.x.x introduces a hierarchical API structure that organizes the clients, databases, and containers in a nested fashion as shown in the following 4.0 SDK code snippet:
67
+
Azure Cosmos DB Java SDK 4.0 and 3.x.x introduce a hierarchical API structure that organizes the clients, databases, and containers in a nested fashion as shown in the following 4.0 SDK code snippet:
In version 2.x.x of Java SDKs, all operations on resources and documents are performed through the client instance.
73
+
In version 2.x.x of the Azure Cosmos DB Java SDK, all operations on resources and documents are performed through the client instance.
70
74
71
75
### Representing documents
72
76
73
-
In Java SDK 4.0, custom POJO's and `JsonNodes` are the two options to read and write the documents from Azure Cosmos DB.
77
+
In Azure Cosmos DB Java SDK 4.0, custom POJO's and `JsonNodes` are the two options to read and write the documents from Azure Cosmos DB.
74
78
75
-
In the Java SDK 3.x.x, the `CosmosItemProperties` object is exposed by the public API and served as a document representation. This class is no longer exposed in Java SDK 4.0.
79
+
In the Azure Cosmos DB Java SDK 3.x.x, the `CosmosItemProperties` object is exposed by the public API and served as a document representation. This class is no longer exposed publicly in version 4.0.
76
80
77
81
### Imports
78
82
79
-
* The Java SDK 4.0 packages begin with `com.azure.cosmos`
80
-
* Java SDK 3.x.x packages begin with `com.azure.data.cosmos`
83
+
* The Azure Cosmos DB Java SDK 4.0 packages begin with `com.azure.cosmos`
84
+
*Azure Cosmos DB Java SDK 3.x.x packages begin with `com.azure.data.cosmos`
81
85
82
-
* Java SDK 4.0 places several classes in a nested package `com.azure.cosmos.models`. Some of these packages include:
86
+
*Azure Cosmos DB Java SDK 4.0 places several classes in a nested package `com.azure.cosmos.models`. Some of these packages include:
83
87
84
88
*`CosmosContainerResponse`
85
89
*`CosmosDatabaseResponse`
86
90
*`CosmosItemResponse`
87
-
* The Async API analogs for all the above packages
91
+
* The Async API analogs for all of the above packages
88
92
*`CosmosContainerProperties`
89
93
*`FeedOptions`
90
94
*`PartitionKey`
@@ -93,9 +97,9 @@ In the Java SDK 3.x.x, the `CosmosItemProperties` object is exposed by the publi
93
97
94
98
### Accessors
95
99
96
-
The Java SDK 4.0 exposes `get` and `set` methods to access the instance members. For example, the `CosmosContainer` instance has `container.getId()` and `container.setId()` methods.
100
+
Azure Cosmos DB Java SDK 4.0 exposes `get` and `set` methods to access the instance members. For example, the `CosmosContainer` instance has `container.getId()` and `container.setId()` methods.
97
101
98
-
This is different from Java SDK 3.x.x which exposes a fluent interface. For example, a `CosmosSyncContainer` instance has `container.id()` which is overloaded to get or set the `id` value.
102
+
This is different from Azure Cosmos DB Java SDK 3.x.x which exposes a fluent interface. For example, a `CosmosSyncContainer` instance has `container.id()` which is overloaded to get or set the `id` value.
99
103
100
104
## Code snippet comparisons
101
105
@@ -537,4 +541,5 @@ SalesOrder salesOrder = new SalesOrder(
537
541
## Next steps
538
542
539
543
*[Build a Java app](create-sql-api-java.md) to manage Azure Cosmos DB SQL API data using the V4 SDK
540
-
* Learn about the [Reactor-based Java SDKs](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-pattern-guide.md)
544
+
* Learn about the [Reactor-based Java SDKs](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-pattern-guide.md)
545
+
* Learn about converting RxJava async code to Reactor async code with the [Reactor vs RxJava Guide](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-rxjava-guide.md)
Copy file name to clipboardExpand all lines: articles/cosmos-db/performance-tips-async-java.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ author: anfeldma-ms
5
5
ms.service: cosmos-db
6
6
ms.devlang: java
7
7
ms.topic: conceptual
8
-
ms.date: 05/05/2020
8
+
ms.date: 05/08/2020
9
9
ms.author: anfeldma
10
10
11
11
---
@@ -20,7 +20,7 @@ ms.author: anfeldma
20
20
>
21
21
22
22
> [!IMPORTANT]
23
-
> This is *not* the latest Java SDK for Azure Cosmos DB! Consider using Azure Cosmos DB Java SDK v4 for your project. To upgrade, follow the instructions in the [Migrate to Azure Cosmos DB Java SDK v4](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/migration-guide.md) guide and the [Reactor vs RxJava](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-rxjava-guide.md) guide.
23
+
> This is *not* the latest Java SDK for Azure Cosmos DB! Consider using Azure Cosmos DB Java SDK v4 for your project. To upgrade, follow the instructions in the [Migrate to Azure Cosmos DB Java SDK v4](migrate-java-v4-sdk.md) guide and the [Reactor vs RxJava](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-rxjava-guide.md) guide.
24
24
>
25
25
> The performance tips in this article are for Azure Cosmos DB Async Java SDK v2 only. See the Azure Cosmos DB Async Java SDK v2 [Release notes](sql-api-sdk-async-java.md), [Maven repository](https://mvnrepository.com/artifact/com.microsoft.azure/azure-cosmosdb), and Azure Cosmos DB Async Java SDK v2 [troubleshooting guide](troubleshoot-java-async-sdk.md) for more information.
Copy file name to clipboardExpand all lines: articles/cosmos-db/performance-tips-java-sdk-v4-sql.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ author: anfeldma-ms
5
5
ms.service: cosmos-db
6
6
ms.devlang: java
7
7
ms.topic: conceptual
8
-
ms.date: 05/05/2020
8
+
ms.date: 05/08/2020
9
9
ms.author: anfeldma
10
10
11
11
---
@@ -20,10 +20,10 @@ ms.author: anfeldma
20
20
>
21
21
22
22
> [!IMPORTANT]
23
-
> The performance tips in this article are for Azure Cosmos DB Java SDK v4 only. Please view the Azure Cosmos DB Java SDK v4 Release notes, [Maven repository](https://mvnrepository.com/artifact/com.azure/azure-cosmos), and Azure Cosmos DB Java SDK v4 troubleshooting guide for more information.
23
+
> The performance tips in this article are for Azure Cosmos DB Java SDK v4 only. Please view the Azure Cosmos DB Java SDK v4 Release notes, [Maven repository](https://mvnrepository.com/artifact/com.azure/azure-cosmos), and Azure Cosmos DB Java SDK v4 [troubleshooting guide](troubleshoot-java-sdk-v4-sql.md) for more information. If you are currently using an older version than v4, see the [Migrate to Azure Cosmos DB Java SDK v4](migrate-java-v4-sdk.md) guide for help upgrading to v4.
24
24
>
25
25
26
-
Azure Cosmos DB is a fast and flexible distributed database that scales seamlessly with guaranteed latency and throughput. You do not have to make major architecture changes or write complex code to scale your database with Azure Cosmos DB. Scaling up and down is as easy as making a single API call or SDK method call. However, because Azure Cosmos DB is accessed via network calls there are client-side optimizations you can make to achieve peak performance when using [Azure Cosmos DB Java SDK v4](sql-api-sdk-async-java.md).
26
+
Azure Cosmos DB is a fast and flexible distributed database that scales seamlessly with guaranteed latency and throughput. You do not have to make major architecture changes or write complex code to scale your database with Azure Cosmos DB. Scaling up and down is as easy as making a single API call or SDK method call. However, because Azure Cosmos DB is accessed via network calls there are client-side optimizations you can make to achieve peak performance when using Azure Cosmos DB Java SDK v4.
27
27
28
28
So if you're asking "How can I improve my database performance?" consider the following options:
Copy file name to clipboardExpand all lines: articles/cosmos-db/performance-tips-java.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ author: anfeldma-ms
5
5
ms.service: cosmos-db
6
6
ms.devlang: java
7
7
ms.topic: conceptual
8
-
ms.date: 05/05/2020
8
+
ms.date: 05/08/2020
9
9
ms.author: anfeldma
10
10
11
11
---
@@ -20,7 +20,7 @@ ms.author: anfeldma
20
20
>
21
21
22
22
> [!IMPORTANT]
23
-
> This is *not* the latest Java SDK for Azure Cosmos DB! Consider using Azure Cosmos DB Java SDK v4 for your project. To upgrade, follow the instructions in the [Migrate to Azure Cosmos DB Java SDK v4](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/migration-guide.md) guide and the [Reactor vs RxJava](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-rxjava-guide.md) guide.
23
+
> This is *not* the latest Java SDK for Azure Cosmos DB! Consider using Azure Cosmos DB Java SDK v4 for your project. To upgrade, follow the instructions in the [Migrate to Azure Cosmos DB Java SDK v4](migrate-java-v4-sdk.md) guide and the [Reactor vs RxJava](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-rxjava-guide.md) guide.
24
24
>
25
25
> These performance tips are for Azure Cosmos DB Sync Java SDK v2 only. Please view the Azure Cosmos DB Sync Java SDK v2 [Release notes](sql-api-sdk-java.md) and [Maven repository](https://mvnrepository.com/artifact/com.microsoft.azure/azure-documentdb) for more information.
Copy file name to clipboardExpand all lines: articles/cosmos-db/troubleshoot-java-async-sdk.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,15 +3,15 @@ title: Diagnose and troubleshoot Azure Cosmos DB Async Java SDK v2
3
3
description: Use features like client-side logging and other third-party tools to identify, diagnose, and troubleshoot Azure Cosmos DB issues in Async Java SDK v2.
4
4
author: anfeldma-ms
5
5
ms.service: cosmos-db
6
-
ms.date: 05/04/2020
6
+
ms.date: 05/08/2020
7
7
ms.author: anfeldma
8
8
ms.devlang: java
9
9
ms.subservice: cosmosdb-sql
10
10
ms.topic: troubleshooting
11
11
ms.reviewer: sngun
12
12
---
13
13
14
-
# Troubleshoot issues when you use the Java Async SDK with Azure Cosmos DB SQL API accounts
14
+
# Troubleshoot issues when you use the Azure Cosmos DB Async Java SDK v2 with SQL API accounts
15
15
16
16
> [!div class="op_single_selector"]
17
17
> *[Java SDK v4](troubleshoot-java-sdk-v4-sql.md)
@@ -20,7 +20,7 @@ ms.reviewer: sngun
20
20
>
21
21
22
22
> [!IMPORTANT]
23
-
> This is *not* the latest Java SDK for Azure Cosmos DB! Consider using Azure Cosmos DB Java SDK v4 for your project. Follow the instructions in the [Migrate to Azure Cosmos DB Java SDK v4](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/migration-guide.md) guide and [Reactor vs RxJava](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-rxjava-guide.md) guide to upgrade.
23
+
> This is *not* the latest Java SDK for Azure Cosmos DB! Consider using Azure Cosmos DB Java SDK v4 for your project. Follow the instructions in the [Migrate to Azure Cosmos DB Java SDK v4](migrate-java-v4-sdk.md) guide and [Reactor vs RxJava](https://github.com/Azure-Samples/azure-cosmos-java-sql-api-samples/blob/master/reactor-rxjava-guide.md) guide to upgrade.
24
24
>
25
25
> This article covers troubleshooting for Azure Cosmos DB Async Java SDK v2 only. See the Azure Cosmos DB Async Java SDK v2 [Release Notes](sql-api-sdk-async-java.md), [Maven repository](https://mvnrepository.com/artifact/com.microsoft.azure/azure-cosmosdb) and [performance tips](performance-tips-async-java.md) for more information.
0 commit comments