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
while (!isProcessorRunning.get()); //Wait for Change Feed processor start
112
115
```
113
-
116
+
---
117
+
114
118
```"SampleHost_1"``` is the name of the Change Feed processor worker. ```changeFeedProcessorInstance.start()``` is what actually starts the Change Feed processor.
115
119
116
120
Return to the Azure Portal Data Explorer in your browser. Under the **InventoryContainer-leases** container, click **items** to see its contents. You will see that Change Feed Processor has populated the lease container, i.e. the processor has assigned the ```SampleHost_1``` worker a lease on some partitions of the **InventoryContainer**.
@@ -119,6 +123,8 @@ mvn clean package
119
123
120
124
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
125
126
+
# [Java SDK 4.0](#tab/v4sdk)
127
+
122
128
**Java SDK 4.0**
123
129
```java
124
130
public static ChangeFeedProcessor getChangeFeedProcessor(String hostName, CosmosAsyncContainer feedContainer, CosmosAsyncContainer leaseContainer) {
@@ -145,6 +151,8 @@ mvn clean package
145
151
}
146
152
```
147
153
154
+
# [Java SDK 3.7.0](#tab/v3sdk)
155
+
148
156
**Java SDK 3.7.0**
149
157
```java
150
158
public static ChangeFeedProcessor getChangeFeedProcessor(String hostName, CosmosContainer feedContainer, CosmosContainer leaseContainer) {
@@ -170,6 +178,7 @@ mvn clean package
170
178
typeContainer.upsertItem(document).subscribe();
171
179
}
172
180
```
181
+
---
173
182
174
183
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
184
@@ -185,6 +194,8 @@ mvn clean package
185
194
186
195
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