This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch camel-4.14.x
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-4.14.x by this push:
new 8c5087b146f2 Enhance S3 producer to stream the payload of type
GenericFile (#21122)
8c5087b146f2 is described below
commit 8c5087b146f24b79d6498d5ac0bf6a6f54be4f71
Author: Bartosz Popiela <[email protected]>
AuthorDate: Thu Jan 29 07:21:49 2026 +0100
Enhance S3 producer to stream the payload of type GenericFile (#21122)
---
.../java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java | 5 +++--
core/camel-api/src/main/java/org/apache/camel/WrappedFile.java | 6 ++++++
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git
a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
index 7e6180d577b9..f88069c78d9b 100644
---
a/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
+++
b/components/camel-aws/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
@@ -273,8 +273,9 @@ public class AWS2S3Producer extends DefaultProducer {
try {
// Need to check if the message body is WrappedFile
- if (obj instanceof WrappedFile) {
- obj = ((WrappedFile<?>) obj).getFile();
+ if (obj instanceof WrappedFile<?> wrappedFile) {
+ contentLength = wrappedFile.getFileLength();
+ obj = wrappedFile.getFile();
}
if (obj instanceof File) {
// optimize for file payload
diff --git a/core/camel-api/src/main/java/org/apache/camel/WrappedFile.java
b/core/camel-api/src/main/java/org/apache/camel/WrappedFile.java
index e6980d121a15..c2916fc85c94 100644
--- a/core/camel-api/src/main/java/org/apache/camel/WrappedFile.java
+++ b/core/camel-api/src/main/java/org/apache/camel/WrappedFile.java
@@ -35,4 +35,10 @@ public interface WrappedFile<T> {
*/
Object getBody();
+ /**
+ * Gets the file length in bytes.
+ *
+ * @return the length of the file in bytes.
+ */
+ long getFileLength();
}