Search in sources :

Example 1 with AsyncResponseTransformer

use of software.amazon.awssdk.core.async.AsyncResponseTransformer in project aws-sdk-java-v2 by aws.

the class EventStreamAsyncResponseTransformerTest method multipleEventsInChunk_OnlyDeliversOneEvent.

@Test
public void multipleEventsInChunk_OnlyDeliversOneEvent() throws InterruptedException {
    Message eventMessage = new Message(ImmutableMap.of(":message-type", HeaderValue.fromString("event"), ":event-type", HeaderValue.fromString("foo")), new byte[0]);
    CountDownLatch latch = new CountDownLatch(1);
    Flowable<ByteBuffer> bytePublisher = Flowable.just(eventMessage.toByteBuffer(), eventMessage.toByteBuffer()).doOnCancel(latch::countDown);
    AtomicInteger numEvents = new AtomicInteger(0);
    // Request one event then cancel
    Subscriber<Object> requestOneSubscriber = new Subscriber<Object>() {

        private Subscription subscription;

        @Override
        public void onSubscribe(Subscription subscription) {
            this.subscription = subscription;
            subscription.request(1);
        }

        @Override
        public void onNext(Object o) {
            numEvents.incrementAndGet();
            subscription.cancel();
        }

        @Override
        public void onError(Throwable throwable) {
        }

        @Override
        public void onComplete() {
        }
    };
    AsyncResponseTransformer<SdkResponse, Void> transformer = EventStreamAsyncResponseTransformer.builder().eventStreamResponseHandler(onEventStream(p -> p.subscribe(requestOneSubscriber))).eventResponseHandler((r, e) -> new Object()).executor(Executors.newSingleThreadExecutor()).future(new CompletableFuture<>()).build();
    transformer.prepare();
    transformer.onStream(SdkPublisher.adapt(bytePublisher));
    latch.await();
    assertThat(numEvents).as("Expected only one event to be delivered").hasValue(1);
}
Also used : ImmutableMap(software.amazon.awssdk.utils.ImmutableMap) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) CompletionException(java.util.concurrent.CompletionException) Test(org.junit.Test) SdkPublisher(software.amazon.awssdk.core.async.SdkPublisher) ByteBuffer(java.nio.ByteBuffer) Executors(java.util.concurrent.Executors) Message(software.amazon.eventstream.Message) Consumer(java.util.function.Consumer) CountDownLatch(java.util.concurrent.CountDownLatch) AtomicLong(java.util.concurrent.atomic.AtomicLong) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) Flowable(io.reactivex.Flowable) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) Subscription(org.reactivestreams.Subscription) SdkResponse(software.amazon.awssdk.core.SdkResponse) AsyncResponseTransformer(software.amazon.awssdk.core.async.AsyncResponseTransformer) SdkServiceException(software.amazon.awssdk.core.exception.SdkServiceException) Subscriber(org.reactivestreams.Subscriber) HeaderValue(software.amazon.eventstream.HeaderValue) Message(software.amazon.eventstream.Message) CountDownLatch(java.util.concurrent.CountDownLatch) ByteBuffer(java.nio.ByteBuffer) CompletableFuture(java.util.concurrent.CompletableFuture) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Subscriber(org.reactivestreams.Subscriber) SdkResponse(software.amazon.awssdk.core.SdkResponse) Subscription(org.reactivestreams.Subscription) Test(org.junit.Test)

Example 2 with AsyncResponseTransformer

use of software.amazon.awssdk.core.async.AsyncResponseTransformer in project aws-sdk-java-v2 by aws.

the class EventStreamAsyncResponseTransformerTest method verifyExceptionThrown.

private void verifyExceptionThrown(Map<String, HeaderValue> headers) {
    SdkServiceException exception = SdkServiceException.builder().build();
    Message exceptionMessage = new Message(headers, new byte[0]);
    Flowable<ByteBuffer> bytePublisher = Flowable.just(exceptionMessage.toByteBuffer());
    SubscribingResponseHandler handler = new SubscribingResponseHandler();
    AsyncResponseTransformer<SdkResponse, Void> transformer = EventStreamAsyncResponseTransformer.builder().eventStreamResponseHandler(handler).exceptionResponseHandler((response, executionAttributes) -> exception).executor(Executors.newSingleThreadExecutor()).future(new CompletableFuture<>()).build();
    CompletableFuture<Void> cf = transformer.prepare();
    transformer.onResponse(null);
    transformer.onStream(SdkPublisher.adapt(bytePublisher));
    assertThatThrownBy(() -> {
        try {
            cf.join();
        } catch (CompletionException e) {
            if (e.getCause() instanceof SdkServiceException) {
                throw e.getCause();
            }
        }
    }).isSameAs(exception);
    assertThat(handler.exceptionOccurredCalled).isTrue();
}
Also used : ImmutableMap(software.amazon.awssdk.utils.ImmutableMap) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) CompletionException(java.util.concurrent.CompletionException) Test(org.junit.Test) SdkPublisher(software.amazon.awssdk.core.async.SdkPublisher) ByteBuffer(java.nio.ByteBuffer) Executors(java.util.concurrent.Executors) Message(software.amazon.eventstream.Message) Consumer(java.util.function.Consumer) CountDownLatch(java.util.concurrent.CountDownLatch) AtomicLong(java.util.concurrent.atomic.AtomicLong) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) Flowable(io.reactivex.Flowable) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Map(java.util.Map) Subscription(org.reactivestreams.Subscription) SdkResponse(software.amazon.awssdk.core.SdkResponse) AsyncResponseTransformer(software.amazon.awssdk.core.async.AsyncResponseTransformer) SdkServiceException(software.amazon.awssdk.core.exception.SdkServiceException) Subscriber(org.reactivestreams.Subscriber) HeaderValue(software.amazon.eventstream.HeaderValue) CompletableFuture(java.util.concurrent.CompletableFuture) SdkServiceException(software.amazon.awssdk.core.exception.SdkServiceException) Message(software.amazon.eventstream.Message) CompletionException(java.util.concurrent.CompletionException) SdkResponse(software.amazon.awssdk.core.SdkResponse) ByteBuffer(java.nio.ByteBuffer)

