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

tech.ydb.core.grpc.GrpcReadStream Maven / Gradle / Ivy

There is a newer version: 2.3.0
Show newest version
package tech.ydb.core.grpc;

import java.util.concurrent.CompletableFuture;

import tech.ydb.core.Status;

/**
 *
 * @author Aleksandr Gorshenin
 * @param  type of message received
 */
public interface GrpcReadStream {
    interface Observer {
        void onNext(R value);
    }

    /**
     * Start a stream, using {@code observer} for processing response messages.
     * Returns future with the stream finish status.
     *
     * @param observer receives response messages
     * @return future with the stream finish status
     * @throws IllegalStateException if a method (including {@code start()}) on this class has been
     *                               called.
     */
    CompletableFuture start(Observer observer);

    /**
     * Prevent any further processing for this {@code GrpcReadStream}. No further messages may be sent or
     * will be received. The server is informed of cancellations, but may not stop processing the
     * call. The future for the stream finish status will be completed with CANCELLED code
     */
    void cancel();
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy