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(io.vertx.core.Handler<Void> handler)
Set a drain handler on the stream.
|
GrpcBidiExchange<I,O> |
endHandler(io.vertx.core.Handler<Void> handler)
Set an end handler.
|
GrpcBidiExchange<I,O> |
exceptionHandler(io.vertx.core.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(io.vertx.core.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
create
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(io.vertx.core.Handler<Throwable> handler)
GrpcReadStream
exceptionHandler
in interface GrpcReadStream<I>
exceptionHandler
in interface GrpcWriteStream<O>
exceptionHandler
in interface io.vertx.core.streams.ReadStream<I>
exceptionHandler
in interface io.vertx.core.streams.StreamBase
exceptionHandler
in interface io.vertx.core.streams.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 io.vertx.core.streams.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 io.vertx.core.eventbus.Message
for a
io.vertx.core.eventbus.MessageProducer
, etc...setWriteQueueMaxSize
in interface GrpcWriteStream<O>
setWriteQueueMaxSize
in interface io.vertx.core.streams.WriteStream<O>
maxSize
- the max size of the write streamGrpcBidiExchange<I,O> drainHandler(io.vertx.core.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 io.vertx.core.streams.WriteStream<O>
handler
- the handlerGrpcBidiExchange<I,O> fail(Throwable t)
GrpcWriteStream
fail
in interface GrpcWriteStream<O>
t
- any errorGrpcBidiExchange<I,O> handler(io.vertx.core.Handler<I> handler)
GrpcReadStream
handler
in interface GrpcReadStream<I>
handler
in interface io.vertx.core.streams.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 io.vertx.core.streams.ReadStream<I>
GrpcBidiExchange<I,O> resume()
GrpcReadStream
ReadSupport
has been paused, reading will recommence on it.resume
in interface GrpcReadStream<I>
resume
in interface io.vertx.core.streams.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 io.vertx.core.streams.ReadStream<I>
GrpcBidiExchange<I,O> endHandler(io.vertx.core.Handler<Void> handler)
GrpcReadStream
endHandler
in interface GrpcReadStream<I>
endHandler
in interface io.vertx.core.streams.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 © 2021 Eclipse. All rights reserved.