Skip to content

Commit 23a8dd7

Browse files
committed
Emphasized RxJava vs Reactor guide; removed Legacy naming; added Azure Cosmos DB prefix; modified wording
1 parent 95f2dab commit 23a8dd7

File tree

1 file changed

+24
-23
lines changed

1 file changed

+24
-23
lines changed

articles/cosmos-db/migrate-java-v4-sdk.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,46 +15,46 @@ ms.reviewer: sngun
1515
> 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).
1616
>
1717
18-
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:
18+
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 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:
1919

20-
* Legacy Sync Java SDK 2.x.x
20+
* Sync Java SDK 2.x.x
2121
* Async Java SDK 2.x.x
2222
* Java SDK 3.x.x
2323

24-
## Java SDK’s and package mappings
24+
## Azure Cosmos DB Java SDK’s and package mappings
2525

2626
The following table lists different Azure Cosmos DB Java SDKs, the package name and the release information:
2727

2828
| Java SDK| Release Date | Bundled APIs | Maven Jar | Java package name |API Reference | Release Notes |
2929
|-------|------|-----------|-----------|--------------|-------------|---------------------------|
3030
| Async 2.x.x | June 2018 | Async(RxJava) | `com.microsoft.azure::azure-cosmosdb` | `com.microsoft.azure.cosmosdb.rx` | [API](https://azure.github.io/azure-cosmosdb-java/2.0.0/) | [Release Notes](sql-api-sdk-async-java.md) |
31-
| Legacy Sync 2.x.x | Sept 2018 | Sync | `com.microsoft.azure::azure-documentdb` | `com.microsoft.azure.cosmosdb` | [API](https://azure.github.io/azure-cosmosdb-java/2.0.0/) | [Release Notes](sql-api-sdk-java.md) |
31+
| Sync 2.x.x | Sept 2018 | Sync | `com.microsoft.azure::azure-documentdb` | `com.microsoft.azure.cosmosdb` | [API](https://azure.github.io/azure-cosmosdb-java/2.0.0/) | [Release Notes](sql-api-sdk-java.md) |
3232
| 3.x.x | July 2019 | Async(Reactor)/Sync | `com.microsoft.azure::azure-cosmos` | `com.azure.data.cosmos` | [API](https://azure.github.io/azure-cosmosdb-java/3.0.0/) | - |
3333
| 4.0 | April 2020 | Async(Reactor)/Sync | `com.azure::azure-cosmos` | `com.azure.cosmos` | - | - |
3434

3535
## SDK level implementation changes
3636

3737
The following are the key implementation differences between different SDKs:
3838

39-
### 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
4040

41-
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.
4242

43-
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.
4444

45-
### 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
4646

47-
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.
4848

4949
## API level changes
5050

51-
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):
5252

5353
![Azure Cosmos DB Java SDK naming conventions](./media/migrate-java-v4-sdk/java-sdk-naming-conventions.png)
5454

55-
* 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.
5656

57-
* 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.
5858

5959
* **Java SDK 4.0** : All the classes belong to the Sync API unless the class name is appended with `Async` after `Cosmos`.
6060

@@ -64,31 +64,31 @@ The following are the API level changes between Java 3.x.x Vs 4.x.x SDK and Asyn
6464

6565
### Hierarchical API structure
6666

67-
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:
6868

6969
```java
7070
CosmosContainer = client.getDatabase("MyDatabaseName").getContainer("MyContainerName");
7171
```
7272

73-
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.
7474

7575
### Representing documents
7676

77-
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.
7878

79-
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.
8080

8181
### Imports
8282

83-
* The Java SDK 4.0 packages begin with `com.azure.cosmos`
84-
* 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`
8585

86-
* 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:
8787

8888
* `CosmosContainerResponse`
8989
* `CosmosDatabaseResponse`
9090
* `CosmosItemResponse`
91-
* The Async API analogs for all the above packages
91+
* The Async API analogs for all of the above packages
9292
* `CosmosContainerProperties`
9393
* `FeedOptions`
9494
* `PartitionKey`
@@ -97,9 +97,9 @@ In the Java SDK 3.x.x, the `CosmosItemProperties` object is exposed by the publi
9797

9898
### Accessors
9999

100-
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.
101101

102-
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.
103103

104104
## Code snippet comparisons
105105

@@ -541,4 +541,5 @@ SalesOrder salesOrder = new SalesOrder(
541541
## Next steps
542542

543543
* [Build a Java app](create-sql-api-java.md) to manage Azure Cosmos DB SQL API data using the V4 SDK
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)
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)

0 commit comments

Comments
 (0)