public interface GrpcWriteStream<T> extends WriteStream<T>
Modifier and Type | Method and Description |
---|---|
static <T> GrpcWriteStream<T> |
create(io.grpc.stub.StreamObserver<T> observer) |
GrpcWriteStream<T> |
drainHandler(Handler<Void> handler)
Set a drain handler on the stream.
|
GrpcWriteStream<T> |
exceptionHandler(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.
|
end, end, end, end, write, writeQueueFull
static <T> GrpcWriteStream<T> create(io.grpc.stub.StreamObserver<T> observer)
GrpcWriteStream<T> exceptionHandler(Handler<Throwable> handler)
exceptionHandler
in interface StreamBase
exceptionHandler
in interface 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 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 Message
for a
MessageProducer
, etc...setWriteQueueMaxSize
in interface WriteStream<T>
maxSize
- the max size of the write streamGrpcWriteStream<T> drainHandler(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 WriteStream<T>
handler
- the handlerGrpcWriteStream<T> fail(Throwable t)
t
- any errorio.grpc.stub.StreamObserver<T> writeObserver()
Copyright © 2023 Eclipse. All rights reserved.