@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1788") public abstract class ClientCallStreamObserver<V> extends CallStreamObserver<V>
CallStreamObserver
that allows for lower-level interaction with
client calls.
Like StreamObserver
, implementations are not required to be thread-safe; if multiple
threads will be writing to an instance concurrently, the application must synchronize its calls.
DO NOT MOCK: The API is too complex to reliably mock. Use InProcessChannelBuilder to create "real" RPCs suitable for testing and make a fake for the server-side.
Constructor and Description |
---|
ClientCallStreamObserver() |
Modifier and Type | Method and Description |
---|---|
abstract void |
cancel(java.lang.String message,
java.lang.Throwable cause)
Prevent any further processing for this
ClientCallStreamObserver . |
void |
disableAutoRequestWithInitial(int request)
Swaps to manual flow control where no message will be delivered to
StreamObserver.onNext(Object) unless it is request() ed. |
disableAutoInboundFlowControl, isReady, request, setMessageCompression, setOnReadyHandler
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onCompleted, onError, onNext
public abstract void cancel(@Nullable java.lang.String message, @Nullable java.lang.Throwable cause)
ClientCallStreamObserver
. No further messages
will be received. The server is informed of cancellations, but may not stop processing the
call. Cancelling an already
cancel()
ed ClientCallStreamObserver
has no effect.
No other methods on this class can be called after this method has been called.
It is recommended that at least one of the arguments to be non-null
, to provide
useful debug information. Both argument being null may log warnings and result in suboptimal
performance. Also note that the provided information will not be sent to the server.
message
- if not null
, will appear as the description of the CANCELLED statuscause
- if not null
, will appear as the cause of the CANCELLED statuspublic void disableAutoRequestWithInitial(int request)
StreamObserver.onNext(Object)
unless it is request()
ed. Since request()
may not be called before the call is started, a number of initial requests may be
specified.
This method may only be called during ClientResponseObserver.beforeStart()
.
This API is still a work in-progress and may change in the future.