All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awssdk.eventstreamrpc.StreamResponseHandler Maven / Gradle / Ivy

There is a newer version: 1.21.0
Show newest version
/**
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * SPDX-License-Identifier: Apache-2.0.
 */

/* This file is part of greengrass-ipc project. */

package software.amazon.awssdk.eventstreamrpc;

/**
 * Operation response handler is needed to invoke an operation that has a streaming
 * response element to it.
 *
 * @param  The stream event type
 */
public interface StreamResponseHandler {

    /**
     * Called when there is a stream event to process
     * @param streamEvent The stream event to process
     */
    void onStreamEvent(final StreamEventType streamEvent);

    /**
     * Called when there's an error in the stream. Return value of this function
     * suggests whether or not the client handling will keep the stream open
     * or close it.
     *
     * There are conditions when onStreamError() may be triggered but the client handling will
     * close the connection anyways.
     *
     * @param error The error that occurred
     * @return true if the stream should be closed on this error, false if stream should remain open
     */
    boolean onStreamError(final Throwable error);

    /**
     * Called when stream is closed
     */
    void onStreamClosed();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy