Interface GrpcServer

All Superinterfaces:
Handler<HttpServerRequest>, ServiceContainer
All Known Subinterfaces:
GrpcIoServer

public interface GrpcServer extends ServiceContainer, Handler<HttpServerRequest>

A gRPC server based on Vert.x HTTP server.

The server can be used as a HttpServer handler or mounted as a Vert.x Web handler.

Unlike traditional gRPC servers, this server 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 server handles only the gRPC protocol and does not encode/decode protobuf messages.

  • Method Details

    • server

      static GrpcServer server(Vertx vertx)
      Create a blank gRPC server with default options.
      Returns:
      the created server
    • server

      static GrpcServer server(Vertx vertx, GrpcServerOptions options)
      Create a blank gRPC server with specified options.
      Parameters:
      options - the gRPC server options
      Returns:
      the created server
    • callHandler

      Set a call handler that handles any call made to the server.
      Parameters:
      handler - the service method call handler
      Returns:
      a reference to this, so the API can be used fluently
    • callHandler

      <Req,Resp> GrpcServer callHandler(ServiceMethod<Req,Resp> serviceMethod, Handler<GrpcServerRequest<Req,Resp>> handler)
      Set a service method call handler that handles any call made to the server for the fullMethodName service method.
      Parameters:
      serviceMethod - the service method
      handler - the service method call handler
      Returns:
      a reference to this, so the API can be used fluently
    • addService

      GrpcServer addService(Service service)
      Description copied from interface: ServiceContainer
      Add a service to this server.
      Specified by:
      addService in interface ServiceContainer
      Parameters:
      service - the service to add
      Returns:
      a reference to this, so the API can be used fluently