public interface GrpcWriteStream<T> extends WriteStream<T>
Modifier and Type | Method and Description |
---|---|
boolean |
cancel()
Cancel the stream.
|
GrpcWriteStream<T> |
drainHandler(Handler<Void> handler)
Set a drain handler on the stream.
|
GrpcWriteStream<T> |
encoding(String encoding)
Set the stream encoding, e.g
identity or gzip . |
void |
end(Handler<AsyncResult<Void>> handler)
Same as
WriteStream.end() but with an handler called when the operation completes |
default void |
end(T data,
Handler<AsyncResult<Void>> handler)
Same as
#end(T) but with an handler called when the operation completes |
Future<Void> |
endMessage(GrpcMessage message)
End the stream with an encoded gRPC message.
|
GrpcWriteStream<T> |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the write stream.
|
MultiMap |
headers() |
GrpcWriteStream<T> |
setWriteQueueMaxSize(int i)
Set the maximum size of the write queue to
maxSize . |
void |
write(T t,
Handler<AsyncResult<Void>> handler)
Same as
#write(T) but with an handler called when the operation completes |
Future<Void> |
writeMessage(GrpcMessage message)
Write an encoded gRPC message.
|
end, end, write, writeQueueFull
GrpcWriteStream<T> encoding(String encoding)
identity
or gzip
.
It must be called before sending any message, otherwise {@code identity will be used.encoding
- the target message encodingGrpcWriteStream<T> exceptionHandler(Handler<Throwable> handler)
WriteStream
exceptionHandler
in interface StreamBase
exceptionHandler
in interface WriteStream<T>
handler
- the exception handlerGrpcWriteStream<T> setWriteQueueMaxSize(int i)
WriteStream
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
Pipe
to provide flow control.
The value is defined by the implementation of the stream, e.g in bytes for a
NetSocket
, etc...setWriteQueueMaxSize
in interface WriteStream<T>
i
- the max size of the write streamGrpcWriteStream<T> drainHandler(Handler<Void> handler)
WriteStream
Pipe
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 handlerFuture<Void> writeMessage(GrpcMessage message)
message
- the messageFuture<Void> endMessage(GrpcMessage message)
message
- the messageboolean cancel()
true
if the stream was cancelledvoid write(T t, Handler<AsyncResult<Void>> handler)
WriteStream
#write(T)
but with an handler
called when the operation completeswrite
in interface WriteStream<T>
void end(Handler<AsyncResult<Void>> handler)
WriteStream
WriteStream.end()
but with an handler
called when the operation completesend
in interface WriteStream<T>
default void end(T data, Handler<AsyncResult<Void>> handler)
WriteStream
#end(T)
but with an handler
called when the operation completesend
in interface WriteStream<T>
Copyright © 2023 Eclipse. All rights reserved.