allthingssecurity opened a new pull request, #28137:
URL: https://github.com/apache/camel/pull/28137

   # Description
   
   [CAMEL-25789](https://issues.apache.org/jira/browse/CAMEL-25789)
   
   With `streamingUploadMode=true` and `namingStrategy=random`, the stream 
upload producer added the UUID to `keyName` only for the second and later 
files: the first file of every producer was named after `keyName` alone 
(`camel.txt`). The same applied to `namingStrategy=timestamp`. When the route 
or the application started again, the new producer wrote its first file to 
`camel.txt`, and S3 replaced the first file of the previous run. Its messages 
were lost (unless the bucket is versioned), and the exchanges had completed 
normally. Two producers with the same `keyName` collided the same way.
   
   The documentation says the random strategy adds a UUID after `keyName`. It 
also says that restarting from the last part is not needed with the random 
strategy.
   
   Change (in `AWS2S3StreamUploadProducer.fileNameToUpload`): with `random` and 
`timestamp` every upload gets the UUID or the timestamp, the first one too. 
`progressive` is unchanged: its `override` restarting policy replaces earlier 
files by design.
   
   What users can notice: the first file of a producer is now 
`camel-<uuid>.txt` (or `camel-<millis>.txt`) instead of `camel.txt`. Upgrade 
guide (4.24): a note under its own `camel-aws2-s3` heading. The three naming 
strategies are now described in `aws2-s3-streaming.adoc` (and its catalog copy).
   
   Tests:
   - New `AWS2S3StreamUploadRandomNamingRestartTest` (mocked `S3Client` that 
keeps completed objects by key, like a bucket). 
`aProducerStartedAgainDoesNotReplaceTheObjectsOfTheFirstOne` fails without the 
change (`expected: <4> but was: <3>`: the second producer's first file replaced 
`camel.txt`). `everyObjectHasTheKeyNameAndARandomPart` also fails without the 
change (`camel.txt`).
   - `AWSS3NamingStrategyTest` expected the bare `keyName` for part 0. It now 
expects the UUID and the timestamp.
   - With the change the camel-aws2-s3 tests pass: 106 run, 0 failures, 0 
errors, 0 skipped.
   
   What is not changed: two uploads with the `timestamp` strategy that start in 
the same millisecond still get the same name.
   
   What was not run: the full root build; no test against S3.
   
   # 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-25789](https://issues.apache.org/jira/browse/CAMEL-25789).
   
   # 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-aws2-s3, including the formatter and import-sort 
plugins. No option changed; the catalog copy of the edited doc page is updated 
by hand. 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]

Reply via email to