Skip to content

Commit

Permalink
Everything runs; added explanatory comments in SampleChangeFeedProces…
Browse files Browse the repository at this point in the history
…sor Re: POJO vs JSON for inserting items
  • Loading branch information
anfeldma-ms committed Mar 5, 2020
1 parent ee1bcc2 commit c08471e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .idea/azure-cosmos-java-sql-api-samples.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,7 @@
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-cosmos</artifactId>
<version>4.0.1-beta.1.dev.20200228.2</version>
<exclusions>
<exclusion>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
</exclusion>
</exclusions>
<version>4.0.1-beta.1</version>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,17 @@ public static void main (String[]args) {
CosmosAsyncContainer leaseContainer = createNewLeaseCollection(client, DATABASE_NAME, COLLECTION_NAME + "-leases");

changeFeedProcessorInstance = getChangeFeedProcessor("SampleHost_1", feedContainer, leaseContainer);
System.out.println("Got here\n");
changeFeedProcessorInstance.start()
.subscribeOn(Schedulers.elastic())
.doOnSuccess(aVoid -> {
System.out.println("!doOnSuccess!\n");
createNewDocumentsJSON(feedContainer, 10, Duration.ofSeconds(3));
//Insert 10 documents into the feed container
//createNewDocumentsCustomPOJO demonstrates how to insert a custom POJO into a Cosmos DB container as an item
//createNewDocumentsJSON demonstrates how to insert a JSON object into a Cosmos DB container as an item
createNewDocumentsCustomPOJO(feedContainer, 5, Duration.ofSeconds(3));
createNewDocumentsJSON(feedContainer, 5, Duration.ofSeconds(3));
isWorkCompleted = true;
})
.subscribe();
System.out.println("and here\n");

long remainingWork = WAIT_FOR_WORK;
while (!isWorkCompleted && remainingWork > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.google.common.collect.Lists;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.util.UUID;
Expand Down Expand Up @@ -126,6 +127,8 @@ private void readAllSprocs() throws Exception {

final CountDownLatch completionLatch = new CountDownLatch(1);



fluxResponse.flatMap(storedProcedureProperties -> {
logger.info(String.format("Stored Procedure: %s\n",storedProcedureProperties.getId()));
return Mono.empty();
Expand Down

0 comments on commit c08471e

Please sign in to comment.