Example 3 with AsyncResponseTransformer

use of software.amazon.awssdk.core.async.AsyncResponseTransformer in project aws-sdk-java-v2 by aws.

the class DefaultJsonAsyncClient method streamingInputOutputOperation.

/**
 * Some operation with streaming input and streaming output
 *
 * @param streamingInputOutputOperationRequest
 * @param requestBody
 *        Functional interface that can be implemented to produce the request content in a non-blocking manner. The
 *        size of the content is expected to be known up front. See {@link AsyncRequestBody} for specific details on
 *        implementing this interface as well as links to precanned implementations for common scenarios like
 *        uploading from a file. The service documentation for the request content is as follows 'This be a stream'
 * @param asyncResponseTransformer
 *        The response transformer for processing the streaming response in a non-blocking manner. See
 *        {@link AsyncResponseTransformer} for details on how this callback should be implemented and for links to
 *        precanned implementations for common scenarios like downloading to a file. The service documentation for
 *        the response content is as follows 'This be a stream'.
 * @return A future to the transformed result of the AsyncResponseTransformer.<br/>
 *         The CompletableFuture returned by this method can be completed exceptionally with the following
 *         exceptions.
 *         <ul>
 *         <li>SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
 *         Can be used for catch all scenarios.</li>
 *         <li>SdkClientException If any client side error occurs such as an IO related failure, failure to get
 *         credentials, etc.</li>
 *         <li>JsonException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
 *         of this type.</li>
 *         </ul>
 * @sample JsonAsyncClient.StreamingInputOutputOperation
 * @see <a href="https://docs.aws.amazon.com/goto/WebAPI/json-service-2010-05-08/StreamingInputOutputOperation"
 *      target="_top">AWS API Documentation</a>
 */
