io.vertx.grpcio.client

## Interface GrpcIoClient

- All Superinterfaces:
    GrpcClient

      public interface GrpcIoClient
      extends GrpcClient

  Extends the `GrpcClient` so it can be utilized with `MethodDescriptor`.

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

- - ### Method Summary

    All Methods Static Methods Instance Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default <Req,Resp,T> Future<T>` | `call(SocketAddress server, io.grpc.MethodDescriptor<Req,Resp> service, Handler<GrpcClientRequest<Req,Resp>> requestHandler, java.util.function.Function<GrpcClientResponse<Req,Resp>,Future<T>> resultFn)` Call the `service` gRPC service hosted by `server`.
    `static GrpcIoClient` | `client(Vertx vertx)` Create a new client
    `static GrpcIoClient` | `client(Vertx vertx, GrpcClientOptions options)` Create a new client
    `static GrpcIoClient` | `client(Vertx vertx, HttpClientOptions options)` Create a new client

    - ### Methods inherited from interface io.vertx.grpc.client.GrpcClient

      `close, request, request, request`

- - ### Method Detail

    - #### client

          static GrpcIoClient client(Vertx vertx)

      Create a new client
      Specified by:
        `client` in interface `GrpcClient`
      Parameters:
        `vertx` - the vertx instance
      Returns:
        the created client

    - #### client

          static GrpcIoClient client(Vertx vertx,
                                     GrpcClientOptions options)

      Create a new client
      Specified by:
        `client` in interface `GrpcClient`
      Parameters:
        `vertx` - the vertx instance
      Returns:
        the created client

    - #### client

          static GrpcIoClient client(Vertx vertx,
                                     HttpClientOptions options)

      Create a new client
      Specified by:
        `client` in interface `GrpcClient`
      Parameters:
        `vertx` - the vertx instance
        `options` - the client options
      Returns:
        the created client

    - #### call

          default <Req,Resp,T> Future<T> call(SocketAddress server,
                                              io.grpc.MethodDescriptor<Req,Resp> service,
                                              Handler<GrpcClientRequest<Req,Resp>> requestHandler,
                                              java.util.function.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<Resp> fut = client.call(..., req -> req.send(item), resp -> resp.last());`
      - `Future<Void> fut = client.call(..., req -> req.send(stream), resp -> resp.pipeTo(anotherService));`
      - `Future<List<Resp>> fut = client.call(..., req -> req.send(stream), resp -> resp.collecting(Collectors.toList()));`

      Specified by:
        `call` in interface `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

Copyright © 2025 Eclipse. All rights reserved.