Dinesh created CAMEL-15526:
------------------------------

             Summary: Camel-AWS2-S3:  Consume Gzip file from S3 not working. 
                 Key: CAMEL-15526
                 URL: https://issues.apache.org/jira/browse/CAMEL-15526
             Project: Camel
          Issue Type: Bug
    Affects Versions: 3.4.2
         Environment: camel Aws2-s3

 
            Reporter: Dinesh


Hi,

When consuming Gzip file from S3 using AWS2-S3 component, file not downlaoding 
properly;

Same code working for AWS-S3, after upgrading to AWS2-S3, this code not working.

 

Task:
1. Download "myfile.csv.gzip" file from S3.

2. GUnzip file and send to processor.
3. Processor will send file to http end point using multipart upload. 

Here is the code used.

 

{{}}

{{from("aws2-s3://mybucket?amazonS3Client=#amazonS3Client&deleteAfterRead=false&delay=5000&synchronous=true&includeBody=true&autocloseBody=false&prefix=myfile.csv.gz")}}

{{            .unmarshal().gzipDeflater()}}

{{            .process(@Override  public void process(Exchange exchange) throws 
Exception {}}

{{      MultipartEntityBuilder multipartEntityBuilder = 
MultipartEntityBuilder.create();
      String filename = exchange.getIn().getHeader(AWS2S3Constants.KEY, 
String.class);
      String body = exchange.getIn().getBody(String.class);
      ContentBody cd = new InputStreamBody(new 
ByteArrayInputStream(body.getBytes()), ContentType.MULTIPART_FORM_DATA,         
     "temp.csv");
      multipartEntityBuilder.addPart("file",  cd);
      System.out.println(cd);
      exchange.getOut().setBody(multipartEntityBuilder.build());)
            .to("direct:httproute");}}

{{}}

Regards,

Dinesh

{{}}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to