@Override
public <ReturnT> CompletableFuture<ReturnT> streamingInputOutputOperation(StreamingInputOutputOperationRequest streamingInputOutputOperationRequest, AsyncRequestBody requestBody, AsyncResponseTransformer<StreamingInputOutputOperationResponse, ReturnT> asyncResponseTransformer) {
    List<MetricPublisher> metricPublishers = resolveMetricPublishers(clientConfiguration, streamingInputOutputOperationRequest.overrideConfiguration().orElse(null));
    MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector.create("ApiCall");
    try {
        apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Json Service");
        apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingInputOutputOperation");
        Pair<AsyncResponseTransformer<StreamingInputOutputOperationResponse, ReturnT>, CompletableFuture<Void>> pair = AsyncResponseTransformerUtils.wrapWithEndOfStreamFuture(asyncResponseTransformer);
        asyncResponseTransformer = pair.left();
        CompletableFuture<Void> endOfStreamFuture = pair.right();
        streamingInputOutputOperationRequest = applySignerOverride(streamingInputOutputOperationRequest, Aws4UnsignedPayloadSigner.create());
        JsonOperationMetadata operationMetadata = JsonOperationMetadata.builder().hasStreamingSuccessResponse(true).isPayloadJson(false).build();
        HttpResponseHandler<StreamingInputOutputOperationResponse> responseHandler = protocolFactory.createResponseHandler(operationMetadata, StreamingInputOutputOperationResponse::builder);
        HttpResponseHandler<AwsServiceException> errorResponseHandler = createErrorResponseHandler(protocolFactory, operationMetadata);
        CompletableFuture<ReturnT> executeFuture = clientHandler.execute(new ClientExecutionParams<StreamingInputOutputOperationRequest, StreamingInputOutputOperationResponse>().withOperationName("StreamingInputOutputOperation").withMarshaller(AsyncStreamingRequestMarshaller.builder().delegateMarshaller(new StreamingInputOutputOperationRequestMarshaller(protocolFactory)).asyncRequestBody(requestBody).transferEncoding(true).build()).withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector).withAsyncRequestBody(requestBody).withInput(streamingInputOutputOperationRequest), asyncResponseTransformer);
        AsyncResponseTransformer<StreamingInputOutputOperationResponse, ReturnT> finalAsyncResponseTransformer = asyncResponseTransformer;
        CompletableFuture<ReturnT> whenCompleted = executeFuture.whenComplete((r, e) -> {
            if (e != null) {
                runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", () -> finalAsyncResponseTransformer.exceptionOccurred(e));
            }
            endOfStreamFuture.whenComplete((r2, e2) -> {
                metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
            });
        });
        executeFuture = CompletableFutureUtils.forwardExceptionTo(whenCompleted, executeFuture);
        return executeFuture;
    } catch (Throwable t) {
        AsyncResponseTransformer<StreamingInputOutputOperationResponse, ReturnT> finalAsyncResponseTransformer = asyncResponseTransformer;
        runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", () -> finalAsyncResponseTransformer.exceptionOccurred(t));
        metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
        return CompletableFutureUtils.failedFuture(t);
    }
}
Also used : ExceptionMetadata(software.amazon.awssdk.protocols.core.ExceptionMetadata) AwsAsyncClientHandler(software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler) StreamingInputOutputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingInputOutputOperationRequestMarshaller) EventStreamOperationResponseHandler(software.amazon.awssdk.services.json.model.EventStreamOperationResponseHandler) AsyncStreamingRequestMarshaller(software.amazon.awssdk.core.runtime.transform.AsyncStreamingRequestMarshaller) AsyncResponseTransformer(software.amazon.awssdk.core.async.AsyncResponseTransformer) InputEventStreamTwo(software.amazon.awssdk.services.json.model.InputEventStreamTwo) StreamingInputOperationRequest(software.amazon.awssdk.services.json.model.StreamingInputOperationRequest) AsyncClientHandler(software.amazon.awssdk.core.client.handler.AsyncClientHandler) PaginatedOperationWithResultKeyResponse(software.amazon.awssdk.services.json.model.PaginatedOperationWithResultKeyResponse) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) PaginatedOperationWithResultKeyPublisher(software.amazon.awssdk.services.json.paginators.PaginatedOperationWithResultKeyPublisher) EventStreamOperationWithOnlyInputRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationWithOnlyInputRequestMarshaller) APostOperationWithOutputResponse(software.amazon.awssdk.services.json.model.APostOperationWithOutputResponse) EventStream(software.amazon.awssdk.services.json.model.EventStream) APostOperationRequest(software.amazon.awssdk.services.json.model.APostOperationRequest) PaginatedOperationWithoutResultKeyPublisher(software.amazon.awssdk.services.json.paginators.PaginatedOperationWithoutResultKeyPublisher) PaginatedOperationWithoutResultKeyResponse(software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyResponse) AsyncRequestBody(software.amazon.awssdk.core.async.AsyncRequestBody) AsyncAws4Signer(software.amazon.awssdk.auth.signer.AsyncAws4Signer) SdkAdvancedAsyncClientOption(software.amazon.awssdk.core.client.config.SdkAdvancedAsyncClientOption) APostOperationWithOutputRequestMarshaller(software.amazon.awssdk.services.json.transform.APostOperationWithOutputRequestMarshaller) EventStreamOperationRequest(software.amazon.awssdk.services.json.model.EventStreamOperationRequest) HttpResponseHandler(software.amazon.awssdk.core.http.HttpResponseHandler) Generated(software.amazon.awssdk.annotations.Generated) AsyncResponseTransformerUtils(software.amazon.awssdk.core.async.AsyncResponseTransformerUtils) PaginatedOperationWithResultKeyRequestMarshaller(software.amazon.awssdk.services.json.transform.PaginatedOperationWithResultKeyRequestMarshaller) PaginatedOperationWithoutResultKeyRequestMarshaller(software.amazon.awssdk.services.json.transform.PaginatedOperationWithoutResultKeyRequestMarshaller) OperationWithChecksumRequiredResponse(software.amazon.awssdk.services.json.model.OperationWithChecksumRequiredResponse) EventStreamTaggedUnionJsonMarshaller(software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionJsonMarshaller) VoidSdkResponse(software.amazon.awssdk.core.protocol.VoidSdkResponse) CompletableFutureUtils(software.amazon.awssdk.utils.CompletableFutureUtils) SdkClientConfiguration(software.amazon.awssdk.core.client.config.SdkClientConfiguration) VersionInfo(software.amazon.awssdk.core.util.VersionInfo) PaginatedOperationWithResultKeyRequest(software.amazon.awssdk.services.json.model.PaginatedOperationWithResultKeyRequest) CoreMetric(software.amazon.awssdk.core.metrics.CoreMetric) BaseAwsJsonProtocolFactory(software.amazon.awssdk.protocols.json.BaseAwsJsonProtocolFactory) RequestOverrideConfiguration(software.amazon.awssdk.core.RequestOverrideConfiguration) EventStreamOperationWithOnlyOutputResponse(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputResponse) StreamingOutputOperationRequest(software.amazon.awssdk.services.json.model.StreamingOutputOperationRequest) InputEventTwoMarshaller(software.amazon.awssdk.services.json.transform.InputEventTwoMarshaller) SdkInternalExecutionAttribute(software.amazon.awssdk.core.interceptor.SdkInternalExecutionAttribute) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) Executor(java.util.concurrent.Executor) Publisher(org.reactivestreams.Publisher) APostOperationWithOutputRequest(software.amazon.awssdk.services.json.model.APostOperationWithOutputRequest) EventStreamOperationWithOnlyInputResponse(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyInputResponse) SdkInternalApi(software.amazon.awssdk.annotations.SdkInternalApi) GetWithoutRequiredMembersResponse(software.amazon.awssdk.services.json.model.GetWithoutRequiredMembersResponse) DefaultInputEventTwo(software.amazon.awssdk.services.json.model.inputeventstreamtwo.DefaultInputEventTwo) GetWithoutRequiredMembersRequestMarshaller(software.amazon.awssdk.services.json.transform.GetWithoutRequiredMembersRequestMarshaller) LoggerFactory(org.slf4j.LoggerFactory) StreamingInputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingInputOperationRequestMarshaller) ByteBuffer(java.nio.ByteBuffer) JsonException(software.amazon.awssdk.services.json.model.JsonException) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) DefaultInputEvent(software.amazon.awssdk.services.json.model.inputeventstream.DefaultInputEvent) JsonOperationMetadata(software.amazon.awssdk.protocols.json.JsonOperationMetadata) EventStreamOperationWithOnlyInputRequest(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyInputRequest) ApiName(software.amazon.awssdk.core.ApiName) GetWithoutRequiredMembersRequest(software.amazon.awssdk.services.json.model.GetWithoutRequiredMembersRequest) SdkClientOption(software.amazon.awssdk.core.client.config.SdkClientOption) HostnameValidator(software.amazon.awssdk.utils.HostnameValidator) StreamingOutputOperationResponse(software.amazon.awssdk.services.json.model.StreamingOutputOperationResponse) APostOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.APostOperationRequestMarshaller) StreamingInputOperationResponse(software.amazon.awssdk.services.json.model.StreamingInputOperationResponse) EventStreamOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationRequestMarshaller) DefaultInputEventOne(software.amazon.awssdk.services.json.model.inputeventstreamtwo.DefaultInputEventOne) SdkPojoBuilder(software.amazon.awssdk.core.SdkPojoBuilder) InputEventMarshaller(software.amazon.awssdk.services.json.transform.InputEventMarshaller) OperationWithChecksumRequiredRequest(software.amazon.awssdk.services.json.model.OperationWithChecksumRequiredRequest) InputEventStream(software.amazon.awssdk.services.json.model.InputEventStream) List(java.util.List) APostOperationResponse(software.amazon.awssdk.services.json.model.APostOperationResponse) StreamingInputOutputOperationRequest(software.amazon.awssdk.services.json.model.StreamingInputOutputOperationRequest) AttachHttpMetadataResponseHandler(software.amazon.awssdk.core.client.handler.AttachHttpMetadataResponseHandler) Aws4UnsignedPayloadSigner(software.amazon.awssdk.auth.signer.Aws4UnsignedPayloadSigner) JsonRequest(software.amazon.awssdk.services.json.model.JsonRequest) EventStreamOperationWithOnlyOutputRequestMarshaller(software.amazon.awssdk.services.json.transform.EventStreamOperationWithOnlyOutputRequestMarshaller) OperationWithChecksumRequiredRequestMarshaller(software.amazon.awssdk.services.json.transform.OperationWithChecksumRequiredRequestMarshaller) AwsRequestOverrideConfiguration(software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration) Signer(software.amazon.awssdk.core.signer.Signer) AwsJsonProtocol(software.amazon.awssdk.protocols.json.AwsJsonProtocol) EventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer) EventStreamTaggedUnionPojoSupplier(software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionPojoSupplier) CompletableFuture(java.util.concurrent.CompletableFuture) HttpChecksumRequired(software.amazon.awssdk.core.interceptor.trait.HttpChecksumRequired) InvalidInputException(software.amazon.awssdk.services.json.model.InvalidInputException) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector) PaginatedOperationWithoutResultKeyRequest(software.amazon.awssdk.services.json.model.PaginatedOperationWithoutResultKeyRequest) Logger(org.slf4j.Logger) EventStreamOperationWithOnlyOutputRequest(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputRequest) Pair(software.amazon.awssdk.utils.Pair) SdkPublisher(software.amazon.awssdk.core.async.SdkPublisher) EventStreamAws4Signer(software.amazon.awssdk.auth.signer.EventStreamAws4Signer) Consumer(java.util.function.Consumer) StreamingOutputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingOutputOperationRequestMarshaller) ClientExecutionParams(software.amazon.awssdk.core.client.handler.ClientExecutionParams) EventStreamOperationWithOnlyOutputResponseHandler(software.amazon.awssdk.services.json.model.EventStreamOperationWithOnlyOutputResponseHandler) StreamingInputOutputOperationResponse(software.amazon.awssdk.services.json.model.StreamingInputOutputOperationResponse) AwsClientHandlerUtils(software.amazon.awssdk.awscore.client.handler.AwsClientHandlerUtils) EventStreamOperationResponse(software.amazon.awssdk.services.json.model.EventStreamOperationResponse) SdkResponse(software.amazon.awssdk.core.SdkResponse) AwsJsonProtocolFactory(software.amazon.awssdk.protocols.json.AwsJsonProtocolFactory) FunctionalUtils.runAndLogError(software.amazon.awssdk.utils.FunctionalUtils.runAndLogError) Collections(java.util.Collections) ClientExecutionParams(software.amazon.awssdk.core.client.handler.ClientExecutionParams) StreamingInputOutputOperationResponse(software.amazon.awssdk.services.json.model.StreamingInputOutputOperationResponse) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) JsonOperationMetadata(software.amazon.awssdk.protocols.json.JsonOperationMetadata) StreamingInputOutputOperationRequestMarshaller(software.amazon.awssdk.services.json.transform.StreamingInputOutputOperationRequestMarshaller) CompletableFuture(java.util.concurrent.CompletableFuture) AsyncResponseTransformer(software.amazon.awssdk.core.async.AsyncResponseTransformer) EventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector)

