Class RestEventStreamAsyncResponseTransformer<ResponseT extends SdkResponse,EventT>
java.lang.Object
software.amazon.awssdk.awscore.eventstream.RestEventStreamAsyncResponseTransformer<ResponseT,EventT>
- Type Parameters:
ResponseT
- Initial response type of event stream operation.EventT
- Base type of event stream message frames.
- All Implemented Interfaces:
AsyncResponseTransformer<ResponseT,
Void>
public class RestEventStreamAsyncResponseTransformer<ResponseT extends SdkResponse,EventT>
extends Object
implements AsyncResponseTransformer<ResponseT,Void>
Adapter transformer meant for eventstream responses from REST services (REST-XML, REST-JSON). These protocols don't have an
'initial-response' event, unlike AWS-JSON. In these protocols "initial response" is treated as the HTTP response itself.
When this transformer's
onResponse(SdkResponse)
method is invoked, it also invokes it on the eventstream
response handler, which the normal EventStreamAsyncResponseTransformer
does not do.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
Builder forRestEventStreamAsyncResponseTransformer
. -
Method Summary
Modifier and TypeMethodDescriptionstatic <ResponseT extends SdkResponse,
EventT>
RestEventStreamAsyncResponseTransformer.Builder<ResponseT, EventT> builder()
void
exceptionOccurred
(Throwable throwable) Called when an error is encountered while making the request or receiving the response.void
onResponse
(ResponseT response) Called when the unmarshalled response object is ready.void
onStream
(SdkPublisher<ByteBuffer> publisher) Called when the response stream is ready.prepare()
Initial call to enable any setup required before the response is handled.
-
Method Details
-
prepare
Description copied from interface:AsyncResponseTransformer
Initial call to enable any setup required before the response is handled.Note that this will be called for each request attempt, up to the number of retries allowed by the configured
RetryPolicy
.This method is guaranteed to be called before the request is executed, and before
AsyncResponseTransformer.onResponse(Object)
is signaled.- Specified by:
prepare
in interfaceAsyncResponseTransformer<ResponseT extends SdkResponse,
EventT> - Returns:
- The future holding the transformed response.
-
onResponse
Description copied from interface:AsyncResponseTransformer
Called when the unmarshalled response object is ready.- Specified by:
onResponse
in interfaceAsyncResponseTransformer<ResponseT extends SdkResponse,
EventT> - Parameters:
response
- The unmarshalled response.
-
onStream
Description copied from interface:AsyncResponseTransformer
Called when the response stream is ready.- Specified by:
onStream
in interfaceAsyncResponseTransformer<ResponseT extends SdkResponse,
EventT> - Parameters:
publisher
- The publisher.
-
exceptionOccurred
Description copied from interface:AsyncResponseTransformer
Called when an error is encountered while making the request or receiving the response. Implementations should free up any resources in this method. This method may be called multiple times during the lifecycle of a request if automatic retries are enabled.- Specified by:
exceptionOccurred
in interfaceAsyncResponseTransformer<ResponseT extends SdkResponse,
EventT> - Parameters:
throwable
- Error that occurred.
-
builder
public static <ResponseT extends SdkResponse,EventT> RestEventStreamAsyncResponseTransformer.Builder<ResponseT,EventT> builder()
-