io.vertx.rxjava.grpc.client

## Class GrpcClient

- java.lang.Object
- - io.vertx.rxjava.grpc.client.GrpcClient

-     public class GrpcClient
      extends Object

  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

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

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static io.vertx.lang.rx.TypeArg<GrpcClient>` | `__TYPE_ARG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GrpcClient(GrpcClient delegate)`
    `GrpcClient(Object delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<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 GrpcClient` | `client(Vertx vertx)` Create a new client
    `static GrpcClient` | `client(Vertx vertx, HttpClientOptions options)` Create a new client
    `Future<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 remote `server` and create a request for any hosted gRPC service.
    `<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.
    `<Req,Resp,T> Single<T>` | `rxCall(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`.
    `Single<Void>` | `rxClose()` Close this client.
    `Single<GrpcClientRequest<Buffer,Buffer>>` | `rxRequest(SocketAddress server)` Connect to the remote `server` and create a request for any hosted gRPC service.
    `<Req,Resp> 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.
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<GrpcClient> __TYPE_ARG

  - ### Constructor Detail

    - #### GrpcClient

          public GrpcClient(GrpcClient delegate)

    - #### GrpcClient

          public GrpcClient(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public GrpcClient getDelegate()

    - #### 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 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 Single<Void> 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> 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,
                                             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 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> Single<T> rxCall(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 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

    - #### newInstance

          public static GrpcClient newInstance(GrpcClient arg)

Copyright © 2023 Eclipse. All rights reserved.