Stream retry support part 2: Introduce a new split method in AsyncRequestBody that returns an SdkP…#6346
Conversation
93b3757 to
01a4cdb
Compare
01a4cdb to
8f3a1ac
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new splitV2 method in AsyncRequestBody that returns an SdkPublisher of ClosableAsyncRequestBody instead of AsyncRequestBody, enabling proper resource management for split request bodies. This change is designed to support streaming retry for S3 multipart uploads.
- Adds
ClosableAsyncRequestBodyinterface extendingAsyncRequestBodywith close capability - Updates S3 multipart client implementation to use the new
splitV2method - Maintains backward compatibility by deprecating the original
splitmethod
Reviewed Changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
ClosableAsyncRequestBody.java |
New interface extending AsyncRequestBody with close capability |
AsyncRequestBody.java |
Adds splitV2 method and deprecates original split method |
SplittingPublisher.java |
Updates to return ClosableAsyncRequestBody and improve resource management |
UploadWithUnknownContentLengthHelper.java |
Updated to use splitV2 and properly close request bodies |
UploadWithKnownContentLengthHelper.java |
Updated to use splitV2 method |
KnownContentLengthAsyncRequestBodySubscriber.java |
Updated to handle ClosableAsyncRequestBody and close resources |
| Test files | Updated tests to use new interfaces and verify retry behavior |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
core/sdk-core/src/main/java/software/amazon/awssdk/core/internal/async/SplittingPublisher.java
Outdated
Show resolved
Hide resolved
core/sdk-core/src/main/java/software/amazon/awssdk/core/internal/async/SplittingPublisher.java
Outdated
Show resolved
Hide resolved
...tware/amazon/awssdk/services/s3/internal/multipart/UploadWithUnknownContentLengthHelper.java
Show resolved
Hide resolved
...azon/awssdk/services/s3/internal/multipart/KnownContentLengthAsyncRequestBodySubscriber.java
Show resolved
Hide resolved
8f3a1ac to
e0a046e
Compare
…ublisher of ClosableAsyncRequestBody and use it in s3 multipart client
e0a046e to
d94cec4
Compare
3814adb to
3ffa942
Compare
3ffa942 to
3c91cc9
Compare
...-core/src/main/java/software/amazon/awssdk/core/async/listener/AsyncRequestBodyListener.java
Outdated
Show resolved
Hide resolved
...are/amazon/awssdk/services/s3/internal/multipart/S3MultipartClientPutObjectWiremockTest.java
Show resolved
Hide resolved
3b244ec to
29f911a
Compare
29f911a to
004733b
Compare
...core/src/main/java/software/amazon/awssdk/core/async/BufferedSplittableAsyncRequestBody.java
Show resolved
Hide resolved
core/sdk-core/src/main/java/software/amazon/awssdk/core/async/AsyncRequestBody.java
Outdated
Show resolved
Hide resolved
.../sdk-core/src/main/java/software/amazon/awssdk/core/internal/async/FileAsyncRequestBody.java
Show resolved
Hide resolved
...rc/main/java/software/amazon/awssdk/core/internal/async/NonRetryableSubAsyncRequestBody.java
Outdated
Show resolved
Hide resolved
...rc/main/java/software/amazon/awssdk/core/internal/async/NonRetryableSubAsyncRequestBody.java
Show resolved
Hide resolved
...rc/main/java/software/amazon/awssdk/core/internal/async/NonRetryableSubAsyncRequestBody.java
Show resolved
Hide resolved
...e/src/main/java/software/amazon/awssdk/core/internal/async/RetryableSubAsyncRequestBody.java
Show resolved
Hide resolved
...e/src/main/java/software/amazon/awssdk/core/internal/async/RetryableSubAsyncRequestBody.java
Outdated
Show resolved
Hide resolved
core/sdk-core/src/main/java/software/amazon/awssdk/core/internal/async/SplittingPublisher.java
Show resolved
Hide resolved
...core/src/main/java/software/amazon/awssdk/core/async/BufferedSplittableAsyncRequestBody.java
Outdated
Show resolved
Hide resolved
core/sdk-core/src/main/java/software/amazon/awssdk/core/async/ClosableAsyncRequestBody.java
Outdated
Show resolved
Hide resolved
...rc/main/java/software/amazon/awssdk/core/internal/async/NonRetryableSubAsyncRequestBody.java
Outdated
Show resolved
Hide resolved
...rc/main/java/software/amazon/awssdk/core/internal/async/NonRetryableSubAsyncRequestBody.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/software/amazon/awssdk/core/internal/async/RetryableSubAsyncRequestBody.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/software/amazon/awssdk/core/internal/async/RetryableSubAsyncRequestBody.java
Outdated
Show resolved
Hide resolved
57cbc1f to
43ee3ba
Compare
43ee3ba to
0c2000e
Compare
|
...core/src/main/java/software/amazon/awssdk/core/async/BufferedSplittableAsyncRequestBody.java
Show resolved
Hide resolved
...e/src/main/java/software/amazon/awssdk/core/internal/async/RetryableSubAsyncRequestBody.java
Show resolved
Hide resolved
c82d494
into
feature/master/mpu-stream-retry
|
This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one. |




…ublisher of ClosableAsyncRequestBody and use it in s3 multipart client
Motivation and Context
This PR introduces a new split method,
splitClosableinAsyncRequestBodythat returns an SdkPublisher of ClosableAsyncRequestBody instead of AsyncRequestBody, enabling proper resource management for split request bodies. The change is primarily implemented to support streaming retry for S3 multipart client for retry Support retries for individual parts of a multipart upload in Java SDK V2 #6198Introduces ClosableAsyncRequestBody interface extending AsyncRequestBody with close capability
Updates S3 multipart client implementation to use the new splitClosable method
Testing
Added wiremock tests
Screenshots (if appropriate)
Types of changes
Checklist
mvn installsucceedsscripts/new-changescript and following the instructions. Commit the new file created by the script in.changes/next-releasewith your changes.License