allthingssecurity opened a new pull request, #29294: URL: https://github.com/apache/camel/pull/29294
# Description [CAMEL-25731](https://issues.apache.org/jira/browse/CAMEL-25731) Follow-up of CAMEL-25679, agreed in the review of #27918. Since CAMEL-25679 the consumer thread of the tailable cursor and change streams consumers (`MongoAbstractConsumerThread`) survives a failure to open a new cursor and tries again after `cursorRegenerationDelay`. While MongoDB cannot be reached, every attempt logged a WARN with the full stack trace, so a longer outage filled the log with the same stack trace. Change (`MongoAbstractConsumerThread.run` only): the thread counts the consecutive failures since a cursor was last opened. - The first failure of a run logs the WARN with the stack trace, as before. - The following ones log a one-line WARN with the message and the number of consecutive failures; the stack trace goes to DEBUG. - When a new cursor is opened after failures, one INFO line says so, and the count starts again. The WARN when the thread is stopping is unchanged. Test (`MongoDbConsumerCursorRegenerationTest`, mocked collection, no server): - New `stackTraceIsLoggedOnlyForTheFirstOfConsecutiveFailures`: the cursor breaks, opening a new one fails three times, then it opens. Four WARN lines, only the first with the stack trace, and one INFO line (`consecutive failures: 4`). Fails on main (four stack traces, no INFO line). - Passes 20 runs in a row (the whole test class 20 times, 100/100). Offline, the camel-mongodb unit tests pass: 23 run, 0 failures (the other tests need a MongoDB server). # Target - [x] I checked that the commit is targeting the correct branch (Camel 4 uses the `main` branch) # Tracking - [x] If this is a large change, bug fix, or code improvement, I checked there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for the change (usually before you start working on it): [CAMEL-25731](https://issues.apache.org/jira/browse/CAMEL-25731). # Apache Camel coding standards and style - [x] I checked that each commit in the pull request has a meaningful subject line and body. - [ ] I have run `mvn clean install -DskipTests` locally from root folder and I have committed all auto-generated changes. (I built camel-mongodb and the modules it depends on, including the formatter and import-sort plugins, and ran the camel-mongodb unit tests. No generated file changes. I did not run the full root build.) # AI-assisted contributions - [x] If this PR includes AI-generated code, commits have proper co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR description identifies the AI tool used. This PR was prepared with Claude Code (Claude Opus 5.5). The commit carries a `Co-Authored-By` trailer. _Claude Code on behalf of allthingssecurity_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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]
