public interface GrpcUniExchange<O,I> extends GrpcWriteStream<O>
Modifier and Type | Method and Description |
---|---|
static <O,I> GrpcUniExchange<O,I> |
create(GrpcReadStream<I> read,
io.grpc.stub.StreamObserver<O> write) |
GrpcUniExchange<O,I> |
drainHandler(Handler<Void> handler)
Set a drain handler on the stream.
|
GrpcUniExchange<O,I> |
fail(Throwable t)
Send an error event into the stream.
|
GrpcUniExchange<O,I> |
handler(Handler<AsyncResult<I>> handler) |
GrpcUniExchange<O,I> |
setWriteQueueMaxSize(int maxSize)
Set the maximum size of the write queue to
maxSize . |
GrpcUniExchange<O,I> |
write(O data)
Write some data to the stream.
|
io.grpc.stub.StreamObserver<O> |
writeObserver()
Should not be used by end user, it is a simple accessor the the underlying gRPC StreamObserver.
|
create, exceptionHandler
end, end, end, end, write, writeQueueFull
static <O,I> GrpcUniExchange<O,I> create(GrpcReadStream<I> read, io.grpc.stub.StreamObserver<O> write)
GrpcUniExchange<O,I> handler(Handler<AsyncResult<I>> handler)
GrpcUniExchange<O,I> write(O data)
GrpcWriteStream
WriteStream.writeQueueFull()
method before writing. This is done automatically if using a Pump
.write
in interface GrpcWriteStream<O>
write
in interface WriteStream<O>
data
- the data to writeGrpcUniExchange<O,I> setWriteQueueMaxSize(int maxSize)
GrpcWriteStream
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 GrpcWriteStream<O>
setWriteQueueMaxSize
in interface WriteStream<O>
maxSize
- the max size of the write streamGrpcUniExchange<O,I> drainHandler(Handler<Void> handler)
GrpcWriteStream
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 GrpcWriteStream<O>
drainHandler
in interface WriteStream<O>
handler
- the handlerGrpcUniExchange<O,I> fail(Throwable t)
GrpcWriteStream
fail
in interface GrpcWriteStream<O>
t
- any errorio.grpc.stub.StreamObserver<O> writeObserver()
GrpcWriteStream
writeObserver
in interface GrpcWriteStream<O>
Copyright © 2023 Eclipse. All rights reserved.