You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/10/13 17:38:05 UTC

[camel] branch CAMEL-15678-3.4.x created (now 48b6eb1)

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

acosentino pushed a change to branch CAMEL-15678-3.4.x
in repository https://gitbox.apache.org/repos/asf/camel.git.


      at 48b6eb1  Update AWS2S3Producer.java

This branch includes the following new commits:

     new 2881b3f  CAMEL-15678: camel-aws2-s3 multipart upload multiplies file by number of parts * change multipart upload to use inputStream
     new 48b6eb1  Update AWS2S3Producer.java

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[camel] 01/02: CAMEL-15678: camel-aws2-s3 multipart upload multiplies file by number of parts * change multipart upload to use inputStream

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch CAMEL-15678-3.4.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 2881b3fe7bfbcf928f1ef14b93d2b2f5b4c658c9
Author: Kiril Nugmanov <ki...@zenitech.co.uk>
AuthorDate: Tue Oct 13 15:50:17 2020 +0300

    CAMEL-15678: camel-aws2-s3 multipart upload multiplies file by number of parts
    * change multipart upload to use inputStream
---
 .../apache/camel/component/aws2/s3/AWS2S3Producer.java | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
index 7f37aa2..b834609 100644
--- a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
+++ b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
@@ -68,8 +68,10 @@ import software.amazon.awssdk.services.s3.model.PutObjectResponse;
 import software.amazon.awssdk.services.s3.model.UploadPartRequest;
 
 /**
- * A Producer which sends messages to the Amazon Web Service Simple Storage
- * Service <a href="http://aws.amazon.com/s3/">AWS S3</a>
+ * A Producer which sends messages to the Amazon Web Service Simple Storage Service
+ * <a href="http://aws.amazon.com/s3/">AWS S3</a>
+ *
+ * @author Kiril Nugmanov
  */
 public class AWS2S3Producer extends DefaultProducer {
 
@@ -197,10 +199,14 @@ public class AWS2S3Producer extends DefaultProducer {
                     .partNumber(part).build();
 
                 LOG.trace("Uploading part [{}] for {}", part, keyName);
-                String etag = getEndpoint().getS3Client().uploadPart(uploadRequest, RequestBody.fromFile(filePayload)).eTag();
-                CompletedPart partUpload = CompletedPart.builder().partNumber(part).eTag(etag).build();
-                completedParts.add(partUpload);
-                filePosition += partSize;
+                try (InputStream fileInputStream = new FileInputStream(filePayload)) {
+                    fileInputStream.skip(filePosition);
+
+                    String etag = getEndpoint().getS3Client().uploadPart(uploadRequest, RequestBody.fromInputStream(fileInputStream, partSize)).eTag();
+                    CompletedPart partUpload = CompletedPart.builder().partNumber(part).eTag(etag).build();
+                    completedParts.add(partUpload);
+                    filePosition += partSize;
+                }
             }
             CompletedMultipartUpload completeMultipartUpload = CompletedMultipartUpload.builder().parts(completedParts).build();
             CompleteMultipartUploadRequest compRequest = CompleteMultipartUploadRequest.builder().multipartUpload(completeMultipartUpload)


[camel] 02/02: Update AWS2S3Producer.java

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch CAMEL-15678-3.4.x
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 48b6eb17f8cbd82cc273723a3a7cc7683c1e2d22
Author: Kiril Nugmanov <k....@mail.com>
AuthorDate: Tue Oct 13 17:16:08 2020 +0300

    Update AWS2S3Producer.java
    
    Removed author
---
 .../src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
index b834609..b362b66 100644
--- a/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
+++ b/components/camel-aws2-s3/src/main/java/org/apache/camel/component/aws2/s3/AWS2S3Producer.java
@@ -71,7 +71,6 @@ import software.amazon.awssdk.services.s3.model.UploadPartRequest;
  * A Producer which sends messages to the Amazon Web Service Simple Storage Service
  * <a href="http://aws.amazon.com/s3/">AWS S3</a>
  *
- * @author Kiril Nugmanov
  */
 public class AWS2S3Producer extends DefaultProducer {