Package io.vertx.rxjava.grpc.client
Class GrpcClient
- java.lang.Object
-
- io.vertx.rxjava.grpc.client.GrpcClient
-
- All Implemented Interfaces:
RxDelegate
- Direct Known Subclasses:
GrpcIoClient
public class GrpcClient extends Object implements RxDelegate
A gRPC client for Vert.x Unlike traditional gRPC clients, this client does not rely on a generated RPC interface to interact with the service. Instead, you can interact with the service with a request/response interfaces and gRPC messages, very much like a traditional client. The client exposes 2 levels of API- a Protobuf message
#request(SocketAddress) API
:GrpcClientRequest
/GrpcClientResponse
with Protobuf messages to call any gRPC service in a generic way - a gRPC message
request(io.vertx.rxjava.core.net.SocketAddress)
:GrpcClientRequest
/GrpcClientRequest
with gRPC messages to call a given method of a gRPC service
original
non RX-ified interface using Vert.x codegen.
-
-
Field Summary
Fields Modifier and Type Field Description static TypeArg<GrpcClient>
__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description GrpcClient(GrpcClient delegate)
GrpcClient(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <Req,Resp,T>
Future<T>call(SocketAddress server, io.grpc.MethodDescriptor<Req,Resp> service, Handler<GrpcClientRequest<Req,Resp>> requestHandler, Function<GrpcClientResponse<Req,Resp>,Future<T>> resultFn)
Deprecated.static GrpcClient
client(Vertx vertx)
Create a new clientstatic GrpcClient
client(Vertx vertx, HttpClientOptions options)
Create a new clientstatic GrpcClient
client(Vertx vertx, GrpcClientOptions options)
Create a new clientFuture<Void>
close()
Close this client.boolean
equals(Object o)
GrpcClient
getDelegate()
int
hashCode()
static GrpcClient
newInstance(GrpcClient arg)
Future<GrpcClientRequest<Buffer,Buffer>>
request(SocketAddress server)
Connect to the remoteserver
and create a request for any hosted gRPC service.<Req,Resp>
Future<GrpcClientRequest<Req,Resp>>request(SocketAddress server, io.grpc.MethodDescriptor<Req,Resp> service)
Deprecated.<Req,Resp>
Future<GrpcClientRequest<Req,Resp>>request(SocketAddress server, ServiceMethod<Resp,Req> method)
Connect to the remoteserver
and create a request for any hosted gRPC service.<Req,Resp,T>
rx.Single<T>rxCall(SocketAddress server, io.grpc.MethodDescriptor<Req,Resp> service, Handler<GrpcClientRequest<Req,Resp>> requestHandler, Function<GrpcClientResponse<Req,Resp>,Future<T>> resultFn)
Deprecated.rx.Single<Void>
rxClose()
Close this client.rx.Single<GrpcClientRequest<Buffer,Buffer>>
rxRequest(SocketAddress server)
Connect to the remoteserver
and create a request for any hosted gRPC service.<Req,Resp>
rx.Single<GrpcClientRequest<Req,Resp>>rxRequest(SocketAddress server, io.grpc.MethodDescriptor<Req,Resp> service)
Deprecated.<Req,Resp>
rx.Single<GrpcClientRequest<Req,Resp>>rxRequest(SocketAddress server, ServiceMethod<Resp,Req> method)
Connect to the remoteserver
and create a request for any hosted gRPC service.String
toString()
-
-
-
Field Detail
-
__TYPE_ARG
public static final TypeArg<GrpcClient> __TYPE_ARG
-
-
Constructor Detail
-
GrpcClient
public GrpcClient(GrpcClient delegate)
-
GrpcClient
public GrpcClient(Object delegate)
-
-
Method Detail
-
getDelegate
public GrpcClient getDelegate()
- Specified by:
getDelegate
in interfaceRxDelegate
-
client
public static GrpcClient client(Vertx vertx)
Create a new client- Parameters:
vertx
- the vertx instance- Returns:
- the created client
-
client
public static GrpcClient client(Vertx vertx, GrpcClientOptions options)
Create a new client- Parameters:
vertx
- the vertx instanceoptions
-- Returns:
- the created client
-
client
public static GrpcClient client(Vertx vertx, HttpClientOptions options)
Create a new client- Parameters:
vertx
- the vertx instanceoptions
- the client options- Returns:
- the created client
-
request
public Future<GrpcClientRequest<Buffer,Buffer>> request(SocketAddress server)
Connect to the remoteserver
and create a request for any hosted gRPC service.- Parameters:
server
- the server hosting the service- Returns:
- a future request
-
rxRequest
public rx.Single<GrpcClientRequest<Buffer,Buffer>> rxRequest(SocketAddress server)
Connect to the remoteserver
and create a request for any hosted gRPC service.- Parameters:
server
- the server hosting the service- Returns:
- a future request
-
request
public <Req,Resp> Future<GrpcClientRequest<Req,Resp>> request(SocketAddress server, ServiceMethod<Resp,Req> method)
Connect to the remoteserver
and create a request for any hosted gRPC service.- Parameters:
server
- the server hosting the servicemethod
- the grpc method- Returns:
- a future request
-
rxRequest
public <Req,Resp> rx.Single<GrpcClientRequest<Req,Resp>> rxRequest(SocketAddress server, ServiceMethod<Resp,Req> method)
Connect to the remoteserver
and create a request for any hosted gRPC service.- Parameters:
server
- the server hosting the servicemethod
- the grpc method- Returns:
- a future request
-
rxClose
public rx.Single<Void> rxClose()
Close this client.- Returns:
-
request
@Deprecated public <Req,Resp> Future<GrpcClientRequest<Req,Resp>> request(SocketAddress server, io.grpc.MethodDescriptor<Req,Resp> service)
Deprecated.- Parameters:
server
-service
-- Returns:
-
rxRequest
@Deprecated public <Req,Resp> rx.Single<GrpcClientRequest<Req,Resp>> rxRequest(SocketAddress server, io.grpc.MethodDescriptor<Req,Resp> service)
Deprecated.- Parameters:
server
-service
-- Returns:
-
call
@Deprecated public <Req,Resp,T> Future<T> call(SocketAddress server, io.grpc.MethodDescriptor<Req,Resp> service, Handler<GrpcClientRequest<Req,Resp>> requestHandler, Function<GrpcClientResponse<Req,Resp>,Future<T>> resultFn)
Deprecated.- Parameters:
server
-service
-requestHandler
-resultFn
-- Returns:
-
rxCall
@Deprecated public <Req,Resp,T> rx.Single<T> rxCall(SocketAddress server, io.grpc.MethodDescriptor<Req,Resp> service, Handler<GrpcClientRequest<Req,Resp>> requestHandler, Function<GrpcClientResponse<Req,Resp>,Future<T>> resultFn)
Deprecated.- Parameters:
server
-service
-requestHandler
-resultFn
-- Returns:
-
newInstance
public static GrpcClient newInstance(GrpcClient arg)
-
-