public interface GrpcWriteStream<T>
extends io.vertx.core.streams.WriteStream<T>
Modifier and Type | Method and Description |
---|---|
static <T> GrpcWriteStream<T> |
create(io.grpc.stub.StreamObserver<T> observer) |
GrpcWriteStream<T> |
drainHandler(io.vertx.core.Handler<Void> handler)
Set a drain handler on the stream.
|
GrpcWriteStream<T> |
exceptionHandler(io.vertx.core.Handler<Throwable> handler)
Set an exception handler on the write stream.
|
GrpcWriteStream<T> |
fail(Throwable t)
Send an error event into the stream.
|
GrpcWriteStream<T> |
setWriteQueueMaxSize(int maxSize)
Set the maximum size of the write queue to
maxSize . |
GrpcWriteStream<T> |
write(T data)
Write some data to the stream.
|
io.grpc.stub.StreamObserver<T> |
writeObserver()
Should not be used by end user, it is a simple accessor the the underlying gRPC StreamObserver.
|
static <T> GrpcWriteStream<T> create(io.grpc.stub.StreamObserver<T> observer)
GrpcWriteStream<T> exceptionHandler(io.vertx.core.Handler<Throwable> handler)
exceptionHandler
in interface io.vertx.core.streams.StreamBase
exceptionHandler
in interface io.vertx.core.streams.WriteStream<T>
handler
- the exception handlerGrpcWriteStream<T> write(T data)
WriteStream.writeQueueFull()
method before writing. This is done automatically if using a Pump
.write
in interface io.vertx.core.streams.WriteStream<T>
data
- the data to writeGrpcWriteStream<T> setWriteQueueMaxSize(int maxSize)
maxSize
. You will still be able to write to the stream even
if there is more than maxSize
items in the write queue. This is used as an indicator by classes such as
Pump
to provide flow control.
The value is defined by the implementation of the stream, e.g in bytes for a
NetSocket
, the number of io.vertx.core.eventbus.Message
for a
io.vertx.core.eventbus.MessageProducer
, etc...setWriteQueueMaxSize
in interface io.vertx.core.streams.WriteStream<T>
maxSize
- the max size of the write streamGrpcWriteStream<T> drainHandler(io.vertx.core.Handler<Void> handler)
Pump
for an example of this being used.
The stream implementation defines when the drain handler, for example it could be when the queue size has been
reduced to maxSize / 2
.drainHandler
in interface io.vertx.core.streams.WriteStream<T>
handler
- the handlerGrpcWriteStream<T> fail(Throwable t)
t
- any errorio.grpc.stub.StreamObserver<T> writeObserver()
Copyright © 2019 Eclipse. All rights reserved.