tech.ydb.core.grpc.GrpcReadStream Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ydb-sdk-core Show documentation
Show all versions of ydb-sdk-core Show documentation
Core module of Java SDK for YDB
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();
}