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

   # Description
   
   Fixes [CAMEL-27757](https://issues.apache.org/jira/browse/CAMEL-27757).
   
   ## Summary
   
   listBuckets returned only the first page of buckets, and a route could not 
page through listObjects. listBuckets now returns every bucket. listObjects now 
sends ListObjectsV2 requests, as the consumer does, and has paging headers.
   
   - `OSSProducer.listBuckets` follows NextMarker, with 1000 buckets per 
request.
   - `OSSProducer.listObjects` asks for at most 999 objects per request, until 
it has maxKeys objects or the listing ends.
   - The new header `CamelAlibabaOssContinuationToken` sets the token of the 
first request, and `CamelAlibabaOssNextContinuationToken` gives the next one.
   - The maxKeys option and header texts give the page size, and the doc page 
says how to page.
   - The upgrade guide has a section on it, in a new guide of 4.25, as 
`camel-4.24.0` is tagged.
   
   ### Why 999 objects per request, and the loop
   
   The ListObjectsV2 API reference gives 1 to 1000, but the Javadoc of 
`ListObjectsV2Request.maxKeys` in alibabacloud-oss-v2 0.6.1 gives 1 to 999. So 
the producer takes 999. listBuckets uses the loop of listObjects rather than 
`listBucketsPaginator`. Its iterator sends the same request again for a 
truncated page without NextMarker.
   
   ## Tests
   
   - `ListBucketsTest` checks two pages of buckets, with 1000 buckets per 
request.
   - Six new tests of `ListObjectsTest` cover two pages, maxKeys below and 
above a page, the headers and a failed call.
   - Each failed before the change, where listBuckets read one page and 
listObjects sent ListObjects requests.
   - The module tests of camel-alibaba-oss ran 37 tests, and CamelCatalogTest 
ran 156 tests, with no failure.
   
   # 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).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] I ran `mvn clean install -Dquickly -DskipTests` in the root folder on 
the parent commit. Then I ran the builds of camel-alibaba-oss, camel-catalog 
with CamelCatalogTest, camel-componentdsl and camel-endpointdsl, and committed 
all generated changes.
   
   # 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.
   
   _Claude Code on behalf of saravanakumar1987_
   
   🤖 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