Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.7.0
-
None
-
Unknown
Description
I'm a bit confused how it should be handled when an Exception happens during the watch() in MongoDbChangeStreamsThread.
I observed that the Mongo Client throws an Exception if the collection the watch() is on is deleted (the whole collection) - it that case, this exception is thrown:
Exception in thread "Camel (camel-1) thread #1 - mongodb://mongoConnection" java.lang.NullPointerException at org.apache.camel.component.mongodb.MongoDbChangeStreamsThread.doRun(MongoDbChangeStreamsThread.java:74) at org.apache.camel.component.mongodb.MongoAbstractConsumerThread.run(MongoAbstractConsumerThread.java:68) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:830)
After the exception, Camel keeps running, the route is still "started", but no Changestreams _watch()_es are active - so we are in a strange state.
Exceptions can happen quite often using changeStreams - I think it should be documented how the user should handle this. Or if this is an error and the changestream watch() should be restarted, that should be fixed.