Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-16025

[camel-mongodb] ChangeStreams: Exception not gracefully handled

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.7.0
    • Fix Version/s: 3.10.0
    • Component/s: camel-mongodb
    • Labels:
      None
    • Estimated Complexity:
      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.

        Attachments

          Activity

            People

            • Assignee:
              davsclaus Claus Ibsen
              Reporter:
              dario.nuevo Dario Nuevo
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: