@@ -70,6 +70,8 @@ public static void main(String[] args) {
7070 //on creating a handler for Change Feed events. In this stream, we also trigger the insertion of 10 documents on a separate
7171 //thread.
7272 logger .info ("Start Change Feed Processor on worker (handles changes asynchronously)" );
73+
74+ // <ChangeFeedProcessorBuilder>
7375 ChangeFeedProcessor changeFeedProcessorMainInstance = new ChangeFeedProcessorBuilder ()
7476 .hostName ("SampleHost_1" )
7577 .feedContainer (feedContainer )
@@ -93,6 +95,7 @@ public static void main(String[] args) {
9395 logger .error ("Change feed processor did not start and stopped in the expected time" , ex );
9496 throw ex ;
9597 }
98+ // </ChangeFeedProcessorBuilder>
9699
97100 // Sleeping here because the CFP instance above requires some time to initialize the lease container
98101 // with all the documents that will keep track of the ongoing work.
@@ -151,6 +154,7 @@ public static void main(String[] args) {
151154 // Finally, totalLag should be greater or equal to the number of documents created
152155 logger .info ("Finally total lag is : {}" , totalLag .get ());
153156
157+ // <FinalLag>
154158 totalLag .set (0 );
155159 changeFeedProcessorSideCart .start ().block ();
156160 currentState = changeFeedProcessorSideCart .getCurrentState ();
@@ -163,6 +167,7 @@ public static void main(String[] args) {
163167
164168 // Finally, totalLag should be greater or equal to the number of documents created
165169 logger .info ("Finally total lag is : {}" , totalLag .get ());
170+ // </FinalLag>
166171
167172 Thread .sleep (Duration .ofSeconds (30 ).toMillis ());
168173
@@ -176,6 +181,7 @@ public static void main(String[] args) {
176181 logger .info ("End Sample" );
177182 }
178183
184+ // <HandleChangesWithLag>
179185 private static Consumer <List <JsonNode >> handleChangesWithLag () {
180186 return (List <JsonNode > docs ) -> {
181187 logger .info ("Start handleChangesWithLag()" );
@@ -207,6 +213,7 @@ private static Consumer<List<JsonNode>> handleChangesWithLag() {
207213 logger .info ("End handleChangesWithLag()" );
208214 };
209215 }
216+ // </HandleChangesWithLag>
210217
211218 public static void createNewDocumentsCustomPOJO (CosmosAsyncContainer containerClient , int count ) {
212219 String suffix = UUID .randomUUID ().toString ();
0 commit comments