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

   # Description
   
   [CAMEL-27167](https://issues.apache.org/jira/browse/CAMEL-27167)
   
   With `deleteAfterRead`, the `alibaba-oss` consumer took the bucket and the 
key of the object to delete from the `CamelAlibabaOssBucketName` and 
`CamelAlibabaOssObjectKey` headers when the exchange completed. The 
`hwcloud-obs` consumer did the same with `CamelHwCloudObsBucketName` and 
`CamelHwCloudObsObjectKey` for `moveAfterRead` and `deleteAfterRead`.
   
   For `alibaba-oss` the bucket name header is also where the producer takes 
the bucket to write to from (header first, then the exchange property, then the 
endpoint). A route that set it to write a copy of the consumed object to 
another bucket made the consumer delete the object with that key in the other 
bucket, while the consumed object stayed and was consumed again by the next 
poll. The `hwcloud-obs` producer takes its bucket from the exchange property of 
the same name, not from the header, so there only a route that changed the 
headers for another reason copied and deleted another object. With both, a 
route that removed the headers, or replaced the message, deleted nothing, and 
the object was consumed again by every poll.
   
   This is the same defect that CAMEL-27015 (#30168) (aws2-s3, 
azure-storage-blob, aws2-sqs) and CAMEL-27064 (#30227) (google-storage, minio, 
alibaba-mns) fixed in the other object storage consumers, fixed the same way.
   
   Fix: both consumers take the bucket and the key before the exchange is 
routed (where they already took the key to release the in-progress entry) and 
pass them to `processComplete`, which is private in both classes, so there is 
no API change. The `alibaba-oss` page says that the consumer deletes the object 
it consumed whatever the route does with the headers (the `hwcloud-obs` page 
has no consumer section), and the 4.24 upgrade guide has an entry.
   
   Tests: `OSSConsumerDeleteAfterReadTest` and 
`OBSConsumerMoveDeleteAfterReadTest`, with mocked clients as the existing 
`OSSConsumerInProgressTest` / `OBSConsumerInProgressTest` (the 
`DeleteObjectRequest` accessors and the `ObsClient.copyObject(String, String, 
String, String)` / `deleteObject(String, String)` overloads checked with javap 
against the SDK versions of the build). A route that sets the bucket and key 
headers, and a route that removes the headers: the consumer must delete (OBS: 
copy to the destination bucket, then delete) `bucket/a.txt`. Runs (offline, 
with the versions cached on my machine: alibabacloud-oss-v2 0.6.0, 
esdk-obs-java 3.26.6): the four new tests fail on main (the consumed object is 
not deleted, so it is consumed again by every poll: the mock gets about 40 
messages instead of 1) and pass with the fix; camel-alibaba-oss module tests 30 
run, 0 failures; camel-huaweicloud-obs module tests 54 run, 0 failures, 18 
skipped (the `*FunctionalTest` classes that need a
 n OBS account); each new test class 20 times in one JVM: 40 of 40 (OSS) and 40 
of 40 (OBS). A second commit corrects the OBS paragraph of the upgrade guide 
and a comment of the OBS test (the OBS producer reads the bucket from the 
exchange property), docs and comment only.
   
   # 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-27167](https://issues.apache.org/jira/browse/CAMEL-27167).
   
   # 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 the core modules and camel-alibaba-oss and camel-huaweicloud-obs 
with the formatter and import-sort plugins, and copied the component page to 
the catalog. 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