@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1788") public abstract class CallStreamObserver<V> extends Object implements StreamObserver<V>
In any call there are logically two StreamObserver
implementations:
Implementations of this class represent the 'outbound' message stream.
Constructor and Description |
---|
CallStreamObserver() |
Modifier and Type | Method and Description |
---|---|
abstract void |
disableAutoInboundFlowControl()
Disables automatic flow control where a token is returned to the peer after a call
to the 'inbound'
StreamObserver.onNext(Object) has completed. |
abstract boolean |
isReady()
If
true indicates that a call to StreamObserver.onNext(Object) will not require the entire
message to be buffered before it is sent to the peer. |
abstract void |
request(int count)
Requests the peer to produce
count more messages to be delivered to the 'inbound'
StreamObserver . |
abstract void |
setMessageCompression(boolean enable)
Sets message compression for subsequent calls to
StreamObserver.onNext(V) . |
abstract void |
setOnReadyHandler(Runnable onReadyHandler)
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onCompleted, onError, onNext
public abstract boolean isReady()
true
indicates that a call to StreamObserver.onNext(Object)
will not require the entire
message to be buffered before it is sent to the peer.public abstract void setOnReadyHandler(Runnable onReadyHandler)
Runnable
that will be executed every time the stream isReady()
state
changes from false
to true
. While it is not guaranteed that the same
thread will always be used to execute the Runnable
, it is guaranteed that executions
are serialized with calls to the 'inbound' StreamObserver
.
Note that the handler may be called some time after isReady()
has transitioned to
true as other callbacks may still be executing in the 'inbound' observer.
onReadyHandler
- to call when peer is ready to receive more messages.public abstract void disableAutoInboundFlowControl()
StreamObserver.onNext(Object)
has completed. If disabled
an application must make explicit calls to request(int)
to receive messages.
Note that for cases where the runtime knows that only one inbound message is allowed calling this method will have no effect and the runtime will always permit one and only one message. This is true for:
MethodDescriptor.MethodType.UNARY
operations on both the
client and server.
MethodDescriptor.MethodType.CLIENT_STREAMING
operations on the server.
MethodDescriptor.MethodType.SERVER_STREAMING
operations on the client.
public abstract void request(int count)
count
more messages to be delivered to the 'inbound'
StreamObserver
.count
- more messagespublic abstract void setMessageCompression(boolean enable)
StreamObserver.onNext(V)
.enable
- whether to enable compression.