Class GrpcClient

    • Constructor Detail

      • GrpcClient

        public GrpcClient​(GrpcClient delegate)
      • GrpcClient

        public GrpcClient​(Object delegate)
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • 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,
                                        HttpClientOptions options)
        Create a new client
        Parameters:
        vertx - the vertx instance
        options - the client options
        Returns:
        the created client
      • request

        public Future<GrpcClientRequest<Buffer,​Buffer>> request​(SocketAddress server)
        Connect to the remote server and create a request for any hosted gRPC service.
        Parameters:
        server - the server hosting the service
        Returns:
        a future request
      • rxRequest

        public io.reactivex.Single<GrpcClientRequest<Buffer,​Buffer>> rxRequest​(SocketAddress server)
        Connect to the remote server and create a request for any hosted gRPC service.
        Parameters:
        server - the server hosting the service
        Returns:
        a future request
      • close

        public Future<Void> close()
        Close this client.
        Returns:
      • rxClose

        public io.reactivex.Completable rxClose()
        Close this client.
        Returns:
      • request

        public <Req,​Resp> Future<GrpcClientRequest<Req,​Resp>> request​(SocketAddress server,
                                                                                  io.grpc.MethodDescriptor<Req,​Resp> service)
        Connect to the remote server and create a request for given method of a hosted gRPC service.
        Parameters:
        server - the server hosting the service
        service - the service to be called
        Returns:
        a future request
      • rxRequest

        public <Req,​Resp> io.reactivex.Single<GrpcClientRequest<Req,​Resp>> rxRequest​(SocketAddress server,
                                                                                                 io.grpc.MethodDescriptor<Req,​Resp> service)
        Connect to the remote server and create a request for given method of a hosted gRPC service.
        Parameters:
        server - the server hosting the service
        service - the service to be called
        Returns:
        a future request
      • call

        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)
        Call the service gRPC service hosted by server.

        The requestHandler is called to send the request, e.g. req -> req.send(item)

        The responseFunction extracts the result, e.g. resp -> resp.last()

        It can be used in various ways:

        • Future fut = client.call(..., req -> req.send(item), resp -> resp.last());
        • Future fut = client.call(..., req -> req.send(stream), resp -> resp.pipeTo(anotherService));
        • Future> fut = client.call(..., req -> req.send(stream), resp -> resp.collecting(Collectors.toList()));
        Parameters:
        server - the server hosting the service
        service - the service to call
        requestHandler - the handler called to send the request
        resultFn - the function applied to extract the result.
        Returns:
        a future of the result
      • rxCall

        public <Req,​Resp,​T> io.reactivex.Single<T> rxCall​(SocketAddress server,
                                                                      io.grpc.MethodDescriptor<Req,​Resp> service,
                                                                      Handler<GrpcClientRequest<Req,​Resp>> requestHandler,
                                                                      Function<GrpcClientResponse<Req,​Resp>,​Future<T>> resultFn)
        Call the service gRPC service hosted by server.

        The requestHandler is called to send the request, e.g. req -> req.send(item)

        The responseFunction extracts the result, e.g. resp -> resp.last()

        It can be used in various ways:

        • Future fut = client.call(..., req -> req.send(item), resp -> resp.last());
        • Future fut = client.call(..., req -> req.send(stream), resp -> resp.pipeTo(anotherService));
        • Future> fut = client.call(..., req -> req.send(stream), resp -> resp.collecting(Collectors.toList()));
        Parameters:
        server - the server hosting the service
        service - the service to call
        requestHandler - the handler called to send the request
        resultFn - the function applied to extract the result.
        Returns:
        a future of the result
      • call

        public <Req,​Resp,​T> Future<T> call​(SocketAddress server,
                                                       io.grpc.MethodDescriptor<Req,​Resp> service,
                                                       Handler<GrpcClientRequest<Req,​Resp>> requestHandler,
                                                       io.reactivex.functions.Function<GrpcClientResponse<Req,​Resp>,​io.reactivex.Single<T>> resultFn)
        Call the service gRPC service hosted by server.

        The requestHandler is called to send the request, e.g. req -> req.send(item)

        The responseFunction extracts the result, e.g. resp -> resp.last()

        It can be used in various ways:

        • Future fut = client.call(..., req -> req.send(item), resp -> resp.last());
        • Future fut = client.call(..., req -> req.send(stream), resp -> resp.pipeTo(anotherService));
        • Future> fut = client.call(..., req -> req.send(stream), resp -> resp.collecting(Collectors.toList()));
        Parameters:
        server - the server hosting the service
        service - the service to call
        requestHandler - the handler called to send the request
        resultFn - the function applied to extract the result.
        Returns:
        a future of the result
      • rxCall

        public <Req,​Resp,​T> io.reactivex.Single<T> rxCall​(SocketAddress server,
                                                                      io.grpc.MethodDescriptor<Req,​Resp> service,
                                                                      Handler<GrpcClientRequest<Req,​Resp>> requestHandler,
                                                                      io.reactivex.functions.Function<GrpcClientResponse<Req,​Resp>,​io.reactivex.Single<T>> resultFn)
        Call the service gRPC service hosted by server.

        The requestHandler is called to send the request, e.g. req -> req.send(item)

        The responseFunction extracts the result, e.g. resp -> resp.last()

        It can be used in various ways:

        • Future fut = client.call(..., req -> req.send(item), resp -> resp.last());
        • Future fut = client.call(..., req -> req.send(stream), resp -> resp.pipeTo(anotherService));
        • Future> fut = client.call(..., req -> req.send(stream), resp -> resp.collecting(Collectors.toList()));
        Parameters:
        server - the server hosting the service
        service - the service to call
        requestHandler - the handler called to send the request
        resultFn - the function applied to extract the result.
        Returns:
        a future of the result