Class GrpcIoClient


  • public class GrpcIoClient
    extends GrpcClient

    Extends the so it can be utilized with .

    In Vert.x 5, the core is decoupled from `io.grpc.*` packages to support JPMS.

    NOTE: This class has been automatically generated from the original non RX-ified interface using Vert.x codegen.

    • Constructor Detail

      • GrpcIoClient

        public GrpcIoClient​(GrpcIoClient delegate)
      • GrpcIoClient

        public GrpcIoClient​(Object delegate)
    • Method Detail

      • client

        public static GrpcIoClient client​(Vertx vertx)
        Create a new client
        Parameters:
        vertx - the vertx instance
        Returns:
        the created client
      • client

        public static GrpcIoClient client​(Vertx vertx,
                                          GrpcClientOptions options)
        Create a new client
        Parameters:
        vertx - the vertx instance
        options -
        Returns:
        the created client
      • client

        public static GrpcIoClient client​(Vertx vertx,
                                          HttpClientOptions options)
        Create a new client
        Parameters:
        vertx - the vertx instance
        options - the client options
        Returns:
        the created client
      • 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()));
        Overrides:
        call in class GrpcClient
        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> rx.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()));
        Overrides:
        rxCall in class GrpcClient
        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