Example 4 with AsyncResponseTransformer

use of software.amazon.awssdk.core.async.AsyncResponseTransformer in project aws-sdk-java-v2 by aws.

the class DefaultXmlAsyncClient method streamingOutputOperation.

/**
 * Some operation with a streaming output
 *
 * @param streamingOutputOperationRequest
 * @param asyncResponseTransformer
 *        The response transformer for processing the streaming response in a non-blocking manner. See
 *        {@link AsyncResponseTransformer} for details on how this callback should be implemented and for links to
 *        precanned implementations for common scenarios like downloading to a file. The service documentation for
 *        the response content is as follows 'This be a stream'.
 * @return A future to the transformed result of the AsyncResponseTransformer.<br/>
 *         The CompletableFuture returned by this method can be completed exceptionally with the following
 *         exceptions.
 *         <ul>
 *         <li>SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
 *         Can be used for catch all scenarios.</li>
 *         <li>SdkClientException If any client side error occurs such as an IO related failure, failure to get
 *         credentials, etc.</li>
 *         <li>XmlException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
 *         of this type.</li>
 *         </ul>
 * @sample XmlAsyncClient.StreamingOutputOperation
 * @see <a href="https://docs.aws.amazon.com/goto/WebAPI/xml-service-2010-05-08/StreamingOutputOperation"
 *      target="_top">AWS API Documentation</a>
 */
