Package io.vertx.reactivex.grpc.server
Class GrpcServerResponse<Req,Resp>
- java.lang.Object
-
- io.vertx.reactivex.grpc.common.GrpcWriteStream<Resp>
-
- io.vertx.reactivex.grpc.server.GrpcServerResponse<Req,Resp>
-
- All Implemented Interfaces:
StreamBase,WriteStream<Resp>
public class GrpcServerResponse<Req,Resp> extends GrpcWriteStream<Resp>
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<GrpcServerResponse>__TYPE_ARGTypeArg<Req>__typeArg_0TypeArg<Resp>__typeArg_1
-
Constructor Summary
Constructors Constructor Description GrpcServerResponse(GrpcServerResponse delegate)GrpcServerResponse(Object delegate, TypeArg<Req> typeArg_0, TypeArg<Resp> typeArg_1)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GrpcServerResponse<Req,Resp>drainHandler(Handler<Void> handler)Set a drain handler on the stream.GrpcServerResponse<Req,Resp>encoding(String encoding)Set the stream encoding, e.gidentityorgzip.voidend()Same asWriteStream.end(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)but with anhandlercalled when the operation completesvoidend(Handler<AsyncResult<Void>> handler)Same asWriteStream.end(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)but with anhandlercalled when the operation completesvoidend(Resp data)Same as but with anhandlercalled when the operation completesvoidend(Resp data, Handler<AsyncResult<Void>> handler)Same as but with anhandlercalled when the operation completesbooleanequals(Object o)GrpcServerResponse<Req,Resp>exceptionHandler(Handler<Throwable> handler)Set an exception handler on the write stream.GrpcServerResponsegetDelegate()inthashCode()static <Req,Resp>
GrpcServerResponse<Req,Resp>newInstance(GrpcServerResponse arg)static <Req,Resp>
GrpcServerResponse<Req,Resp>newInstance(GrpcServerResponse arg, TypeArg<Req> __typeArg_Req, TypeArg<Resp> __typeArg_Resp)io.reactivex.CompletablerxEnd()Same asWriteStream.end(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)but with anhandlercalled when the operation completesio.reactivex.CompletablerxEnd(Resp data)Same as but with anhandlercalled when the operation completesio.reactivex.CompletablerxSend(io.reactivex.Flowable<Resp> body)io.reactivex.CompletablerxSend(ReadStream<Resp> body)io.reactivex.CompletablerxSend(Resp item)io.reactivex.CompletablerxWrite(Resp data)Same as but with anhandlercalled when the operation completesFuture<Void>send(io.reactivex.Flowable<Resp> body)Future<Void>send(ReadStream<Resp> body)Future<Void>send(Resp item)GrpcServerResponse<Req,Resp>setWriteQueueMaxSize(int maxSize)Set the maximum size of the write queue tomaxSize.GrpcServerResponse<Req,Resp>status(GrpcStatus status)Set the grpc status responseWriteStreamObserver<Resp>toObserver()StringtoString()WriteStreamSubscriber<Resp>toSubscriber()MultiMaptrailers()voidwrite(Resp data)Same as but with anhandlercalled when the operation completesvoidwrite(Resp data, Handler<AsyncResult<Void>> handler)Same as but with anhandlercalled when the operation completesbooleanwriteQueueFull()This will returntrueif there are more bytes in the write queue than the value set usingsetWriteQueueMaxSize(int)-
Methods inherited from class io.vertx.reactivex.grpc.common.GrpcWriteStream
cancel, endMessage, headers, newInstance, newInstance, rxEndMessage, rxWriteMessage, writeMessage
-
-
-
-
Method Detail
-
toString
public String toString()
- Overrides:
toStringin classGrpcWriteStream<Resp>
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classGrpcWriteStream<Resp>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classGrpcWriteStream<Resp>
-
getDelegate
public GrpcServerResponse getDelegate()
- Specified by:
getDelegatein interfaceStreamBase- Specified by:
getDelegatein interfaceWriteStream<Req>- Overrides:
getDelegatein classGrpcWriteStream<Resp>
-
toObserver
public WriteStreamObserver<Resp> toObserver()
- Overrides:
toObserverin classGrpcWriteStream<Resp>
-
toSubscriber
public WriteStreamSubscriber<Resp> toSubscriber()
- Overrides:
toSubscriberin classGrpcWriteStream<Resp>
-
write
public void write(Resp data, Handler<AsyncResult<Void>> handler)
Same as but with anhandlercalled when the operation completes- Specified by:
writein interfaceWriteStream<Req>- Overrides:
writein classGrpcWriteStream<Resp>- Parameters:
data-handler-
-
write
public void write(Resp data)
Same as but with anhandlercalled when the operation completes- Specified by:
writein interfaceWriteStream<Req>- Overrides:
writein classGrpcWriteStream<Resp>- Parameters:
data-
-
rxWrite
public io.reactivex.Completable rxWrite(Resp data)
Same as but with anhandlercalled when the operation completes- Specified by:
rxWritein interfaceWriteStream<Req>- Overrides:
rxWritein classGrpcWriteStream<Resp>- Parameters:
data-- Returns:
-
end
public void end(Handler<AsyncResult<Void>> handler)
Same asWriteStream.end(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)but with anhandlercalled when the operation completes- Specified by:
endin interfaceWriteStream<Req>- Overrides:
endin classGrpcWriteStream<Resp>- Parameters:
handler-
-
end
public void end()
Same asWriteStream.end(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)but with anhandlercalled when the operation completes- Specified by:
endin interfaceWriteStream<Req>- Overrides:
endin classGrpcWriteStream<Resp>
-
rxEnd
public io.reactivex.Completable rxEnd()
Same asWriteStream.end(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)but with anhandlercalled when the operation completes- Specified by:
rxEndin interfaceWriteStream<Req>- Overrides:
rxEndin classGrpcWriteStream<Resp>- Returns:
-
end
public void end(Resp data, Handler<AsyncResult<Void>> handler)
Same as but with anhandlercalled when the operation completes- Specified by:
endin interfaceWriteStream<Req>- Overrides:
endin classGrpcWriteStream<Resp>- Parameters:
data-handler-
-
end
public void end(Resp data)
Same as but with anhandlercalled when the operation completes- Specified by:
endin interfaceWriteStream<Req>- Overrides:
endin classGrpcWriteStream<Resp>- Parameters:
data-
-
rxEnd
public io.reactivex.Completable rxEnd(Resp data)
Same as but with anhandlercalled when the operation completes- Specified by:
rxEndin interfaceWriteStream<Req>- Overrides:
rxEndin classGrpcWriteStream<Resp>- Parameters:
data-- Returns:
-
writeQueueFull
public boolean writeQueueFull()
This will returntrueif there are more bytes in the write queue than the value set usingsetWriteQueueMaxSize(int)- Specified by:
writeQueueFullin interfaceWriteStream<Req>- Overrides:
writeQueueFullin classGrpcWriteStream<Resp>- Returns:
trueif write queue is full
-
status
public GrpcServerResponse<Req,Resp> status(GrpcStatus status)
Set the grpc status response- Parameters:
status- the status- Returns:
- a reference to this, so the API can be used fluently
-
encoding
public GrpcServerResponse<Req,Resp> encoding(String encoding)
Description copied from class:GrpcWriteStreamSet the stream encoding, e.gidentityorgzip. It must be called before sending any message, otherwise {@code identity will be used.- Overrides:
encodingin classGrpcWriteStream<Resp>- Parameters:
encoding- the target message encoding- Returns:
- a reference to this, so the API can be used fluently
-
trailers
public MultiMap trailers()
- Returns:
- the to write metadata trailers
-
exceptionHandler
public GrpcServerResponse<Req,Resp> exceptionHandler(Handler<Throwable> handler)
Description copied from interface:WriteStreamSet an exception handler on the write stream.- Specified by:
exceptionHandlerin interfaceStreamBase- Specified by:
exceptionHandlerin interfaceWriteStream<Req>- Overrides:
exceptionHandlerin classGrpcWriteStream<Resp>- Parameters:
handler- the exception handler- Returns:
- a reference to this, so the API can be used fluently
-
setWriteQueueMaxSize
public GrpcServerResponse<Req,Resp> setWriteQueueMaxSize(int maxSize)
Description copied from interface:WriteStreamSet the maximum size of the write queue tomaxSize. You will still be able to write to the stream even if there is more thanmaxSizeitems in the write queue. This is used as an indicator by classes such asPipeto provide flow control. The value is defined by the implementation of the stream, e.g in bytes for aNetSocket, etc...- Specified by:
setWriteQueueMaxSizein interfaceWriteStream<Req>- Overrides:
setWriteQueueMaxSizein classGrpcWriteStream<Resp>- Parameters:
maxSize- the max size of the write stream- Returns:
- a reference to this, so the API can be used fluently
-
drainHandler
public GrpcServerResponse<Req,Resp> drainHandler(Handler<Void> handler)
Description copied from interface:WriteStreamSet a drain handler on the stream. If the write queue is full, then the handler will be called when the write queue is ready to accept buffers again. SeePipefor 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.- Specified by:
drainHandlerin interfaceWriteStream<Req>- Overrides:
drainHandlerin classGrpcWriteStream<Resp>- Parameters:
handler- the handler- Returns:
- a reference to this, so the API can be used fluently
-
rxSend
public io.reactivex.Completable rxSend(Resp item)
-
send
public Future<Void> send(ReadStream<Resp> body)
-
rxSend
public io.reactivex.Completable rxSend(ReadStream<Resp> body)
-
rxSend
public io.reactivex.Completable rxSend(io.reactivex.Flowable<Resp> body)
-
newInstance
public static <Req,Resp> GrpcServerResponse<Req,Resp> newInstance(GrpcServerResponse arg)
-
newInstance
public static <Req,Resp> GrpcServerResponse<Req,Resp> newInstance(GrpcServerResponse arg, TypeArg<Req> __typeArg_Req, TypeArg<Resp> __typeArg_Resp)
-
-