aws-sdk-java-v2 icon indicating copy to clipboard operation
aws-sdk-java-v2 copied to clipboard

Support chunked Transfer-Encoding in SdkHttpFullRequest

Open dblock opened this issue 3 years ago • 2 comments

Describe the feature

How can one send chunked transfer encoding requests with SdkHttpFullRequest today? https://github.com/dblock/aws-sdk-sigv4-demo/issues/1

I'd like something like this:

byte payload[] = ... // something very large

SdkHttpFullRequest request = SdkHttpFullRequest.builder()
                .method(SdkHttpMethod.POST)
                .uri(URI.create(ENDPOINT + "/index_name/type_name/document_id"))
                .appendHeader("Content-Type", "application/json")
                .compressed() // this is #3286 
                .chunked() // this feature request
                .contentStreamProvider(() -> new ByteArrayInputStream(payload))
                .build();

Use Case

Chunked requests are implemented in the OpenSearch REST client, and we're trying to move forward enabling https://github.com/opensearch-project/opensearch-java/issues/55

Proposed Solution

No response

Other Information

Related to #3286.

Acknowledgements

  • [ ] I may be able to implement this feature request
  • [ ] This feature might incur a breaking change

AWS Java SDK version used

2.17.224

JDK version used

11

Operating System and version

MacOS

dblock avatar Jul 08 '22 16:07 dblock

We do support chunked encoding on the client level. See chunkedEncodingEnabled() in S3Configuration. Would that be sufficient, or the feature request is to support on a request level?

debora-ito avatar Jul 14 '22 20:07 debora-ito

@debora-ito I think it's the latter: a feature to support compression (#3286), and chunking (this request) per request.

We're not talking to S3, but Amazon OpenSearch, so not sure what to do with S3Configuration. I don't see AmazonOpenSearchConfiguration or similar that lets me configure all requests to OpenSearch. Also in my example above I'm making a vanilla SdkHttpFullRequest.

dblock avatar Jul 14 '22 20:07 dblock