@Override
public <ReturnT> CompletableFuture<ReturnT> streamingOutputOperation(StreamingOutputOperationRequest streamingOutputOperationRequest, AsyncResponseTransformer<StreamingOutputOperationResponse, ReturnT> asyncResponseTransformer) {
    List<MetricPublisher> metricPublishers = resolveMetricPublishers(clientConfiguration, streamingOutputOperationRequest.overrideConfiguration().orElse(null));
    MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector.create("ApiCall");
    try {
        apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service");
        apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "StreamingOutputOperation");
        Pair<AsyncResponseTransformer<StreamingOutputOperationResponse, ReturnT>, CompletableFuture<Void>> pair = AsyncResponseTransformerUtils.wrapWithEndOfStreamFuture(asyncResponseTransformer);
        asyncResponseTransformer = pair.left();
        CompletableFuture<Void> endOfStreamFuture = pair.right();
        HttpResponseHandler<StreamingOutputOperationResponse> responseHandler = protocolFactory.createResponseHandler(StreamingOutputOperationResponse::builder, new XmlOperationMetadata().withHasStreamingSuccessResponse(true));
        HttpResponseHandler<AwsServiceException> errorResponseHandler = protocolFactory.createErrorResponseHandler();
        CompletableFuture<ReturnT> executeFuture = clientHandler.execute(new ClientExecutionParams<StreamingOutputOperationRequest, StreamingOutputOperationResponse>().withOperationName("StreamingOutputOperation").withMarshaller(new StreamingOutputOperationRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector).withInput(streamingOutputOperationRequest), asyncResponseTransformer);
        CompletableFuture<ReturnT> whenCompleteFuture = null;
        AsyncResponseTransformer<StreamingOutputOperationResponse, ReturnT> finalAsyncResponseTransformer = asyncResponseTransformer;
        whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
            if (e != null) {
                runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", () -> finalAsyncResponseTransformer.exceptionOccurred(e));
            }
            endOfStreamFuture.whenComplete((r2, e2) -> {
                metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
            });
        });
        return CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
    } catch (Throwable t) {
        AsyncResponseTransformer<StreamingOutputOperationResponse, ReturnT> finalAsyncResponseTransformer = asyncResponseTransformer;
        runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", () -> finalAsyncResponseTransformer.exceptionOccurred(t));
        metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
        return CompletableFutureUtils.failedFuture(t);
    }
}
Also used : ExceptionMetadata(software.amazon.awssdk.protocols.core.ExceptionMetadata) AwsAsyncClientHandler(software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler) StreamingOutputOperationRequestMarshaller(software.amazon.awssdk.services.xml.transform.StreamingOutputOperationRequestMarshaller) EventStreamOperationResponseHandler(software.amazon.awssdk.services.xml.model.EventStreamOperationResponseHandler) GetOperationWithChecksumRequestMarshaller(software.amazon.awssdk.services.xml.transform.GetOperationWithChecksumRequestMarshaller) XmlRequest(software.amazon.awssdk.services.xml.model.XmlRequest) LoggerFactory(org.slf4j.LoggerFactory) StreamingOutputOperationRequest(software.amazon.awssdk.services.xml.model.StreamingOutputOperationRequest) RestEventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.RestEventStreamAsyncResponseTransformer) StreamingInputOperationResponse(software.amazon.awssdk.services.xml.model.StreamingInputOperationResponse) XmlException(software.amazon.awssdk.services.xml.model.XmlException) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) GetOperationWithChecksumResponse(software.amazon.awssdk.services.xml.model.GetOperationWithChecksumResponse) APostOperationRequest(software.amazon.awssdk.services.xml.model.APostOperationRequest) AsyncStreamingRequestMarshaller(software.amazon.awssdk.core.runtime.transform.AsyncStreamingRequestMarshaller) AsyncResponseTransformer(software.amazon.awssdk.core.async.AsyncResponseTransformer) SdkClientOption(software.amazon.awssdk.core.client.config.SdkClientOption) StreamingInputOperationRequest(software.amazon.awssdk.services.xml.model.StreamingInputOperationRequest) AsyncClientHandler(software.amazon.awssdk.core.client.handler.AsyncClientHandler) EventStreamOperationRequest(software.amazon.awssdk.services.xml.model.EventStreamOperationRequest) PutOperationWithChecksumRequestMarshaller(software.amazon.awssdk.services.xml.transform.PutOperationWithChecksumRequestMarshaller) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) XmlOperationMetadata(software.amazon.awssdk.protocols.xml.XmlOperationMetadata) OperationWithChecksumRequiredRequestMarshaller(software.amazon.awssdk.services.xml.transform.OperationWithChecksumRequiredRequestMarshaller) SdkPojoBuilder(software.amazon.awssdk.core.SdkPojoBuilder) EventStreamOperationRequestMarshaller(software.amazon.awssdk.services.xml.transform.EventStreamOperationRequestMarshaller) APostOperationRequestMarshaller(software.amazon.awssdk.services.xml.transform.APostOperationRequestMarshaller) List(java.util.List) AsyncRequestBody(software.amazon.awssdk.core.async.AsyncRequestBody) AwsXmlProtocolFactory(software.amazon.awssdk.protocols.xml.AwsXmlProtocolFactory) AsyncAws4Signer(software.amazon.awssdk.auth.signer.AsyncAws4Signer) SdkAdvancedAsyncClientOption(software.amazon.awssdk.core.client.config.SdkAdvancedAsyncClientOption) HttpResponseHandler(software.amazon.awssdk.core.http.HttpResponseHandler) Generated(software.amazon.awssdk.annotations.Generated) AsyncResponseTransformerUtils(software.amazon.awssdk.core.async.AsyncResponseTransformerUtils) GetOperationWithChecksumRequest(software.amazon.awssdk.services.xml.model.GetOperationWithChecksumRequest) AwsRequestOverrideConfiguration(software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration) Signer(software.amazon.awssdk.core.signer.Signer) OperationWithChecksumRequiredRequest(software.amazon.awssdk.services.xml.model.OperationWithChecksumRequiredRequest) EventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer) StreamingOutputOperationResponse(software.amazon.awssdk.services.xml.model.StreamingOutputOperationResponse) EventStreamTaggedUnionPojoSupplier(software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionPojoSupplier) PutOperationWithChecksumResponse(software.amazon.awssdk.services.xml.model.PutOperationWithChecksumResponse) CompletableFutureUtils(software.amazon.awssdk.utils.CompletableFutureUtils) CompletableFuture(java.util.concurrent.CompletableFuture) SdkClientConfiguration(software.amazon.awssdk.core.client.config.SdkClientConfiguration) Response(software.amazon.awssdk.core.Response) HttpChecksumRequired(software.amazon.awssdk.core.interceptor.trait.HttpChecksumRequired) StreamingInputOperationRequestMarshaller(software.amazon.awssdk.services.xml.transform.StreamingInputOperationRequestMarshaller) CoreMetric(software.amazon.awssdk.core.metrics.CoreMetric) APostOperationWithOutputResponse(software.amazon.awssdk.services.xml.model.APostOperationWithOutputResponse) RequestOverrideConfiguration(software.amazon.awssdk.core.RequestOverrideConfiguration) EventStream(software.amazon.awssdk.services.xml.model.EventStream) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector) Logger(org.slf4j.Logger) SdkInternalExecutionAttribute(software.amazon.awssdk.core.interceptor.SdkInternalExecutionAttribute) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) Executor(java.util.concurrent.Executor) APostOperationWithOutputRequestMarshaller(software.amazon.awssdk.services.xml.transform.APostOperationWithOutputRequestMarshaller) Pair(software.amazon.awssdk.utils.Pair) APostOperationResponse(software.amazon.awssdk.services.xml.model.APostOperationResponse) Consumer(java.util.function.Consumer) HttpChecksum(software.amazon.awssdk.core.interceptor.trait.HttpChecksum) InvalidInputException(software.amazon.awssdk.services.xml.model.InvalidInputException) APostOperationWithOutputRequest(software.amazon.awssdk.services.xml.model.APostOperationWithOutputRequest) ClientExecutionParams(software.amazon.awssdk.core.client.handler.ClientExecutionParams) PutOperationWithChecksumRequest(software.amazon.awssdk.services.xml.model.PutOperationWithChecksumRequest) SdkInternalApi(software.amazon.awssdk.annotations.SdkInternalApi) EventStreamOperationResponse(software.amazon.awssdk.services.xml.model.EventStreamOperationResponse) OperationWithChecksumRequiredResponse(software.amazon.awssdk.services.xml.model.OperationWithChecksumRequiredResponse) FunctionalUtils.runAndLogError(software.amazon.awssdk.utils.FunctionalUtils.runAndLogError) Collections(java.util.Collections) StreamingOutputOperationRequest(software.amazon.awssdk.services.xml.model.StreamingOutputOperationRequest) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) CompletableFuture(java.util.concurrent.CompletableFuture) StreamingOutputOperationRequestMarshaller(software.amazon.awssdk.services.xml.transform.StreamingOutputOperationRequestMarshaller) RestEventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.RestEventStreamAsyncResponseTransformer) AsyncResponseTransformer(software.amazon.awssdk.core.async.AsyncResponseTransformer) EventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) StreamingOutputOperationResponse(software.amazon.awssdk.services.xml.model.StreamingOutputOperationResponse) XmlOperationMetadata(software.amazon.awssdk.protocols.xml.XmlOperationMetadata)

