Skip to content
This repository was archived by the owner on Jul 13, 2026. It is now read-only.

Commit a0b4d03

Browse files
author
Theo van Kraay
committed
add ChangeFeedProcessorOptions variable
1 parent 3cfb8ec commit a0b4d03

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/main/java/com/azure/cosmos/examples/changefeed/SampleChangeFeedProcessor.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.azure.cosmos.examples.common.CustomPOJO2;
1414
import com.azure.cosmos.implementation.Utils;
1515
import com.azure.cosmos.implementation.apachecommons.lang.RandomStringUtils;
16+
import com.azure.cosmos.models.ChangeFeedProcessorOptions;
1617
import com.azure.cosmos.models.CosmosContainerProperties;
1718
import com.azure.cosmos.models.CosmosContainerRequestOptions;
1819
import com.azure.cosmos.models.CosmosContainerResponse;
@@ -21,6 +22,8 @@
2122
import com.fasterxml.jackson.core.JsonProcessingException;
2223
import com.fasterxml.jackson.databind.JsonNode;
2324
import com.fasterxml.jackson.databind.ObjectMapper;
25+
import com.fasterxml.jackson.module.afterburner.asm.Opcodes;
26+
2427
import org.slf4j.Logger;
2528
import org.slf4j.LoggerFactory;
2629
import reactor.core.scheduler.Schedulers;
@@ -49,11 +52,20 @@ public class SampleChangeFeedProcessor {
4952
private static ChangeFeedProcessor changeFeedProcessorInstance;
5053
private static boolean isWorkCompleted = false;
5154

55+
private static ChangeFeedProcessorOptions options;
56+
57+
58+
5259
public static void main(String[] args) {
5360
logger.info("BEGIN Sample");
5461

5562
try {
5663

64+
// <ChangeFeedProcessorOptions>
65+
options = new ChangeFeedProcessorOptions();
66+
options.setStartFromBeginning(false);
67+
// </ChangeFeedProcessorOptions>
68+
5769
//Summary of the next four commands:
5870
//-Create an asynchronous Azure Cosmos DB client and database so that we can issue async requests to the DB
5971
//-Create a "feed container" and a "lease container" in the DB
@@ -129,6 +141,7 @@ public static void main(String[] args) {
129141
public static ChangeFeedProcessor getChangeFeedProcessor(String hostName, CosmosAsyncContainer feedContainer, CosmosAsyncContainer leaseContainer) {
130142
return new ChangeFeedProcessorBuilder()
131143
.hostName(hostName)
144+
.options(options)
132145
.feedContainer(feedContainer)
133146
.leaseContainer(leaseContainer)
134147
.handleChanges((List<JsonNode> docs) -> {

0 commit comments

Comments
 (0)