This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 3f16ecd3a5fa CAMEL-27757: camel-alibaba-oss - list every bucket, and 
page through listObjects with ListObjectsV2 (#31081)
3f16ecd3a5fa is described below

commit 3f16ecd3a5fac618ce685b83f8145a2a98e83c8e
Author: Saravanakumar Selvaraj <[email protected]>
AuthorDate: Mon Nov 30 13:34:46 2026 +0000

    CAMEL-27757: camel-alibaba-oss - list every bucket, and page through 
listObjects with ListObjectsV2 (#31081)
    
    * CAMEL-27757: camel-alibaba-oss - list every bucket, and page through 
listObjects with ListObjectsV2
    * CAMEL-27757: camel-alibaba-oss - end the loops of listBuckets and 
listObjects at their break only
    * CAMEL-27757: camel-alibaba-oss - complete the doc sentence on listObjects 
and the comment on 999
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 .../camel/catalog/components/alibaba-oss.json      |  22 +--
 .../camel/catalog/docs/alibaba-oss-component.adoc  |   4 +
 .../camel/component/alibaba/oss/alibaba-oss.json   |  22 +--
 .../src/main/docs/alibaba-oss-component.adoc       |   4 +
 .../camel/component/alibaba/oss/OSSEndpoint.java   |   2 +-
 .../camel/component/alibaba/oss/OSSProducer.java   |  69 +++++++---
 .../alibaba/oss/constants/OSSHeaders.java          |  18 ++-
 .../alibaba/oss/constants/OSSProperties.java       |   1 +
 .../component/alibaba/oss/ListBucketsTest.java     |  79 +++++++++++
 .../component/alibaba/oss/ListObjectsTest.java     | 149 ++++++++++++++++++++-
 .../ROOT/pages/camel-4x-upgrade-guide-4_25.adoc    |  16 +++
 .../endpoint/dsl/OSSEndpointBuilderFactory.java    |  53 ++++++--
 12 files changed, 380 insertions(+), 59 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-oss.json
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-oss.json
index 587a5cc36099..a48a2d2f6554 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-oss.json
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/alibaba-oss.json
@@ -37,15 +37,17 @@
     "CamelAlibabaOssSourceBucketName": { "index": 3, "kind": "header", 
"displayName": "", "group": "producer", "label": "producer", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The name of the source bucket for copyObject, which requires 
it. If this header is not set, the producer uses an exchange property of the 
same name.", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#SOURCE_BUCKET_NAME"
 },
     "CamelAlibabaOssSourceObjectName": { "index": 4, "kind": "header", 
"displayName": "", "group": "producer", "label": "producer", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The name of the source object for copyObject, which requires 
it. If this header is not set, the producer uses an exchange property of the 
same name.", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#SOURCE_OBJECT_NAME"
 },
     "CamelAlibabaOssPrefix": { "index": 5, "kind": "header", "displayName": 
"", "group": "producer", "label": "producer", "required": false, "javaType": 
"String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The prefix of the names of the objects that listObjects 
returns. An exchange property of the same name replaces the prefix option for 
the producer, and this header replaces both.", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeade [...]
-    "CamelAlibabaOssMaxKeys": { "index": 6, "kind": "header", "displayName": 
"", "group": "producer", "label": "producer", "required": false, "javaType": 
"Integer", "deprecated": false, "autowired": false, "secret": false, 
"description": "The maximum number of objects that listObjects returns. An 
exchange property of the same name replaces the maxKeys option, and this header 
replaces both.", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#MAX_KEYS" },
-    "CamelAlibabaOssObjectKey": { "index": 7, "kind": "header", "displayName": 
"", "group": "common", "label": "common", "required": false, "javaType": 
"String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The key that the object is stored under", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#OBJECT_KEY" },
-    "CamelAlibabaOssLastModified": { "index": 8, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The date and time that the object was last modified", 
"constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#LAST_MODIFIED" },
-    "CamelAlibabaOssETag": { "index": 9, "kind": "header", "displayName": "", 
"group": "common", "label": "common", "required": false, "javaType": "String", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
entity tag (ETag) of the object, which identifies its content. It is the MD5 
hash of the content only for an object created by PutObject.", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#ETAG" },
-    "CamelAlibabaOssContentMD5": { "index": 10, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The 128-bit Base64-encoded digest of the object", 
"constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#CONTENT_MD5" },
-    "CamelAlibabaOssObjectType": { "index": 11, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "Shows whether the object is a file or a folder", 
"constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#OBJECT_TYPE" },
-    "CamelAlibabaOssContentLength": { "index": 12, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "Long", "deprecated": false, "autowired": false, "secret": false, 
"description": "The size of the object body in bytes", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#CONTENT_LENGTH" },
-    "CamelAlibabaOssContentType": { "index": 13, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The type of content stored in the object", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#CONTENT_TYPE" },
-    "CamelFileName": { "index": 14, "kind": "header", "displayName": "", 
"group": "common", "label": "common", "required": false, "javaType": "String", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
name of the object. The consumer sets it for a consumed object, and the 
producer for getObject.", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#FILE_NAME" }
+    "CamelAlibabaOssMaxKeys": { "index": 6, "kind": "header", "displayName": 
"", "group": "producer", "label": "producer", "required": false, "javaType": 
"Integer", "deprecated": false, "autowired": false, "secret": false, 
"description": "The maximum number of objects that listObjects returns. The 
producer asks for at most 999 objects per request. An exchange property of the 
same name replaces the maxKeys option, and this header replaces both.", 
"constantName": "org.apache.camel.componen [...]
+    "CamelAlibabaOssContinuationToken": { "index": 7, "kind": "header", 
"displayName": "", "group": "producer", "label": "producer", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The continuation token from which listObjects starts. The 
CamelAlibabaOssNextContinuationToken header of an earlier listObjects holds it. 
If this header is not set, the producer uses an exchange property of the same 
name.", "constantName": "org [...]
+    "CamelAlibabaOssNextContinuationToken": { "index": 8, "kind": "header", 
"displayName": "", "group": "producer", "label": "producer", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The continuation token for the next objects, to set as the 
CamelAlibabaOssContinuationToken header of the next listObjects. The producer 
sets it for listObjects when more objects match, and removes it otherwise.", 
"constantName": "org.apach [...]
+    "CamelAlibabaOssObjectKey": { "index": 9, "kind": "header", "displayName": 
"", "group": "common", "label": "common", "required": false, "javaType": 
"String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The key that the object is stored under", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#OBJECT_KEY" },
+    "CamelAlibabaOssLastModified": { "index": 10, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The date and time that the object was last modified", 
"constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#LAST_MODIFIED" },
+    "CamelAlibabaOssETag": { "index": 11, "kind": "header", "displayName": "", 
"group": "common", "label": "common", "required": false, "javaType": "String", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
entity tag (ETag) of the object, which identifies its content. It is the MD5 
hash of the content only for an object created by PutObject.", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#ETAG" },
+    "CamelAlibabaOssContentMD5": { "index": 12, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The 128-bit Base64-encoded digest of the object", 
"constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#CONTENT_MD5" },
+    "CamelAlibabaOssObjectType": { "index": 13, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "Shows whether the object is a file or a folder", 
"constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#OBJECT_TYPE" },
+    "CamelAlibabaOssContentLength": { "index": 14, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "Long", "deprecated": false, "autowired": false, "secret": false, 
"description": "The size of the object body in bytes", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#CONTENT_LENGTH" },
+    "CamelAlibabaOssContentType": { "index": 15, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The type of content stored in the object", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#CONTENT_TYPE" },
+    "CamelFileName": { "index": 16, "kind": "header", "displayName": "", 
"group": "common", "label": "common", "required": false, "javaType": "String", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
name of the object. The consumer sets it for a consumed object, and the 
producer for getObject.", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#FILE_NAME" }
   },
   "bodyTypes": {
     "consumerOut": { "carriers": [ "bytes" ], "javaType": "byte[]", 
"byOption": [ { "option": "includeBody", "value": "false", "carriers": [ 
"stream" ] } ], "description": "The content of the object as a byte array, one 
message per object, with its bucket, key and metadata in headers. With 
includeBody=false the stream of the content of the object, which is closed when 
the exchange is done" },
@@ -65,7 +67,7 @@
     "exceptionHandler": { "index": 9, "kind": "parameter", "displayName": 
"Exception Handler", "group": "consumer (advanced)", "label": 
"consumer,advanced", "required": false, "type": "object", "javaType": 
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", 
"deprecated": false, "autowired": false, "secret": false, "description": "To 
let the consumer use a custom ExceptionHandler. Notice if the option 
bridgeErrorHandler is enabled then this option is not in use. By def [...]
     "exchangePattern": { "index": 10, "kind": "parameter", "displayName": 
"Exchange Pattern", "group": "consumer (advanced)", "label": 
"consumer,advanced", "required": false, "type": "enum", "javaType": 
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], 
"deprecated": false, "autowired": false, "secret": false, "description": "Sets 
the exchange pattern when the consumer creates an exchange." },
     "pollStrategy": { "index": 11, "kind": "parameter", "displayName": "Poll 
Strategy", "group": "consumer (advanced)", "label": "consumer,advanced", 
"required": false, "type": "object", "javaType": 
"org.apache.camel.spi.PollingConsumerPollStrategy", "deprecated": false, 
"autowired": false, "secret": false, "description": "A pluggable 
org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your 
custom implementation to control error handling usually occurred during the po 
[...]
-    "maxKeys": { "index": 12, "kind": "parameter", "displayName": "Max Keys", 
"group": "producer", "label": "producer", "required": false, "type": "integer", 
"javaType": "java.lang.Integer", "deprecated": false, "autowired": false, 
"secret": false, "description": "The maximum number of objects that the 
producer returns for listObjects, or all of them if no value is set. Object 
Storage Service accepts a value of at most 1000. The CamelAlibabaOssMaxKeys 
exchange property replaces this opti [...]
+    "maxKeys": { "index": 12, "kind": "parameter", "displayName": "Max Keys", 
"group": "producer", "label": "producer", "required": false, "type": "integer", 
"javaType": "java.lang.Integer", "deprecated": false, "autowired": false, 
"secret": false, "description": "The maximum number of objects that the 
producer returns for listObjects, or all of them if no value is set. The 
producer asks for at most 999 objects per request. The CamelAlibabaOssMaxKeys 
exchange property replaces this optio [...]
     "objectName": { "index": 13, "kind": "parameter", "displayName": "Object 
Name", "group": "producer", "label": "producer", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The name of the object for the 
producer, or of the destination object for copyObject. The 
CamelAlibabaOssObjectName exchange property replaces this option, and a header 
of the same name replaces both." },
     "operation": { "index": 14, "kind": "parameter", "displayName": 
"Operation", "group": "producer", "label": "producer", "required": false, 
"type": "enum", "javaType": "java.lang.String", "enum": [ "listBuckets", 
"listObjects", "putObject", "getObject", "deleteObject", "copyObject", 
"headObject" ], "deprecated": false, "autowired": false, "secret": false, 
"description": "The operation that the producer performs. The 
CamelAlibabaOssOperation exchange property replaces this option, and a [...]
     "lazyStartProducer": { "index": 15, "kind": "parameter", "displayName": 
"Lazy Start Producer", "group": "producer (advanced)", "label": 
"producer,advanced", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Whether the producer should be started 
lazy (on the first message). By starting lazy you can use this to allow 
CamelContext and routes to startup in situations where a produ [...]
diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-oss-component.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-oss-component.adoc
index 90435a866484..6566fd4d5e3b 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-oss-component.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/alibaba-oss-component.adoc
@@ -54,6 +54,10 @@ include::partial$component-endpoint-headers.adoc[]
 - copyObject - source and destination bucket/object names are *required*
 - headObject - `bucketName` and `objectName` parameters are *required*
 
+=== Listing buckets and objects
+
+`listBuckets` returns every bucket, and `listObjects` returns every matching 
object, or at most `maxKeys` of them. When more objects match, `listObjects` 
sets the `CamelAlibabaOssNextContinuationToken` header. Set its value as the 
`CamelAlibabaOssContinuationToken` header of the next `listObjects` to list the 
next objects.
+
 === Consumer
 
 The consumer polls objects from a bucket using `listObjectsV2`, downloads each 
object body, and optionally deletes objects after they have been processed when 
`deleteAfterRead` is enabled.
diff --git 
a/components/camel-alibaba/camel-alibaba-oss/src/generated/resources/META-INF/org/apache/camel/component/alibaba/oss/alibaba-oss.json
 
b/components/camel-alibaba/camel-alibaba-oss/src/generated/resources/META-INF/org/apache/camel/component/alibaba/oss/alibaba-oss.json
index 587a5cc36099..a48a2d2f6554 100644
--- 
a/components/camel-alibaba/camel-alibaba-oss/src/generated/resources/META-INF/org/apache/camel/component/alibaba/oss/alibaba-oss.json
+++ 
b/components/camel-alibaba/camel-alibaba-oss/src/generated/resources/META-INF/org/apache/camel/component/alibaba/oss/alibaba-oss.json
@@ -37,15 +37,17 @@
     "CamelAlibabaOssSourceBucketName": { "index": 3, "kind": "header", 
"displayName": "", "group": "producer", "label": "producer", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The name of the source bucket for copyObject, which requires 
it. If this header is not set, the producer uses an exchange property of the 
same name.", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#SOURCE_BUCKET_NAME"
 },
     "CamelAlibabaOssSourceObjectName": { "index": 4, "kind": "header", 
"displayName": "", "group": "producer", "label": "producer", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The name of the source object for copyObject, which requires 
it. If this header is not set, the producer uses an exchange property of the 
same name.", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#SOURCE_OBJECT_NAME"
 },
     "CamelAlibabaOssPrefix": { "index": 5, "kind": "header", "displayName": 
"", "group": "producer", "label": "producer", "required": false, "javaType": 
"String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The prefix of the names of the objects that listObjects 
returns. An exchange property of the same name replaces the prefix option for 
the producer, and this header replaces both.", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeade [...]
-    "CamelAlibabaOssMaxKeys": { "index": 6, "kind": "header", "displayName": 
"", "group": "producer", "label": "producer", "required": false, "javaType": 
"Integer", "deprecated": false, "autowired": false, "secret": false, 
"description": "The maximum number of objects that listObjects returns. An 
exchange property of the same name replaces the maxKeys option, and this header 
replaces both.", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#MAX_KEYS" },
-    "CamelAlibabaOssObjectKey": { "index": 7, "kind": "header", "displayName": 
"", "group": "common", "label": "common", "required": false, "javaType": 
"String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The key that the object is stored under", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#OBJECT_KEY" },
-    "CamelAlibabaOssLastModified": { "index": 8, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The date and time that the object was last modified", 
"constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#LAST_MODIFIED" },
-    "CamelAlibabaOssETag": { "index": 9, "kind": "header", "displayName": "", 
"group": "common", "label": "common", "required": false, "javaType": "String", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
entity tag (ETag) of the object, which identifies its content. It is the MD5 
hash of the content only for an object created by PutObject.", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#ETAG" },
-    "CamelAlibabaOssContentMD5": { "index": 10, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The 128-bit Base64-encoded digest of the object", 
"constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#CONTENT_MD5" },
-    "CamelAlibabaOssObjectType": { "index": 11, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "Shows whether the object is a file or a folder", 
"constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#OBJECT_TYPE" },
-    "CamelAlibabaOssContentLength": { "index": 12, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "Long", "deprecated": false, "autowired": false, "secret": false, 
"description": "The size of the object body in bytes", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#CONTENT_LENGTH" },
-    "CamelAlibabaOssContentType": { "index": 13, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The type of content stored in the object", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#CONTENT_TYPE" },
-    "CamelFileName": { "index": 14, "kind": "header", "displayName": "", 
"group": "common", "label": "common", "required": false, "javaType": "String", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
name of the object. The consumer sets it for a consumed object, and the 
producer for getObject.", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#FILE_NAME" }
+    "CamelAlibabaOssMaxKeys": { "index": 6, "kind": "header", "displayName": 
"", "group": "producer", "label": "producer", "required": false, "javaType": 
"Integer", "deprecated": false, "autowired": false, "secret": false, 
"description": "The maximum number of objects that listObjects returns. The 
producer asks for at most 999 objects per request. An exchange property of the 
same name replaces the maxKeys option, and this header replaces both.", 
"constantName": "org.apache.camel.componen [...]
+    "CamelAlibabaOssContinuationToken": { "index": 7, "kind": "header", 
"displayName": "", "group": "producer", "label": "producer", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The continuation token from which listObjects starts. The 
CamelAlibabaOssNextContinuationToken header of an earlier listObjects holds it. 
If this header is not set, the producer uses an exchange property of the same 
name.", "constantName": "org [...]
+    "CamelAlibabaOssNextContinuationToken": { "index": 8, "kind": "header", 
"displayName": "", "group": "producer", "label": "producer", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The continuation token for the next objects, to set as the 
CamelAlibabaOssContinuationToken header of the next listObjects. The producer 
sets it for listObjects when more objects match, and removes it otherwise.", 
"constantName": "org.apach [...]
+    "CamelAlibabaOssObjectKey": { "index": 9, "kind": "header", "displayName": 
"", "group": "common", "label": "common", "required": false, "javaType": 
"String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The key that the object is stored under", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#OBJECT_KEY" },
+    "CamelAlibabaOssLastModified": { "index": 10, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The date and time that the object was last modified", 
"constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#LAST_MODIFIED" },
+    "CamelAlibabaOssETag": { "index": 11, "kind": "header", "displayName": "", 
"group": "common", "label": "common", "required": false, "javaType": "String", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
entity tag (ETag) of the object, which identifies its content. It is the MD5 
hash of the content only for an object created by PutObject.", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#ETAG" },
+    "CamelAlibabaOssContentMD5": { "index": 12, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The 128-bit Base64-encoded digest of the object", 
"constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#CONTENT_MD5" },
+    "CamelAlibabaOssObjectType": { "index": 13, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "Shows whether the object is a file or a folder", 
"constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#OBJECT_TYPE" },
+    "CamelAlibabaOssContentLength": { "index": 14, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "Long", "deprecated": false, "autowired": false, "secret": false, 
"description": "The size of the object body in bytes", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#CONTENT_LENGTH" },
+    "CamelAlibabaOssContentType": { "index": 15, "kind": "header", 
"displayName": "", "group": "common", "label": "common", "required": false, 
"javaType": "String", "deprecated": false, "autowired": false, "secret": false, 
"description": "The type of content stored in the object", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#CONTENT_TYPE" },
+    "CamelFileName": { "index": 16, "kind": "header", "displayName": "", 
"group": "common", "label": "common", "required": false, "javaType": "String", 
"deprecated": false, "autowired": false, "secret": false, "description": "The 
name of the object. The consumer sets it for a consumed object, and the 
producer for getObject.", "constantName": 
"org.apache.camel.component.alibaba.oss.constants.OSSHeaders#FILE_NAME" }
   },
   "bodyTypes": {
     "consumerOut": { "carriers": [ "bytes" ], "javaType": "byte[]", 
"byOption": [ { "option": "includeBody", "value": "false", "carriers": [ 
"stream" ] } ], "description": "The content of the object as a byte array, one 
message per object, with its bucket, key and metadata in headers. With 
includeBody=false the stream of the content of the object, which is closed when 
the exchange is done" },
@@ -65,7 +67,7 @@
     "exceptionHandler": { "index": 9, "kind": "parameter", "displayName": 
"Exception Handler", "group": "consumer (advanced)", "label": 
"consumer,advanced", "required": false, "type": "object", "javaType": 
"org.apache.camel.spi.ExceptionHandler", "optionalPrefix": "consumer.", 
"deprecated": false, "autowired": false, "secret": false, "description": "To 
let the consumer use a custom ExceptionHandler. Notice if the option 
bridgeErrorHandler is enabled then this option is not in use. By def [...]
     "exchangePattern": { "index": 10, "kind": "parameter", "displayName": 
"Exchange Pattern", "group": "consumer (advanced)", "label": 
"consumer,advanced", "required": false, "type": "enum", "javaType": 
"org.apache.camel.ExchangePattern", "enum": [ "InOnly", "InOut" ], 
"deprecated": false, "autowired": false, "secret": false, "description": "Sets 
the exchange pattern when the consumer creates an exchange." },
     "pollStrategy": { "index": 11, "kind": "parameter", "displayName": "Poll 
Strategy", "group": "consumer (advanced)", "label": "consumer,advanced", 
"required": false, "type": "object", "javaType": 
"org.apache.camel.spi.PollingConsumerPollStrategy", "deprecated": false, 
"autowired": false, "secret": false, "description": "A pluggable 
org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your 
custom implementation to control error handling usually occurred during the po 
[...]
-    "maxKeys": { "index": 12, "kind": "parameter", "displayName": "Max Keys", 
"group": "producer", "label": "producer", "required": false, "type": "integer", 
"javaType": "java.lang.Integer", "deprecated": false, "autowired": false, 
"secret": false, "description": "The maximum number of objects that the 
producer returns for listObjects, or all of them if no value is set. Object 
Storage Service accepts a value of at most 1000. The CamelAlibabaOssMaxKeys 
exchange property replaces this opti [...]
+    "maxKeys": { "index": 12, "kind": "parameter", "displayName": "Max Keys", 
"group": "producer", "label": "producer", "required": false, "type": "integer", 
"javaType": "java.lang.Integer", "deprecated": false, "autowired": false, 
"secret": false, "description": "The maximum number of objects that the 
producer returns for listObjects, or all of them if no value is set. The 
producer asks for at most 999 objects per request. The CamelAlibabaOssMaxKeys 
exchange property replaces this optio [...]
     "objectName": { "index": 13, "kind": "parameter", "displayName": "Object 
Name", "group": "producer", "label": "producer", "required": false, "type": 
"string", "javaType": "java.lang.String", "deprecated": false, "autowired": 
false, "secret": false, "description": "The name of the object for the 
producer, or of the destination object for copyObject. The 
CamelAlibabaOssObjectName exchange property replaces this option, and a header 
of the same name replaces both." },
     "operation": { "index": 14, "kind": "parameter", "displayName": 
"Operation", "group": "producer", "label": "producer", "required": false, 
"type": "enum", "javaType": "java.lang.String", "enum": [ "listBuckets", 
"listObjects", "putObject", "getObject", "deleteObject", "copyObject", 
"headObject" ], "deprecated": false, "autowired": false, "secret": false, 
"description": "The operation that the producer performs. The 
CamelAlibabaOssOperation exchange property replaces this option, and a [...]
     "lazyStartProducer": { "index": 15, "kind": "parameter", "displayName": 
"Lazy Start Producer", "group": "producer (advanced)", "label": 
"producer,advanced", "required": false, "type": "boolean", "javaType": 
"boolean", "deprecated": false, "autowired": false, "secret": false, 
"defaultValue": false, "description": "Whether the producer should be started 
lazy (on the first message). By starting lazy you can use this to allow 
CamelContext and routes to startup in situations where a produ [...]
diff --git 
a/components/camel-alibaba/camel-alibaba-oss/src/main/docs/alibaba-oss-component.adoc
 
b/components/camel-alibaba/camel-alibaba-oss/src/main/docs/alibaba-oss-component.adoc
index 90435a866484..6566fd4d5e3b 100644
--- 
a/components/camel-alibaba/camel-alibaba-oss/src/main/docs/alibaba-oss-component.adoc
+++ 
b/components/camel-alibaba/camel-alibaba-oss/src/main/docs/alibaba-oss-component.adoc
@@ -54,6 +54,10 @@ include::partial$component-endpoint-headers.adoc[]
 - copyObject - source and destination bucket/object names are *required*
 - headObject - `bucketName` and `objectName` parameters are *required*
 
+=== Listing buckets and objects
+
+`listBuckets` returns every bucket, and `listObjects` returns every matching 
object, or at most `maxKeys` of them. When more objects match, `listObjects` 
sets the `CamelAlibabaOssNextContinuationToken` header. Set its value as the 
`CamelAlibabaOssContinuationToken` header of the next `listObjects` to list the 
next objects.
+
 === Consumer
 
 The consumer polls objects from a bucket using `listObjectsV2`, downloads each 
object body, and optionally deletes objects after they have been processed when 
`deleteAfterRead` is enabled.
diff --git 
a/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSEndpoint.java
 
b/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSEndpoint.java
index edbaaebd8048..db87ed0def59 100644
--- 
a/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSEndpoint.java
+++ 
b/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSEndpoint.java
@@ -121,7 +121,7 @@ public class OSSEndpoint extends ScheduledPollEndpoint {
     private String prefix;
 
     @UriParam(description = "The maximum number of objects that the producer 
returns for listObjects, or all of them if no"
-                            + " value is set. Object Storage Service accepts a 
value of at most 1000. The"
+                            + " value is set. The producer asks for at most 
999 objects per request. The"
                             + " CamelAlibabaOssMaxKeys exchange property 
replaces this option, and a header of the same name"
                             + " replaces both.",
               displayName = "Max Keys",
diff --git 
a/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSProducer.java
 
b/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSProducer.java
index 19e580e12372..34ff9a2abbc7 100644
--- 
a/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSProducer.java
+++ 
b/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/OSSProducer.java
@@ -35,15 +35,18 @@ import com.aliyun.sdk.service.oss2.models.HeadObjectRequest;
 import com.aliyun.sdk.service.oss2.models.HeadObjectResult;
 import com.aliyun.sdk.service.oss2.models.ListBucketsRequest;
 import com.aliyun.sdk.service.oss2.models.ListBucketsResult;
-import com.aliyun.sdk.service.oss2.models.ListObjectsRequest;
-import com.aliyun.sdk.service.oss2.models.ListObjectsResult;
+import com.aliyun.sdk.service.oss2.models.ListObjectsV2Request;
+import com.aliyun.sdk.service.oss2.models.ListObjectsV2Result;
 import com.aliyun.sdk.service.oss2.models.ObjectSummary;
 import com.aliyun.sdk.service.oss2.models.PutObjectRequest;
 import com.aliyun.sdk.service.oss2.models.PutObjectResult;
 import com.aliyun.sdk.service.oss2.transport.BinaryData;
 import org.apache.camel.Exchange;
 import org.apache.camel.WrappedFile;
+import org.apache.camel.component.alibaba.common.OpenApiClientSupport;
+import org.apache.camel.component.alibaba.oss.constants.OSSHeaders;
 import org.apache.camel.component.alibaba.oss.constants.OSSOperations;
+import org.apache.camel.component.alibaba.oss.constants.OSSProperties;
 import org.apache.camel.component.alibaba.oss.models.ClientConfigurations;
 import org.apache.camel.support.DefaultProducer;
 import org.apache.camel.util.ObjectHelper;
@@ -52,6 +55,11 @@ import org.slf4j.LoggerFactory;
 
 public class OSSProducer extends DefaultProducer {
     private static final Logger LOG = 
LoggerFactory.getLogger(OSSProducer.class);
+    // the ListBuckets API reference and the Javadoc of 
ListBucketsRequest.maxKeys give 1 to 1000
+    private static final long MAX_KEYS_PER_LIST_BUCKETS = 1000L;
+    // the ListObjectsV2 API reference gives 1 to 1000, and the Javadoc of 
ListObjectsV2Request.maxKeys gives 1 to 999,
+    // so 999 is the largest value that both allow
+    private static final long MAX_KEYS_PER_LIST_OBJECTS = 999L;
 
     private final OSSEndpoint endpoint;
     private OSSClient ossClient;
@@ -180,43 +188,57 @@ public class OSSProducer extends DefaultProducer {
     }
 
     private void listBuckets(Exchange exchange) {
-        ListBucketsResult response = 
ossClient.listBuckets(ListBucketsRequest.newBuilder().build());
+        ListBucketsRequest request = 
ListBucketsRequest.newBuilder().maxKeys(MAX_KEYS_PER_LIST_BUCKETS).build();
         List<Map<String, Object>> buckets = new ArrayList<>();
-        if (response.buckets() != null) {
-            for (BucketSummary bucket : response.buckets()) {
-                Map<String, Object> bucketMap = new HashMap<>();
-                bucketMap.put("name", bucket.name());
-                bucketMap.put("region", bucket.region());
-                bucketMap.put("storageClass", bucket.storageClass());
-                buckets.add(bucketMap);
+        ListBucketsResult response;
+        while (true) {
+            response = ossClient.listBuckets(request);
+            if (response.buckets() != null) {
+                for (BucketSummary bucket : response.buckets()) {
+                    Map<String, Object> bucketMap = new HashMap<>();
+                    bucketMap.put("name", bucket.name());
+                    bucketMap.put("region", bucket.region());
+                    bucketMap.put("storageClass", bucket.storageClass());
+                    buckets.add(bucketMap);
+                }
+            }
+            if (Boolean.TRUE.equals(response.isTruncated()) && 
ObjectHelper.isNotEmpty(response.nextMarker())) {
+                request = 
request.toBuilder().marker(response.nextMarker()).build();
+            } else {
+                break;
             }
         }
         exchange.getMessage().setBody(buckets);
     }
 
     private void listObjects(Exchange exchange, ClientConfigurations 
clientConfigurations) {
+        // the header of an earlier listObjects must not stay, also when this 
one fails
+        exchange.getMessage().removeHeader(OSSHeaders.NEXT_CONTINUATION_TOKEN);
         if (ObjectHelper.isEmpty(clientConfigurations.bucketName())) {
             throw new IllegalArgumentException("Bucket name is mandatory to 
list objects");
         }
 
-        ListObjectsRequest.Builder requestBuilder = 
ListObjectsRequest.newBuilder()
+        ListObjectsV2Request.Builder requestBuilder = 
ListObjectsV2Request.newBuilder()
                 .bucket(clientConfigurations.bucketName());
 
         if (ObjectHelper.isNotEmpty(clientConfigurations.prefix())) {
             requestBuilder.prefix(clientConfigurations.prefix());
         }
-        if (clientConfigurations.maxKeys() != null) {
-            requestBuilder.maxKeys(clientConfigurations.maxKeys().longValue());
+        String continuationToken = 
OpenApiClientSupport.resolveString(exchange, OSSProperties.CONTINUATION_TOKEN, 
null);
+        if (ObjectHelper.isNotEmpty(continuationToken)) {
+            requestBuilder.continuationToken(continuationToken);
         }
 
         List<Map<String, Object>> objects = new ArrayList<>();
-        ListObjectsResult result;
-        ListObjectsRequest request = requestBuilder.build();
+        ListObjectsV2Result result;
         long maxKeysLimit = clientConfigurations.maxKeys() != null
                 ? clientConfigurations.maxKeys().longValue()
                 : Long.MAX_VALUE;
-        do {
-            result = ossClient.listObjects(request);
+        // each request asks for at most 999 objects, and for no more than the 
producer still has to return
+        ListObjectsV2Request request = 
requestBuilder.maxKeys(Math.min(MAX_KEYS_PER_LIST_OBJECTS, 
maxKeysLimit)).build();
+        String nextContinuationToken;
+        while (true) {
+            result = ossClient.listObjectsV2(request);
             if (result.contents() != null) {
                 for (ObjectSummary summary : result.contents()) {
                     if (objects.size() >= maxKeysLimit) {
@@ -231,17 +253,24 @@ public class OSSProducer extends DefaultProducer {
                     objects.add(objectMap);
                 }
             }
+            nextContinuationToken = Boolean.TRUE.equals(result.isTruncated()) 
? result.nextContinuationToken() : null;
             if (objects.size() >= maxKeysLimit) {
                 break;
             }
-            if (Boolean.TRUE.equals(result.isTruncated()) && 
result.nextMarker() != null) {
-                request = 
request.toBuilder().marker(result.nextMarker()).build();
+            if (ObjectHelper.isNotEmpty(nextContinuationToken)) {
+                request = request.toBuilder()
+                        .continuationToken(nextContinuationToken)
+                        .maxKeys(Math.min(MAX_KEYS_PER_LIST_OBJECTS, 
maxKeysLimit - objects.size()))
+                        .build();
             } else {
                 break;
             }
-        } while (Boolean.TRUE.equals(result.isTruncated()));
+        }
 
         exchange.getMessage().setBody(objects);
+        if (ObjectHelper.isNotEmpty(nextContinuationToken)) {
+            
exchange.getMessage().setHeader(OSSHeaders.NEXT_CONTINUATION_TOKEN, 
nextContinuationToken);
+        }
     }
 
     private void deleteObject(Exchange exchange, ClientConfigurations 
clientConfigurations) {
diff --git 
a/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/constants/OSSHeaders.java
 
b/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/constants/OSSHeaders.java
index f02af4a58ffb..b56a40917f3d 100644
--- 
a/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/constants/OSSHeaders.java
+++ 
b/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/constants/OSSHeaders.java
@@ -52,11 +52,23 @@ public final class OSSHeaders {
                                                 + " this header replaces 
both.",
               javaType = "String")
     public static final String PREFIX = OSSProperties.PREFIX;
-    @Metadata(label = "producer", description = "The maximum number of objects 
that listObjects returns. An exchange property"
-                                                + " of the same name replaces 
the maxKeys option, and this header replaces"
-                                                + " both.",
+    @Metadata(label = "producer", description = "The maximum number of objects 
that listObjects returns. The producer asks for"
+                                                + " at most 999 objects per 
request. An exchange property of the same name"
+                                                + " replaces the maxKeys 
option, and this header replaces both.",
               javaType = "Integer")
     public static final String MAX_KEYS = OSSProperties.MAX_KEYS;
+    @Metadata(label = "producer", description = "The continuation token from 
which listObjects starts. The"
+                                                + " 
CamelAlibabaOssNextContinuationToken header of an earlier listObjects holds"
+                                                + " it. If this header is not 
set, the producer uses an exchange property of"
+                                                + " the same name.",
+              javaType = "String")
+    public static final String CONTINUATION_TOKEN = 
OSSProperties.CONTINUATION_TOKEN;
+    @Metadata(label = "producer", description = "The continuation token for 
the next objects, to set as the"
+                                                + " 
CamelAlibabaOssContinuationToken header of the next listObjects. The"
+                                                + " producer sets it for 
listObjects when more objects match, and removes it"
+                                                + " otherwise.",
+              javaType = "String")
+    public static final String NEXT_CONTINUATION_TOKEN = 
"CamelAlibabaOssNextContinuationToken";
     @Metadata(label = "common", description = "The key that the object is 
stored under", javaType = "String")
     public static final String OBJECT_KEY = "CamelAlibabaOssObjectKey";
     @Metadata(label = "common", description = "The date and time that the 
object was last modified", javaType = "String")
diff --git 
a/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/constants/OSSProperties.java
 
b/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/constants/OSSProperties.java
index 3814d07cddfa..ed465a85a95e 100644
--- 
a/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/constants/OSSProperties.java
+++ 
b/components/camel-alibaba/camel-alibaba-oss/src/main/java/org/apache/camel/component/alibaba/oss/constants/OSSProperties.java
@@ -27,6 +27,7 @@ public final class OSSProperties {
     public static final String SOURCE_OBJECT_NAME = 
"CamelAlibabaOssSourceObjectName";
     public static final String PREFIX = "CamelAlibabaOssPrefix";
     public static final String MAX_KEYS = "CamelAlibabaOssMaxKeys";
+    public static final String CONTINUATION_TOKEN = 
"CamelAlibabaOssContinuationToken";
 
     private OSSProperties() {
     }
diff --git 
a/components/camel-alibaba/camel-alibaba-oss/src/test/java/org/apache/camel/component/alibaba/oss/ListBucketsTest.java
 
b/components/camel-alibaba/camel-alibaba-oss/src/test/java/org/apache/camel/component/alibaba/oss/ListBucketsTest.java
new file mode 100644
index 000000000000..6988815a70c2
--- /dev/null
+++ 
b/components/camel-alibaba/camel-alibaba-oss/src/test/java/org/apache/camel/component/alibaba/oss/ListBucketsTest.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.alibaba.oss;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Stream;
+
+import com.aliyun.sdk.service.oss2.OSSClient;
+import com.aliyun.sdk.service.oss2.models.BucketSummary;
+import com.aliyun.sdk.service.oss2.models.ListBucketsRequest;
+import com.aliyun.sdk.service.oss2.models.ListBucketsResult;
+import org.apache.camel.BindToRegistry;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit6.CamelTestSupport;
+import org.junit.jupiter.api.Test;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class ListBucketsTest extends CamelTestSupport {
+
+    @BindToRegistry("ossClient")
+    OSSClient mockClient = Mockito.mock(OSSClient.class);
+
+    @Override
+    protected RouteBuilder createRouteBuilder() {
+        return new RouteBuilder() {
+            @Override
+            public void configure() {
+                from("direct:list_buckets")
+                        
.to("alibaba-oss:demo-bucket?operation=listBuckets&ossClient=#ossClient");
+            }
+        };
+    }
+
+    @Test
+    void listBucketsReturnsTheBucketsOfEveryPage() {
+        ListBucketsResult first = page(true, "bucket-2", "bucket-1", 
"bucket-2");
+        // the service leaves out IsTruncated and NextMarker when it returns 
the last buckets
+        ListBucketsResult second = page(null, null, "bucket-3");
+        
Mockito.when(mockClient.listBuckets(Mockito.any(ListBucketsRequest.class))).thenReturn(first,
 second);
+
+        @SuppressWarnings("unchecked")
+        List<Map<String, Object>> buckets = 
template.requestBody("direct:list_buckets", "sample_body", List.class);
+
+        assertThat(buckets).extracting(bucket -> 
bucket.get("name")).containsExactly("bucket-1", "bucket-2", "bucket-3");
+        ArgumentCaptor<ListBucketsRequest> requests = 
ArgumentCaptor.forClass(ListBucketsRequest.class);
+        Mockito.verify(mockClient, 
Mockito.times(2)).listBuckets(requests.capture());
+        
assertThat(requests.getAllValues()).extracting(ListBucketsRequest::marker).containsExactly(null,
 "bucket-2");
+        
assertThat(requests.getAllValues()).extracting(ListBucketsRequest::maxKeys).containsExactly(1000L,
 1000L);
+    }
+
+    private static ListBucketsResult page(Boolean truncated, String 
nextMarker, String... names) {
+        List<BucketSummary> buckets = Stream.of(names)
+                .map(name -> 
BucketSummary.newBuilder().name(name).region("cn-hangzhou").storageClass("Standard").build())
+                .toList();
+        ListBucketsResult page = Mockito.mock(ListBucketsResult.class);
+        Mockito.when(page.buckets()).thenReturn(buckets);
+        Mockito.when(page.isTruncated()).thenReturn(truncated);
+        Mockito.when(page.nextMarker()).thenReturn(nextMarker);
+        return page;
+    }
+}
diff --git 
a/components/camel-alibaba/camel-alibaba-oss/src/test/java/org/apache/camel/component/alibaba/oss/ListObjectsTest.java
 
b/components/camel-alibaba/camel-alibaba-oss/src/test/java/org/apache/camel/component/alibaba/oss/ListObjectsTest.java
index c258f337af1a..1a6a81b766b5 100644
--- 
a/components/camel-alibaba/camel-alibaba-oss/src/test/java/org/apache/camel/component/alibaba/oss/ListObjectsTest.java
+++ 
b/components/camel-alibaba/camel-alibaba-oss/src/test/java/org/apache/camel/component/alibaba/oss/ListObjectsTest.java
@@ -17,20 +17,25 @@
 package org.apache.camel.component.alibaba.oss;
 
 import java.time.Instant;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.IntStream;
 
 import com.aliyun.sdk.service.oss2.OSSClient;
-import com.aliyun.sdk.service.oss2.models.ListObjectsRequest;
-import com.aliyun.sdk.service.oss2.models.ListObjectsResult;
+import com.aliyun.sdk.service.oss2.models.ListObjectsV2Request;
+import com.aliyun.sdk.service.oss2.models.ListObjectsV2Result;
 import com.aliyun.sdk.service.oss2.models.ObjectSummary;
 import org.apache.camel.BindToRegistry;
 import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.alibaba.common.models.ServiceKeys;
+import org.apache.camel.component.alibaba.oss.constants.OSSHeaders;
+import org.apache.camel.component.alibaba.oss.constants.OSSProperties;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit6.CamelTestSupport;
 import org.junit.jupiter.api.Test;
+import org.mockito.ArgumentCaptor;
 import org.mockito.Mockito;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -77,11 +82,11 @@ class ListObjectsTest extends CamelTestSupport {
                 .lastModified(Instant.parse("2024-01-02T00:00:00Z"))
                 .build();
 
-        ListObjectsResult listing = Mockito.mock(ListObjectsResult.class);
+        ListObjectsV2Result listing = Mockito.mock(ListObjectsV2Result.class);
         Mockito.when(listing.contents()).thenReturn(List.of(object1, object2));
         Mockito.when(listing.isTruncated()).thenReturn(false);
 
-        
Mockito.when(mockClient.listObjects(Mockito.any(ListObjectsRequest.class))).thenReturn(listing);
+        
Mockito.when(mockClient.listObjectsV2(Mockito.any(ListObjectsV2Request.class))).thenReturn(listing);
 
         MockEndpoint mock = getMockEndpoint("mock:list_objects_result");
         mock.expectedMinimumMessageCount(1);
@@ -98,4 +103,140 @@ class ListObjectsTest extends CamelTestSupport {
                 .containsEntry("bucketName", "dummy_bucket_name");
         assertThat(body.get(1)).containsEntry("objectKey", "Object 2");
     }
+
+    @Test
+    void listObjectsWithoutMaxKeysListsEveryPage() throws Exception {
+        ListObjectsV2Result first = page(true, "token-1", List.of("a", "b"));
+        ListObjectsV2Result second = page(false, null, List.of("c"));
+        
Mockito.when(mockClient.listObjectsV2(Mockito.any(ListObjectsV2Request.class))).thenReturn(first,
 second);
+
+        Exchange exchange = template.send("direct:list_objects", e -> 
e.getMessage().setBody("sample_body"));
+
+        assertThat(exchange.getException()).isNull();
+        List<ListObjectsV2Request> requests = listObjectsV2Requests(2);
+        
assertThat(requests).extracting(ListObjectsV2Request::maxKeys).containsExactly(999L,
 999L);
+        
assertThat(requests).extracting(ListObjectsV2Request::continuationToken).containsExactly(null,
 "token-1");
+        assertThat(objectKeys(exchange)).containsExactly("a", "b", "c");
+        
assertThat(exchange.getMessage().getHeaders()).doesNotContainKey(OSSHeaders.NEXT_CONTINUATION_TOKEN);
+    }
+
+    @Test
+    void listObjectsWithMaxKeysBelowOnePageSendsOneRequest() throws Exception {
+        ListObjectsV2Result first = page(true, "token-1", List.of("a", "b"));
+        
Mockito.when(mockClient.listObjectsV2(Mockito.any(ListObjectsV2Request.class))).thenReturn(first);
+
+        Exchange exchange = template.send("direct:list_objects", e -> {
+            e.getMessage().setBody("sample_body");
+            e.getMessage().setHeader(OSSHeaders.MAX_KEYS, 2);
+        });
+
+        assertThat(exchange.getException()).isNull();
+        
assertThat(listObjectsV2Requests(1)).extracting(ListObjectsV2Request::maxKeys).containsExactly(2L);
+        assertThat(objectKeys(exchange)).containsExactly("a", "b");
+        
assertThat(exchange.getMessage().getHeader(OSSHeaders.NEXT_CONTINUATION_TOKEN)).isEqualTo("token-1");
+    }
+
+    @Test
+    void listObjectsWithMaxKeysAboveOnePageAsksForAtMost999ObjectsPerRequest() 
throws Exception {
+        ListObjectsV2Result first = page(true, "token-1", keys("a", 999));
+        ListObjectsV2Result second = page(true, "token-2", keys("b", 501));
+        
Mockito.when(mockClient.listObjectsV2(Mockito.any(ListObjectsV2Request.class))).thenReturn(first,
 second);
+
+        Exchange exchange = template.send("direct:list_objects", e -> {
+            e.getMessage().setBody("sample_body");
+            e.getMessage().setHeader(OSSHeaders.MAX_KEYS, 1500);
+        });
+
+        assertThat(exchange.getException()).isNull();
+        List<ListObjectsV2Request> requests = listObjectsV2Requests(2);
+        
assertThat(requests).extracting(ListObjectsV2Request::maxKeys).containsExactly(999L,
 501L);
+        
assertThat(requests).extracting(ListObjectsV2Request::continuationToken).containsExactly(null,
 "token-1");
+        assertThat(objectKeys(exchange)).hasSize(1500);
+        
assertThat(exchange.getMessage().getHeader(OSSHeaders.NEXT_CONTINUATION_TOKEN)).isEqualTo("token-2");
+    }
+
+    @Test
+    void listObjectsFromTheNextContinuationTokenListsTheNextObjects() throws 
Exception {
+        ListObjectsV2Result first = page(true, "token-1", List.of("a", "b"));
+        ListObjectsV2Result second = page(false, null, List.of("c"));
+        
Mockito.when(mockClient.listObjectsV2(Mockito.any(ListObjectsV2Request.class))).thenReturn(first,
 second);
+
+        Exchange firstCall = template.send("direct:list_objects", e -> {
+            e.getMessage().setBody("sample_body");
+            e.getMessage().setHeader(OSSHeaders.MAX_KEYS, 2);
+        });
+        assertThat(firstCall.getException()).isNull();
+        // the second call gets the headers of the first one, as a loop in a 
route does
+        Exchange secondCall = template.send("direct:list_objects", e -> {
+            e.getMessage().setBody("sample_body");
+            e.getMessage().setHeaders(new 
HashMap<>(firstCall.getMessage().getHeaders()));
+            e.getMessage().setHeader(OSSHeaders.CONTINUATION_TOKEN,
+                    
firstCall.getMessage().getHeader(OSSHeaders.NEXT_CONTINUATION_TOKEN));
+        });
+
+        assertThat(secondCall.getException()).isNull();
+        
assertThat(listObjectsV2Requests(2)).extracting(ListObjectsV2Request::continuationToken)
+                .containsExactly(null, "token-1");
+        assertThat(objectKeys(firstCall)).containsExactly("a", "b");
+        assertThat(objectKeys(secondCall)).containsExactly("c");
+        
assertThat(secondCall.getMessage().getHeaders()).doesNotContainKey(OSSHeaders.NEXT_CONTINUATION_TOKEN);
+    }
+
+    @Test
+    void listObjectsStartsFromTheContinuationTokenOfAnExchangeProperty() 
throws Exception {
+        ListObjectsV2Result page = page(false, null, List.of("c"));
+        
Mockito.when(mockClient.listObjectsV2(Mockito.any(ListObjectsV2Request.class))).thenReturn(page);
+
+        Exchange exchange = template.send("direct:list_objects", e -> {
+            e.getMessage().setBody("sample_body");
+            e.setProperty(OSSProperties.CONTINUATION_TOKEN, "token-1");
+        });
+
+        assertThat(exchange.getException()).isNull();
+        
assertThat(listObjectsV2Requests(1)).extracting(ListObjectsV2Request::continuationToken)
+                .containsExactly("token-1");
+        assertThat(objectKeys(exchange)).containsExactly("c");
+    }
+
+    @Test
+    void aFailedListObjectsRemovesTheNextContinuationTokenOfAnEarlierCall() 
throws Exception {
+        
Mockito.when(mockClient.listObjectsV2(Mockito.any(ListObjectsV2Request.class)))
+                .thenThrow(new IllegalStateException("AccessDenied"));
+
+        Exchange exchange = template.send("direct:list_objects", e -> {
+            e.getMessage().setBody("sample_body");
+            e.getMessage().setHeader(OSSHeaders.CONTINUATION_TOKEN, "token-1");
+            e.getMessage().setHeader(OSSHeaders.NEXT_CONTINUATION_TOKEN, 
"token-1");
+        });
+
+        
assertThat(exchange.getMessage().getHeaders()).doesNotContainKey(OSSHeaders.NEXT_CONTINUATION_TOKEN);
+        assertThat(exchange.getException()).hasMessage("AccessDenied");
+    }
+
+    private List<ListObjectsV2Request> listObjectsV2Requests(int count) {
+        ArgumentCaptor<ListObjectsV2Request> requests = 
ArgumentCaptor.forClass(ListObjectsV2Request.class);
+        Mockito.verify(mockClient, 
Mockito.times(count)).listObjectsV2(requests.capture());
+        return requests.getAllValues();
+    }
+
+    @SuppressWarnings("unchecked")
+    private static List<Object> objectKeys(Exchange exchange) {
+        List<Map<String, Object>> objects = 
exchange.getMessage().getBody(List.class);
+        return objects.stream().map(object -> 
object.get("objectKey")).toList();
+    }
+
+    private static List<String> keys(String prefix, int count) {
+        return IntStream.range(0, count).mapToObj(i -> prefix + i).toList();
+    }
+
+    private static ListObjectsV2Result page(boolean truncated, String 
nextContinuationToken, List<String> keys) {
+        List<ObjectSummary> contents = keys.stream()
+                .map(key -> 
ObjectSummary.newBuilder().key(key).size(1L).build())
+                .toList();
+        ListObjectsV2Result page = Mockito.mock(ListObjectsV2Result.class);
+        Mockito.when(page.contents()).thenReturn(contents);
+        Mockito.when(page.isTruncated()).thenReturn(truncated);
+        
Mockito.when(page.nextContinuationToken()).thenReturn(nextContinuationToken);
+        return page;
+    }
 }
diff --git 
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc 
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
index 84a8f4a44912..5580189c2121 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_25.adoc
@@ -49,3 +49,19 @@ from 400 to 599. The body then stays as it was, and the 
producer does not set th
 A route that tests the `code` key of the body for an error needs 
`onException`, or `doTry` and `doCatch`, now. An error
 handler that redelivers now sends such a request again. A test that mocks the 
client must return a body with the `Code`
 `OK` for a send that succeeds.
+
+=== camel-alibaba-oss - listBuckets returns every bucket, and listObjects uses 
ListObjectsV2
+
+The `listBuckets` operation of `alibaba-oss` now returns every bucket of the 
account. Before, it returned only the
+first page of the listing, which Object Storage Service limits to 100 buckets 
by default. It now asks for 1000 buckets
+per request, and sends requests until the listing ends.
+
+The `listObjects` operation now sends ListObjectsV2 requests instead of 
ListObjects, as the consumer does. It needs the
+same `oss:ListObjects` permission. A custom `OSSClient`, or a test that mocks 
it, must now implement or mock
+`listObjectsV2` for this operation. The body is the same `List` of `Map`, with 
the same keys.
+
+Without `maxKeys`, the producer now asks for 999 objects per request. Before, 
it set no page size, so the service sent
+its default of 100 objects. With `maxKeys`, each request asks for at most 999 
objects, until the producer has `maxKeys`
+objects or the listing ends. Before, it sent `maxKeys` as the page size of 
every request, and the service rejected a
+value above 1000. Returning 1000 objects now takes two requests. When more 
objects match, `listObjects` now also sets
+the new `CamelAlibabaOssNextContinuationToken` header.
diff --git 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OSSEndpointBuilderFactory.java
 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OSSEndpointBuilderFactory.java
index d128b6bcbd47..f5aff64dd990 100644
--- 
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OSSEndpointBuilderFactory.java
+++ 
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/OSSEndpointBuilderFactory.java
@@ -1060,10 +1060,10 @@ public interface OSSEndpointBuilderFactory {
         }
         /**
          * The maximum number of objects that the producer returns for
-         * listObjects, or all of them if no value is set. Object Storage
-         * Service accepts a value of at most 1000. The CamelAlibabaOssMaxKeys
-         * exchange property replaces this option, and a header of the same 
name
-         * replaces both.
+         * listObjects, or all of them if no value is set. The producer asks 
for
+         * at most 999 objects per request. The CamelAlibabaOssMaxKeys exchange
+         * property replaces this option, and a header of the same name 
replaces
+         * both.
          * 
          * The option is a: <code>java.lang.Integer</code> type.
          * 
@@ -1078,10 +1078,10 @@ public interface OSSEndpointBuilderFactory {
         }
         /**
          * The maximum number of objects that the producer returns for
-         * listObjects, or all of them if no value is set. Object Storage
-         * Service accepts a value of at most 1000. The CamelAlibabaOssMaxKeys
-         * exchange property replaces this option, and a header of the same 
name
-         * replaces both.
+         * listObjects, or all of them if no value is set. The producer asks 
for
+         * at most 999 objects per request. The CamelAlibabaOssMaxKeys exchange
+         * property replaces this option, and a header of the same name 
replaces
+         * both.
          * 
          * The option will be converted to a <code>java.lang.Integer</code>
          * type.
@@ -1623,9 +1623,9 @@ public interface OSSEndpointBuilderFactory {
             return "CamelAlibabaOssPrefix";
         }
         /**
-         * The maximum number of objects that listObjects returns. An exchange
-         * property of the same name replaces the maxKeys option, and this
-         * header replaces both.
+         * The maximum number of objects that listObjects returns. The producer
+         * asks for at most 999 objects per request. An exchange property of 
the
+         * same name replaces the maxKeys option, and this header replaces 
both.
          * 
          * The option is a: {@code Integer} type.
          * 
@@ -1636,6 +1636,37 @@ public interface OSSEndpointBuilderFactory {
         public String alibabaOssMaxKeys() {
             return "CamelAlibabaOssMaxKeys";
         }
+        /**
+         * The continuation token from which listObjects starts. The
+         * CamelAlibabaOssNextContinuationToken header of an earlier 
listObjects
+         * holds it. If this header is not set, the producer uses an exchange
+         * property of the same name.
+         * 
+         * The option is a: {@code String} type.
+         * 
+         * Group: producer
+         * 
+         * @return the name of the header {@code AlibabaOssContinuationToken}.
+         */
+        public String alibabaOssContinuationToken() {
+            return "CamelAlibabaOssContinuationToken";
+        }
+        /**
+         * The continuation token for the next objects, to set as the
+         * CamelAlibabaOssContinuationToken header of the next listObjects. The
+         * producer sets it for listObjects when more objects match, and 
removes
+         * it otherwise.
+         * 
+         * The option is a: {@code String} type.
+         * 
+         * Group: producer
+         * 
+         * @return the name of the header {@code
+         * AlibabaOssNextContinuationToken}.
+         */
+        public String alibabaOssNextContinuationToken() {
+            return "CamelAlibabaOssNextContinuationToken";
+        }
         /**
          * The key that the object is stored under.
          * 

Reply via email to