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

[camel-mongodb] ChangeStreams: Exception not gracefully handled

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.7.0
    • 3.10.0
    • camel-mongodb
    • 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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

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

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment