public class GrpcServer extends Object implements Handler<HttpServerRequest>
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 exposes 2 levels of handlers
#callHandler(Handler) handler
: GrpcServerRequest
/GrpcServerResponse
with Protobuf message that handles any method call in a generic way#callHandler(MethodDescriptor, Handler) handler
: GrpcServerRequest
/GrpcServerRequest
with gRPC messages that handles specific service method callsoriginal
non RX-ified interface using Vert.x codegen.Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<GrpcServer> |
__TYPE_ARG |
Constructor and Description |
---|
GrpcServer(GrpcServer delegate) |
GrpcServer(Object delegate) |
Modifier and Type | Method and Description |
---|---|
GrpcServer |
callHandler(Handler<GrpcServerRequest<Buffer,Buffer>> handler)
Set a call handler that handles any call made to the server.
|
<Req,Resp> GrpcServer |
callHandler(io.grpc.MethodDescriptor<Req,Resp> methodDesc,
Handler<GrpcServerRequest<Req,Resp>> handler)
Set a service method call handler that handles any call call made to the server for the service method.
|
boolean |
equals(Object o) |
GrpcServer |
getDelegate() |
void |
handle(HttpServerRequest event)
Something has happened, so handle it.
|
int |
hashCode() |
static GrpcServer |
newInstance(GrpcServer arg) |
static GrpcServer |
server(Vertx vertx)
Create a blank gRPC server
|
String |
toString() |
public static final io.vertx.lang.rx.TypeArg<GrpcServer> __TYPE_ARG
public GrpcServer(GrpcServer delegate)
public GrpcServer(Object delegate)
public GrpcServer getDelegate()
public void handle(HttpServerRequest event)
handle
in interface Handler<HttpServerRequest>
event
- the event to handlepublic static GrpcServer server(Vertx vertx)
vertx
- public GrpcServer callHandler(Handler<GrpcServerRequest<Buffer,Buffer>> handler)
handler
- the service method call handlerpublic <Req,Resp> GrpcServer callHandler(io.grpc.MethodDescriptor<Req,Resp> methodDesc, Handler<GrpcServerRequest<Req,Resp>> handler)
methodDesc
- handler
- the service method call handlerpublic static GrpcServer newInstance(GrpcServer arg)
Copyright © 2023 Eclipse. All rights reserved.