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/create-sql-api-java-changefeed.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -119,6 +119,8 @@ mvn clean package
119
119
120
120
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:
121
121
122
+
# [Java SDK 4.0](#tab/v4sdk)
123
+
122
124
**Java SDK 4.0**
123
125
```java
124
126
public static ChangeFeedProcessor getChangeFeedProcessor(String hostName, CosmosAsyncContainer feedContainer, CosmosAsyncContainer leaseContainer) {
@@ -145,6 +147,8 @@ mvn clean package
145
147
}
146
148
```
147
149
150
+
# [Java SDK 3.7.0](#tab/v3sdk)
151
+
148
152
**Java SDK 3.7.0**
149
153
```java
150
154
public static ChangeFeedProcessor getChangeFeedProcessor(String hostName, CosmosContainer feedContainer, CosmosContainer leaseContainer) {
@@ -170,6 +174,7 @@ mvn clean package
170
174
typeContainer.upsertItem(document).subscribe();
171
175
}
172
176
```
177
+
---
173
178
174
179
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```).
175
180
@@ -185,6 +190,8 @@ mvn clean package
185
190
186
191
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.
The Change Feed ```feedPollDelay``` is set to 100ms; therefore, Change Feed responds to this update almost instantly and calls ```updateInventoryTypeMaterializedView()``` shown above. That last functioncall will upsert the new document with TTL of 5sec into **InventoryContainer-pktype**.
0 commit comments