Example 5 with AsyncResponseTransformer

use of software.amazon.awssdk.core.async.AsyncResponseTransformer in project aws-sdk-java-v2 by aws.

the class DefaultXmlAsyncClient method eventStreamOperation.

/**
 * Invokes the EventStreamOperation operation asynchronously.
 *
 * @param eventStreamOperationRequest
 * @return A Java Future containing the result of the EventStreamOperation operation returned by the service.<br/>
 *         The CompletableFuture returned by this method can be completed exceptionally with the following
 *         exceptions.
 *         <ul>
 *         <li>SdkException Base class for all exceptions that can be thrown by the SDK (both service and client).
 *         Can be used for catch all scenarios.</li>
 *         <li>SdkClientException If any client side error occurs such as an IO related failure, failure to get
 *         credentials, etc.</li>
 *         <li>XmlException Base class for all service exceptions. Unknown exceptions will be thrown as an instance
 *         of this type.</li>
 *         </ul>
 * @sample XmlAsyncClient.EventStreamOperation
 * @see <a href="https://docs.aws.amazon.com/goto/WebAPI/xml-service-2010-05-08/EventStreamOperation"
 *      target="_top">AWS API Documentation</a>
 */
@Override
public CompletableFuture<Void> eventStreamOperation(EventStreamOperationRequest eventStreamOperationRequest, EventStreamOperationResponseHandler asyncResponseHandler) {
    List<MetricPublisher> metricPublishers = resolveMetricPublishers(clientConfiguration, eventStreamOperationRequest.overrideConfiguration().orElse(null));
    MetricCollector apiCallMetricCollector = metricPublishers.isEmpty() ? NoOpMetricCollector.create() : MetricCollector.create("ApiCall");
    try {
        apiCallMetricCollector.reportMetric(CoreMetric.SERVICE_ID, "Xml Service");
        apiCallMetricCollector.reportMetric(CoreMetric.OPERATION_NAME, "EventStreamOperation");
        HttpResponseHandler<EventStreamOperationResponse> responseHandler = protocolFactory.createResponseHandler(EventStreamOperationResponse::builder, XmlOperationMetadata.builder().hasStreamingSuccessResponse(true).build());
        HttpResponseHandler<AwsServiceException> errorResponseHandler = protocolFactory.createErrorResponseHandler();
        HttpResponseHandler<? extends EventStream> eventResponseHandler = protocolFactory.createResponseHandler(EventStreamTaggedUnionPojoSupplier.builder().putSdkPojoSupplier("EventPayloadEvent", EventStream::eventPayloadEventBuilder).putSdkPojoSupplier("NonEventPayloadEvent", EventStream::nonEventPayloadEventBuilder).putSdkPojoSupplier("SecondEventPayloadEvent", EventStream::secondEventPayloadEventBuilder).defaultSdkPojoSupplier(() -> new SdkPojoBuilder(EventStream.UNKNOWN)).build(), XmlOperationMetadata.builder().hasStreamingSuccessResponse(false).build());
        CompletableFuture<Void> eventStreamTransformFuture = new CompletableFuture<>();
        EventStreamAsyncResponseTransformer<EventStreamOperationResponse, EventStream> asyncResponseTransformer = EventStreamAsyncResponseTransformer.<EventStreamOperationResponse, EventStream>builder().eventStreamResponseHandler(asyncResponseHandler).eventResponseHandler(eventResponseHandler).initialResponseHandler(responseHandler).exceptionResponseHandler(errorResponseHandler).future(eventStreamTransformFuture).executor(executor).serviceName(serviceName()).build();
        RestEventStreamAsyncResponseTransformer<EventStreamOperationResponse, EventStream> restAsyncResponseTransformer = RestEventStreamAsyncResponseTransformer.<EventStreamOperationResponse, EventStream>builder().eventStreamAsyncResponseTransformer(asyncResponseTransformer).eventStreamResponseHandler(asyncResponseHandler).build();
        CompletableFuture<Void> executeFuture = clientHandler.execute(new ClientExecutionParams<EventStreamOperationRequest, EventStreamOperationResponse>().withOperationName("EventStreamOperation").withMarshaller(new EventStreamOperationRequestMarshaller(protocolFactory)).withResponseHandler(responseHandler).withErrorResponseHandler(errorResponseHandler).withMetricCollector(apiCallMetricCollector).withInput(eventStreamOperationRequest), restAsyncResponseTransformer);
        CompletableFuture<Void> whenCompleteFuture = null;
        whenCompleteFuture = executeFuture.whenComplete((r, e) -> {
            if (e != null) {
                runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", () -> asyncResponseHandler.exceptionOccurred(e));
                eventStreamTransformFuture.completeExceptionally(e);
            }
            metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
        });
        CompletableFutureUtils.forwardExceptionTo(whenCompleteFuture, executeFuture);
        return CompletableFutureUtils.forwardExceptionTo(eventStreamTransformFuture, executeFuture);
    } catch (Throwable t) {
        runAndLogError(log, "Exception thrown in exceptionOccurred callback, ignoring", () -> asyncResponseHandler.exceptionOccurred(t));
        metricPublishers.forEach(p -> p.publish(apiCallMetricCollector.collect()));
        return CompletableFutureUtils.failedFuture(t);
    }
}
Also used : ExceptionMetadata(software.amazon.awssdk.protocols.core.ExceptionMetadata) AwsAsyncClientHandler(software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler) StreamingOutputOperationRequestMarshaller(software.amazon.awssdk.services.xml.transform.StreamingOutputOperationRequestMarshaller) EventStreamOperationResponseHandler(software.amazon.awssdk.services.xml.model.EventStreamOperationResponseHandler) GetOperationWithChecksumRequestMarshaller(software.amazon.awssdk.services.xml.transform.GetOperationWithChecksumRequestMarshaller) XmlRequest(software.amazon.awssdk.services.xml.model.XmlRequest) LoggerFactory(org.slf4j.LoggerFactory) StreamingOutputOperationRequest(software.amazon.awssdk.services.xml.model.StreamingOutputOperationRequest) RestEventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.RestEventStreamAsyncResponseTransformer) StreamingInputOperationResponse(software.amazon.awssdk.services.xml.model.StreamingInputOperationResponse) XmlException(software.amazon.awssdk.services.xml.model.XmlException) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) GetOperationWithChecksumResponse(software.amazon.awssdk.services.xml.model.GetOperationWithChecksumResponse) APostOperationRequest(software.amazon.awssdk.services.xml.model.APostOperationRequest) AsyncStreamingRequestMarshaller(software.amazon.awssdk.core.runtime.transform.AsyncStreamingRequestMarshaller) AsyncResponseTransformer(software.amazon.awssdk.core.async.AsyncResponseTransformer) SdkClientOption(software.amazon.awssdk.core.client.config.SdkClientOption) StreamingInputOperationRequest(software.amazon.awssdk.services.xml.model.StreamingInputOperationRequest) AsyncClientHandler(software.amazon.awssdk.core.client.handler.AsyncClientHandler) EventStreamOperationRequest(software.amazon.awssdk.services.xml.model.EventStreamOperationRequest) PutOperationWithChecksumRequestMarshaller(software.amazon.awssdk.services.xml.transform.PutOperationWithChecksumRequestMarshaller) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) XmlOperationMetadata(software.amazon.awssdk.protocols.xml.XmlOperationMetadata) OperationWithChecksumRequiredRequestMarshaller(software.amazon.awssdk.services.xml.transform.OperationWithChecksumRequiredRequestMarshaller) SdkPojoBuilder(software.amazon.awssdk.core.SdkPojoBuilder) EventStreamOperationRequestMarshaller(software.amazon.awssdk.services.xml.transform.EventStreamOperationRequestMarshaller) APostOperationRequestMarshaller(software.amazon.awssdk.services.xml.transform.APostOperationRequestMarshaller) List(java.util.List) AsyncRequestBody(software.amazon.awssdk.core.async.AsyncRequestBody) AwsXmlProtocolFactory(software.amazon.awssdk.protocols.xml.AwsXmlProtocolFactory) AsyncAws4Signer(software.amazon.awssdk.auth.signer.AsyncAws4Signer) SdkAdvancedAsyncClientOption(software.amazon.awssdk.core.client.config.SdkAdvancedAsyncClientOption) HttpResponseHandler(software.amazon.awssdk.core.http.HttpResponseHandler) Generated(software.amazon.awssdk.annotations.Generated) AsyncResponseTransformerUtils(software.amazon.awssdk.core.async.AsyncResponseTransformerUtils) GetOperationWithChecksumRequest(software.amazon.awssdk.services.xml.model.GetOperationWithChecksumRequest) AwsRequestOverrideConfiguration(software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration) Signer(software.amazon.awssdk.core.signer.Signer) OperationWithChecksumRequiredRequest(software.amazon.awssdk.services.xml.model.OperationWithChecksumRequiredRequest) EventStreamAsyncResponseTransformer(software.amazon.awssdk.awscore.eventstream.EventStreamAsyncResponseTransformer) StreamingOutputOperationResponse(software.amazon.awssdk.services.xml.model.StreamingOutputOperationResponse) EventStreamTaggedUnionPojoSupplier(software.amazon.awssdk.awscore.eventstream.EventStreamTaggedUnionPojoSupplier) PutOperationWithChecksumResponse(software.amazon.awssdk.services.xml.model.PutOperationWithChecksumResponse) CompletableFutureUtils(software.amazon.awssdk.utils.CompletableFutureUtils) CompletableFuture(java.util.concurrent.CompletableFuture) SdkClientConfiguration(software.amazon.awssdk.core.client.config.SdkClientConfiguration) Response(software.amazon.awssdk.core.Response) HttpChecksumRequired(software.amazon.awssdk.core.interceptor.trait.HttpChecksumRequired) StreamingInputOperationRequestMarshaller(software.amazon.awssdk.services.xml.transform.StreamingInputOperationRequestMarshaller) CoreMetric(software.amazon.awssdk.core.metrics.CoreMetric) APostOperationWithOutputResponse(software.amazon.awssdk.services.xml.model.APostOperationWithOutputResponse) RequestOverrideConfiguration(software.amazon.awssdk.core.RequestOverrideConfiguration) EventStream(software.amazon.awssdk.services.xml.model.EventStream) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector) Logger(org.slf4j.Logger) SdkInternalExecutionAttribute(software.amazon.awssdk.core.interceptor.SdkInternalExecutionAttribute) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) Executor(java.util.concurrent.Executor) APostOperationWithOutputRequestMarshaller(software.amazon.awssdk.services.xml.transform.APostOperationWithOutputRequestMarshaller) Pair(software.amazon.awssdk.utils.Pair) APostOperationResponse(software.amazon.awssdk.services.xml.model.APostOperationResponse) Consumer(java.util.function.Consumer) HttpChecksum(software.amazon.awssdk.core.interceptor.trait.HttpChecksum) InvalidInputException(software.amazon.awssdk.services.xml.model.InvalidInputException) APostOperationWithOutputRequest(software.amazon.awssdk.services.xml.model.APostOperationWithOutputRequest) ClientExecutionParams(software.amazon.awssdk.core.client.handler.ClientExecutionParams) PutOperationWithChecksumRequest(software.amazon.awssdk.services.xml.model.PutOperationWithChecksumRequest) SdkInternalApi(software.amazon.awssdk.annotations.SdkInternalApi) EventStreamOperationResponse(software.amazon.awssdk.services.xml.model.EventStreamOperationResponse) OperationWithChecksumRequiredResponse(software.amazon.awssdk.services.xml.model.OperationWithChecksumRequiredResponse) FunctionalUtils.runAndLogError(software.amazon.awssdk.utils.FunctionalUtils.runAndLogError) Collections(java.util.Collections) EventStreamOperationResponse(software.amazon.awssdk.services.xml.model.EventStreamOperationResponse) SdkPojoBuilder(software.amazon.awssdk.core.SdkPojoBuilder) MetricPublisher(software.amazon.awssdk.metrics.MetricPublisher) EventStreamOperationRequest(software.amazon.awssdk.services.xml.model.EventStreamOperationRequest) CompletableFuture(java.util.concurrent.CompletableFuture) EventStream(software.amazon.awssdk.services.xml.model.EventStream) AwsServiceException(software.amazon.awssdk.awscore.exception.AwsServiceException) NoOpMetricCollector(software.amazon.awssdk.metrics.NoOpMetricCollector) MetricCollector(software.amazon.awssdk.metrics.MetricCollector) EventStreamOperationRequestMarshaller(software.amazon.awssdk.services.xml.transform.EventStreamOperationRequestMarshaller)

