Mongo Change Stream Enhancer divides Change Stream events into partitions and enables you to handle them in separate Threads, increasing throughput. It achieves that by creating a Change Stream per each partition (number is configurable) and handling each Change Stream in a dedicated Thread.
Library is unprepared for handling delete events, few issues found:
1) It skips them while using default watch pipeline because the expression uses fullDocument which is missing for delete event:
static Bson toDate() {
return new Document("$toDate", "$fullDocument._id");
}
2) After removal of filtering expression, library fails - it is unprepared to handle events without fullDocument, see error:
09:46:19.516 [Thread-1] ERROR com.gravity9.mongocdc.MongoChangeStreamWorker - Exception while processing change
java.lang.NullPointerException: Cannot invoke "org.bson.Document.toJson()" because the return value of "com.mongodb.client.model.changestream.ChangeStreamDocument.getFullDocument()" is null
at com.gravity9.mongocdc.MongoChangeStreamWorker.run(MongoChangeStreamWorker.java:101) [mongo-change-stream-enhancer-1.0.0.jar:?]
at java.base/java.lang.Thread.run(Thread.java:833) [?:?]
Line which fails:
log.info("{} document: {}", document.getOperationType().name(), document.getFullDocument().toJson());
3) There is no failure handling implemented, so NPE is generated indefinitely
Library is unprepared for handling
delete
events, few issues found:1) It skips them while using default watch pipeline because the expression uses fullDocument which is missing for delete event:
2) After removal of filtering expression, library fails - it is unprepared to handle events without fullDocument, see error:
Line which fails:
log.info("{} document: {}", document.getOperationType().name(), document.getFullDocument().toJson());
3) There is no failure handling implemented, so NPE is generated indefinitely