essobedo commented on code in PR #10436:
URL: https://github.com/apache/camel/pull/10436#discussion_r1234167731


##########
components/camel-mongodb/src/test/java/org/apache/camel/component/mongodb/integration/MongoDbChangeStreamsConsumerIT.java:
##########
@@ -109,6 +109,36 @@ public void filterTest() throws Exception {
 
     @Order(3)
     @Test
+    public void updateWithFullDocumentTest() throws Exception {
+        assertEquals(0, mongoCollection.countDocuments());
+        MockEndpoint mock = contextExtension.getMockEndpoint("mock:test");
+        mock.expectedMessageCount(1);
+
+        String consumerRouteId = "updateWithFullDocumentConsumer";
+        context.getRouteController().startRoute(consumerRouteId);
+
+        ObjectId objectId1 = new ObjectId();
+        ObjectId objectId2 = new ObjectId();
+        Executors.newSingleThreadExecutor().submit(() -> {

Review Comment:
   If you don't mind, I would rather prefer to use the common pool instead by 
calling `CompletableFuture.runAsync` like in this commit 
https://github.com/apache/camel/commit/8a33263dee0d6265a970835f1417a6c166838df9



##########
components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbChangeStreamsThread.java:
##########
@@ -34,10 +35,13 @@
 class MongoDbChangeStreamsThread extends MongoAbstractConsumerThread {
     private List<BsonDocument> bsonFilter;
     private BsonDocument resumeToken;
+    private FullDocument fullDocument;
 
-    MongoDbChangeStreamsThread(MongoDbEndpoint endpoint, 
MongoDbChangeStreamsConsumer consumer, List<BsonDocument> bsonFilter) {
+    MongoDbChangeStreamsThread(MongoDbEndpoint endpoint, 
MongoDbChangeStreamsConsumer consumer,
+                               List<BsonDocument> bsonFilter, FullDocument 
fullDocument) {

Review Comment:
   You don't need to add `fullDocument` in the constructor since it is already 
available from the endpoint



##########
components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbEndpoint.java:
##########
@@ -107,6 +107,8 @@ public class MongoDbEndpoint extends DefaultEndpoint {
     private String tailTrackIncreasingField;
     @UriParam(label = "consumer,changeStream")
     private String streamFilter;
+    @UriParam(label = "consumer,changeStream", enums = "default,updateLookup", 
defaultValue = "default")
+    private String fullDocument = "default";

Review Comment:
   Why not use the enum type here instead of String?



##########
components/camel-mongodb/src/main/java/org/apache/camel/component/mongodb/MongoDbChangeStreamsThread.java:
##########
@@ -48,8 +52,8 @@ protected void init() {
     @Override
     protected MongoCursor initializeCursor() {
         ChangeStreamIterable<Document> iterable = bsonFilter != null
-                ? dbCol.watch(bsonFilter)
-                : dbCol.watch();
+                ? dbCol.watch(bsonFilter).fullDocument(fullDocument)
+                : dbCol.watch().fullDocument(fullDocument);

Review Comment:
   Or simply call it only once after, I mean something like `iterable = 
iterable.fullDocument(fullDocument);`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to