Skip to content

Commit 97a37c5

Browse files
authored
Merge pull request #47 from TheovanKraay/change-feed-processor-tags
add ChangeFeedProcessorOptions variable
2 parents a718580 + ae1fd25 commit 97a37c5

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 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,7 @@
2122
import com.fasterxml.jackson.core.JsonProcessingException;
2223
import com.fasterxml.jackson.databind.JsonNode;
2324
import com.fasterxml.jackson.databind.ObjectMapper;
25+
2426
import org.slf4j.Logger;
2527
import org.slf4j.LoggerFactory;
2628
import reactor.core.scheduler.Schedulers;
@@ -49,11 +51,20 @@ public class SampleChangeFeedProcessor {
4951
private static ChangeFeedProcessor changeFeedProcessorInstance;
5052
private static boolean isWorkCompleted = false;
5153

54+
private static ChangeFeedProcessorOptions options;
55+
56+
57+
5258
public static void main(String[] args) {
5359
logger.info("BEGIN Sample");
5460

5561
try {
5662

63+
// <ChangeFeedProcessorOptions>
64+
options = new ChangeFeedProcessorOptions();
65+
options.setStartFromBeginning(false);
66+
// </ChangeFeedProcessorOptions>
67+
5768
//Summary of the next four commands:
5869
//-Create an asynchronous Azure Cosmos DB client and database so that we can issue async requests to the DB
5970
//-Create a "feed container" and a "lease container" in the DB
@@ -129,6 +140,7 @@ public static void main(String[] args) {
129140
public static ChangeFeedProcessor getChangeFeedProcessor(String hostName, CosmosAsyncContainer feedContainer, CosmosAsyncContainer leaseContainer) {
130141
return new ChangeFeedProcessorBuilder()
131142
.hostName(hostName)
143+
.options(options)
132144
.feedContainer(feedContainer)
133145
.leaseContainer(leaseContainer)
134146
.handleChanges((List<JsonNode> docs) -> {

0 commit comments

Comments
 (0)