public class GrpcClientRequest<Req,Resp> extends GrpcWriteStream<Req>
You interact with the remote service with gRPC generated messages or protobuf encoded messages.
Before sending a request you need to set #serviceName) and #methodName) or
alternatively the service fullMethodName(java.lang.String).
Writing a request message will send the request to the service:
WriteStream.end(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>)original non RX-ified interface using Vert.x codegen.| Modifier and Type | Field and Description |
|---|---|
static io.vertx.lang.rx.TypeArg<GrpcClientRequest> |
__TYPE_ARG |
io.vertx.lang.rx.TypeArg<Req> |
__typeArg_0 |
io.vertx.lang.rx.TypeArg<Resp> |
__typeArg_1 |
| Constructor and Description |
|---|
GrpcClientRequest(GrpcClientRequest delegate) |
GrpcClientRequest(Object delegate,
io.vertx.lang.rx.TypeArg<Req> typeArg_0,
io.vertx.lang.rx.TypeArg<Resp> typeArg_1) |
| Modifier and Type | Method and Description |
|---|---|
HttpConnection |
connection() |
GrpcClientRequest<Req,Resp> |
drainHandler(Handler<Void> handler)
Set a drain handler on the stream.
|
GrpcClientRequest<Req,Resp> |
encoding(String encoding)
Set the stream encoding, e.g
identity or gzip. |
void |
end()
Same as
WriteStream.end(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
end(Handler<AsyncResult<Void>> handler)
Same as
WriteStream.end(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
void |
end(Req data)
Same as but with an
handler called when the operation completes |
void |
end(Req data,
Handler<AsyncResult<Void>> handler)
Same as but with an
handler called when the operation completes |
boolean |
equals(Object o) |
GrpcClientRequest<Req,Resp> |
exceptionHandler(Handler<Throwable> handler)
Set an exception handler on the write stream.
|
GrpcClientRequest<Req,Resp> |
fullMethodName(String fullMethodName)
Set the full method name to call, it must follow the format
package-name + '.' + service-name + '/' + method-name
or an IllegalArgumentException is thrown. |
GrpcClientRequest |
getDelegate() |
int |
hashCode() |
GrpcClientRequest<Req,Resp> |
methodName(String methodName)
Set the method name to call.
|
static <Req,Resp> GrpcClientRequest<Req,Resp> |
newInstance(GrpcClientRequest arg) |
static <Req,Resp> GrpcClientRequest<Req,Resp> |
newInstance(GrpcClientRequest arg,
io.vertx.lang.rx.TypeArg<Req> __typeArg_Req,
io.vertx.lang.rx.TypeArg<Resp> __typeArg_Resp) |
Future<GrpcClientResponse<Req,Resp>> |
response() |
Completable |
rxEnd()
Same as
WriteStream.end(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completes |
Completable |
rxEnd(Req data)
Same as but with an
handler called when the operation completes |
Single<GrpcClientResponse<Req,Resp>> |
rxResponse() |
Single<GrpcClientResponse<Req,Resp>> |
rxSend(Flowable<Req> body) |
Single<GrpcClientResponse<Req,Resp>> |
rxSend(ReadStream<Req> body) |
Single<GrpcClientResponse<Req,Resp>> |
rxSend(Req item) |
Completable |
rxWrite(Req data)
Same as but with an
handler called when the operation completes |
Future<GrpcClientResponse<Req,Resp>> |
send(Flowable<Req> body) |
Future<GrpcClientResponse<Req,Resp>> |
send(ReadStream<Req> body) |
Future<GrpcClientResponse<Req,Resp>> |
send(Req item) |
GrpcClientRequest<Req,Resp> |
serviceName(ServiceName serviceName)
Set the service name to call.
|
GrpcClientRequest<Req,Resp> |
setWriteQueueMaxSize(int maxSize)
Set the maximum size of the write queue to
maxSize. |
WriteStreamObserver<Req> |
toObserver() |
String |
toString() |
WriteStreamSubscriber<Req> |
toSubscriber() |
void |
write(Req data)
Same as but with an
handler called when the operation completes |
void |
write(Req data,
Handler<AsyncResult<Void>> handler)
Same as but with an
handler called when the operation completes |
boolean |
writeQueueFull()
This will return
true if there are more bytes in the write queue than the value set using setWriteQueueMaxSize(int) |
cancel, endMessage, headers, newInstance, newInstance, rxEndMessage, rxWriteMessage, writeMessageclone, finalize, getClass, notify, notifyAll, wait, wait, waitnewInstance, newInstancenewInstancepublic static final io.vertx.lang.rx.TypeArg<GrpcClientRequest> __TYPE_ARG
public final io.vertx.lang.rx.TypeArg<Req> __typeArg_0
public final io.vertx.lang.rx.TypeArg<Resp> __typeArg_1
public GrpcClientRequest(GrpcClientRequest delegate)
public String toString()
toString in class GrpcWriteStream<Req>public boolean equals(Object o)
equals in class GrpcWriteStream<Req>public int hashCode()
hashCode in class GrpcWriteStream<Req>public GrpcClientRequest getDelegate()
getDelegate in interface StreamBasegetDelegate in interface WriteStream<Req>getDelegate in class GrpcWriteStream<Req>public WriteStreamObserver<Req> toObserver()
toObserver in class GrpcWriteStream<Req>public WriteStreamSubscriber<Req> toSubscriber()
toSubscriber in class GrpcWriteStream<Req>public void write(Req data, Handler<AsyncResult<Void>> handler)
handler called when the operation completeswrite in interface WriteStream<Req>write in class GrpcWriteStream<Req>data - handler - public void write(Req data)
handler called when the operation completeswrite in interface WriteStream<Req>write in class GrpcWriteStream<Req>data - public Completable rxWrite(Req data)
handler called when the operation completesrxWrite in interface WriteStream<Req>rxWrite in class GrpcWriteStream<Req>data - public void end(Handler<AsyncResult<Void>> handler)
WriteStream.end(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesend in interface WriteStream<Req>end in class GrpcWriteStream<Req>handler - public void end()
WriteStream.end(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesend in interface WriteStream<Req>end in class GrpcWriteStream<Req>public Completable rxEnd()
WriteStream.end(io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Void>>) but with an handler called when the operation completesrxEnd in interface WriteStream<Req>rxEnd in class GrpcWriteStream<Req>public void end(Req data, Handler<AsyncResult<Void>> handler)
handler called when the operation completesend in interface WriteStream<Req>end in class GrpcWriteStream<Req>data - handler - public void end(Req data)
handler called when the operation completesend in interface WriteStream<Req>end in class GrpcWriteStream<Req>data - public Completable rxEnd(Req data)
handler called when the operation completesrxEnd in interface WriteStream<Req>rxEnd in class GrpcWriteStream<Req>data - public boolean writeQueueFull()
true if there are more bytes in the write queue than the value set using setWriteQueueMaxSize(int)writeQueueFull in interface WriteStream<Req>writeQueueFull in class GrpcWriteStream<Req>true if write queue is fullpublic GrpcClientRequest<Req,Resp> encoding(String encoding)
GrpcWriteStreamidentity or gzip.
It must be called before sending any message, otherwise {@code identity will be used.encoding in class GrpcWriteStream<Req>encoding - the target message encodingpublic GrpcClientRequest<Req,Resp> fullMethodName(String fullMethodName)
package-name + '.' + service-name + '/' + method-name
or an IllegalArgumentException is thrown.
It must be called before sending the request otherwise an IllegalStateException is thrown.
fullMethodName - the full method name to callpublic GrpcClientRequest<Req,Resp> serviceName(ServiceName serviceName)
It must be called before sending the request otherwise an IllegalStateException is thrown.
serviceName - the service name to callpublic GrpcClientRequest<Req,Resp> methodName(String methodName)
It must be called before sending the request otherwise an IllegalStateException is thrown.
methodName - the method name to callpublic Future<GrpcClientResponse<Req,Resp>> response()
public Single<GrpcClientResponse<Req,Resp>> rxResponse()
public GrpcClientRequest<Req,Resp> exceptionHandler(Handler<Throwable> handler)
WriteStreamexceptionHandler in interface StreamBaseexceptionHandler in interface WriteStream<Req>exceptionHandler in class GrpcWriteStream<Req>handler - the exception handlerpublic GrpcClientRequest<Req,Resp> setWriteQueueMaxSize(int maxSize)
WriteStreammaxSize. 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<Req>setWriteQueueMaxSize in class GrpcWriteStream<Req>maxSize - the max size of the write streampublic GrpcClientRequest<Req,Resp> drainHandler(Handler<Void> handler)
WriteStreamPipe 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<Req>drainHandler in class GrpcWriteStream<Req>handler - the handlerpublic HttpConnection connection()
public Future<GrpcClientResponse<Req,Resp>> send(Req item)
public Single<GrpcClientResponse<Req,Resp>> rxSend(Req item)
public Future<GrpcClientResponse<Req,Resp>> send(ReadStream<Req> body)
public Single<GrpcClientResponse<Req,Resp>> rxSend(ReadStream<Req> body)
public static <Req,Resp> GrpcClientRequest<Req,Resp> newInstance(GrpcClientRequest arg)
public static <Req,Resp> GrpcClientRequest<Req,Resp> newInstance(GrpcClientRequest arg, io.vertx.lang.rx.TypeArg<Req> __typeArg_Req, io.vertx.lang.rx.TypeArg<Resp> __typeArg_Resp)
Copyright © 2023 Eclipse. All rights reserved.