public interface GrpcBidiExchange<I,O> extends GrpcReadStream<I>, GrpcWriteStream<O>
Modifier and Type | Method and Description |
---|---|
static <I,O> GrpcBidiExchange<I,O> |
create(GrpcReadStream<I> readStream,
io.grpc.stub.StreamObserver<O> writeObserver) |
static <I,O> GrpcBidiExchange<I,O> |
create(io.grpc.stub.StreamObserver<I> readObserver,
io.grpc.stub.StreamObserver<O> writeObserver) |
GrpcBidiExchange<I,O> |
drainHandler(Handler<Void> handler)
Set a drain handler on the stream.
|
GrpcBidiExchange<I,O> |
endHandler(Handler<Void> handler)
Set an end handler.
|
GrpcBidiExchange<I,O> |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the read stream.
|
GrpcBidiExchange<I,O> |
fail(Throwable t)
Send an error event into the stream.
|
GrpcBidiExchange<I,O> |
fetch(long amount)
Fetch the specified
amount of elements. |
GrpcBidiExchange<I,O> |
handler(Handler<I> handler)
Set a data handler.
|
GrpcBidiExchange<I,O> |
pause()
Pause the
ReadSupport . |
io.grpc.stub.StreamObserver<I> |
readObserver()
Should not be used by end user, it is a simple accessor the the underlying gRPC StreamObserver.
|
GrpcBidiExchange<I,O> |
resume()
Resume reading.
|
GrpcBidiExchange<I,O> |
setReadObserver(io.grpc.stub.StreamObserver<I> observer) |
GrpcBidiExchange<I,O> |
setWriteQueueMaxSize(int maxSize)
Set the maximum size of the write queue to
maxSize . |
GrpcBidiExchange<I,O> |
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, create
pipe, pipeTo, pipeTo
create
end, end, end, end, write, writeQueueFull
static <I,O> GrpcBidiExchange<I,O> create(GrpcReadStream<I> readStream, io.grpc.stub.StreamObserver<O> writeObserver)
static <I,O> GrpcBidiExchange<I,O> create(io.grpc.stub.StreamObserver<I> readObserver, io.grpc.stub.StreamObserver<O> writeObserver)
GrpcBidiExchange<I,O> exceptionHandler(Handler<Throwable> handler)
GrpcReadStream
exceptionHandler
in interface GrpcReadStream<I>
exceptionHandler
in interface GrpcWriteStream<O>
exceptionHandler
in interface ReadStream<I>
exceptionHandler
in interface StreamBase
exceptionHandler
in interface WriteStream<O>
handler
- the exception handlerGrpcBidiExchange<I,O> 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 writeGrpcBidiExchange<I,O> 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 streamGrpcBidiExchange<I,O> 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 handlerGrpcBidiExchange<I,O> fail(Throwable t)
GrpcWriteStream
fail
in interface GrpcWriteStream<O>
t
- any errorGrpcBidiExchange<I,O> handler(Handler<I> handler)
GrpcReadStream
handler
in interface GrpcReadStream<I>
handler
in interface ReadStream<I>
GrpcBidiExchange<I,O> pause()
GrpcReadStream
ReadSupport
. While it's paused, no data will be sent to the dataHandler
pause
in interface GrpcReadStream<I>
pause
in interface ReadStream<I>
GrpcBidiExchange<I,O> resume()
GrpcReadStream
ReadSupport
has been paused, reading will recommence on it.resume
in interface GrpcReadStream<I>
resume
in interface ReadStream<I>
GrpcBidiExchange<I,O> fetch(long amount)
GrpcReadStream
amount
of elements. If the ReadStream
has been paused, reading will
recommence with the specified amount
of items, otherwise the specified amount
will
be added to the current stream demand.fetch
in interface GrpcReadStream<I>
fetch
in interface ReadStream<I>
GrpcBidiExchange<I,O> endHandler(Handler<Void> handler)
GrpcReadStream
endHandler
in interface GrpcReadStream<I>
endHandler
in interface ReadStream<I>
io.grpc.stub.StreamObserver<I> readObserver()
GrpcReadStream
readObserver
in interface GrpcReadStream<I>
GrpcBidiExchange<I,O> setReadObserver(io.grpc.stub.StreamObserver<I> observer)
setReadObserver
in interface GrpcReadStream<I>
io.grpc.stub.StreamObserver<O> writeObserver()
GrpcWriteStream
writeObserver
in interface GrpcWriteStream<O>
Copyright © 2023 Eclipse. All rights reserved.