allthingssecurity opened a new pull request, #28381: URL: https://github.com/apache/camel/pull/28381
# Description [CAMEL-25859](https://issues.apache.org/jira/browse/CAMEL-25859) `GridFsConsumer` opened the download stream of each file found by a poll by its file name. GridFS keeps several files with the same name (revisions), and `GridFSBucket.openDownloadStream(String)` opens the newest of them. So when one poll found two files with the same name, both exchanges carried the content and the headers (`CamelFileLength`, `CamelFileLastModified`, content type, metadata) of the newest file: the older file was routed with the newer content, its own content was never routed, and with a file attribute strategy it was then marked `done`. A poll finds several files with one name when they are uploaded within one poll delay, when they were uploaded while the consumer was stopped (`PersistentTimestamp`), or when none of them is marked yet (the file attribute strategies, for example at the first start). Change: open the stream by the id of the found file (`openDownloadStream(file.getId())`). The query, the file attribute and the timestamp already work by id and upload date. No option or default changed, so no upgrade guide entry. Tests: - `GridFsConsumerTimestampTest`: the fake bucket now answers `openDownloadStream` as MongoDB does (by name the newest file of that name, by id that file). - New `filesWithTheSameNameAreEachRoutedWithTheirOwnContent`, for each of the 5 query strategies: two files named `report.csv` found by the same poll. Without the change all 5 fail with `expected: <[<first id>, <second id>]> but was: <[<second id>, <second id>]>`; with the change they pass. - camel-mongodb-gridfs unit tests with the change: 20 run, 0 failures. How it was found: a review of the consumers that run their own poll loop, then the JUnit test. What was not run: the ITs (they need Docker), a test against a MongoDB server, the full root build. # 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-25859](https://issues.apache.org/jira/browse/CAMEL-25859). # 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 and tested camel-mongodb-gridfs. No option changed. 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]