Aggregations

AsyncResponseTransformer (software.amazon.awssdk.core.async.AsyncResponseTransformer)20 CompletableFuture (java.util.concurrent.CompletableFuture)18 Consumer (java.util.function.Consumer)16 ByteBuffer (java.nio.ByteBuffer)12 SdkResponse (software.amazon.awssdk.core.SdkResponse)12 SdkPublisher (software.amazon.awssdk.core.async.SdkPublisher)12 AsyncRequestBody (software.amazon.awssdk.core.async.AsyncRequestBody)11 Collections (java.util.Collections)10 List (java.util.List)10 Logger (org.slf4j.Logger)10 LoggerFactory (org.slf4j.LoggerFactory)10 Generated (software.amazon.awssdk.annotations.Generated)10 SdkInternalApi (software.amazon.awssdk.annotations.SdkInternalApi)10 AsyncAws4Signer (software.amazon.awssdk.auth.signer.AsyncAws4Signer)10 AwsRequestOverrideConfiguration (software.amazon.awssdk.awscore.AwsRequestOverrideConfiguration)10 AwsAsyncClientHandler (software.amazon.awssdk.awscore.client.handler.AwsAsyncClientHandler)10 AwsServiceException (software.amazon.awssdk.awscore.exception.AwsServiceException)10 RequestOverrideConfiguration (software.amazon.awssdk.core.RequestOverrideConfiguration)10 AsyncResponseTransformerUtils (software.amazon.awssdk.core.async.AsyncResponseTransformerUtils)10 SdkClientConfiguration (software.amazon.awssdk.core.client.config.SdkClientConfiguration)10