Package io.vertx.grpc.server
Interface GrpcServer
- 
- All Superinterfaces:
 Handler<HttpServerRequest>
- All Known Subinterfaces:
 GrpcIoServer
public interface GrpcServer extends Handler<HttpServerRequest>
A gRPC server based on Vert.x HTTP server.
The server can be used as a
HttpServerhandler 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 Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description GrpcServeraddService(Service service)Add a service to this gRPC server.GrpcServercallHandler(Handler<GrpcServerRequest<Buffer,Buffer>> handler)Set a call handler that handles any call made to the server.<Req,Resp>
GrpcServercallHandler(ServiceMethod<Req,Resp> serviceMethod, Handler<GrpcServerRequest<Req,Resp>> handler)Set a service method call handler that handles any call made to the server for thefullMethodNameservice method.static GrpcServerserver(Vertx vertx)Create a blank gRPC server with default options.static GrpcServerserver(Vertx vertx, GrpcServerOptions options)Create a blank gRPC server with specified options.List<Service>services()Get a list of all services registered with this gRPC server. 
 - 
 
- 
- 
Method Detail
- 
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
GrpcServer callHandler(Handler<GrpcServerRequest<Buffer,Buffer>> handler)
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 thefullMethodNameservice method.- Parameters:
 handler- the service method call handlerserviceMethod- the service method- Returns:
 - a reference to this, so the API can be used fluently
 
 
- 
addService
GrpcServer addService(Service service)
Add a service to this gRPC server.This method registers a service with the server, allowing it to handle requests for that service. Each service must have a unique name.
- Parameters:
 service- the service to add- Returns:
 - a reference to this, so the API can be used fluently
 - Throws:
 IllegalStateException- if a service with the same name is already registered
 
 - 
 
 -