Skip to content

Commit eea1563

Browse files
committed
Adding tabs
1 parent ffa9d50 commit eea1563

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

articles/cosmos-db/create-sql-api-java-changefeed.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ mvn clean package
119119
120120
1. Press enter again in the terminal. This will trigger 10 documents to be inserted into **InventoryContainer**. Each document insertion appears in the Change Feed as JSON; the following callback code handles these events by mirroring the JSON documents into a materialized view:
121121
122+
# [Java SDK 4.0](#tab/v4sdk)
123+
122124
**Java SDK 4.0**
123125
```java
124126
public static ChangeFeedProcessor getChangeFeedProcessor(String hostName, CosmosAsyncContainer feedContainer, CosmosAsyncContainer leaseContainer) {
@@ -145,6 +147,8 @@ mvn clean package
145147
}
146148
```
147149
150+
# [Java SDK 3.7.0](#tab/v3sdk)
151+
148152
**Java SDK 3.7.0**
149153
```java
150154
public static ChangeFeedProcessor getChangeFeedProcessor(String hostName, CosmosContainer feedContainer, CosmosContainer leaseContainer) {
@@ -170,6 +174,7 @@ mvn clean package
170174
typeContainer.upsertItem(document).subscribe();
171175
}
172176
```
177+
---
173178
174179
1. Allow the code to run 5-10sec. Then return to the Azure Portal Data Explorer and navigate to **InventoryContainer > items**. You should see that items are being inserted into the inventory container; note the partition key (```id```).
175180
@@ -185,6 +190,8 @@ mvn clean package
185190
186191
Hit enter again to call the function ```deleteDocument()``` in the example code. This function, shown below, upserts a new version of the document with ```/ttl == 5```, which sets document Time-To-Live (TTL) to 5sec.
187192
193+
# [Java SDK 4.0](#tab/v4sdk)
194+
188195
**Java SDK 4.0**
189196
```java
190197
public static void deleteDocument() {
@@ -212,6 +219,7 @@ mvn clean package
212219
feedContainer.upsertItem(document,new CosmosItemRequestOptions()).block();
213220
}
214221
```
222+
# [Java SDK 3.7.0](#tab/v3sdk)
215223
216224
**Java SDK 3.7.0**
217225
```java
@@ -240,6 +248,7 @@ mvn clean package
240248
feedContainer.upsertItem(document,new CosmosItemRequestOptions()).block();
241249
}
242250
```
251+
---
243252
244253
The Change Feed ```feedPollDelay``` is set to 100ms; therefore, Change Feed responds to this update almost instantly and calls ```updateInventoryTypeMaterializedView()``` shown above. That last function call will upsert the new document with TTL of 5sec into **InventoryContainer-pktype**.
245254

0 commit comments

Comments
 (0)