Package io.vertx.reactivex.grpc.server
Class GrpcServer
- java.lang.Object
-
- io.vertx.reactivex.grpc.server.GrpcServer
-
- All Implemented Interfaces:
Handler<HttpServerRequest>
,io.vertx.lang.rx.RxDelegate
public class GrpcServer extends Object implements io.vertx.lang.rx.RxDelegate, 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.
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 Description static io.vertx.lang.rx.TypeArg<GrpcServer>
__TYPE_ARG
-
Constructor Summary
Constructors Constructor Description GrpcServer(GrpcServer delegate)
GrpcServer(Object delegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description GrpcServer
addService(Service service)
Add a service to this gRPC server.GrpcServer
callHandler(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 thefullMethodName
service method.boolean
equals(Object o)
GrpcServer
getDelegate()
List<Service>
getServices()
Get a list of all services registered with this gRPC server.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 with default options.static GrpcServer
server(Vertx vertx, GrpcServerOptions options)
Create a blank gRPC server with specified options.String
toString()
-
-
-
Field Detail
-
__TYPE_ARG
public static final io.vertx.lang.rx.TypeArg<GrpcServer> __TYPE_ARG
-
-
Constructor Detail
-
GrpcServer
public GrpcServer(GrpcServer delegate)
-
GrpcServer
public GrpcServer(Object delegate)
-
-
Method Detail
-
getDelegate
public GrpcServer getDelegate()
- Specified by:
getDelegate
in interfaceio.vertx.lang.rx.RxDelegate
-
handle
public void handle(HttpServerRequest event)
Something has happened, so handle it.- Specified by:
handle
in interfaceHandler<HttpServerRequest>
- Parameters:
event
- the event to handle
-
server
public static GrpcServer server(Vertx vertx)
Create a blank gRPC server with default options.- Parameters:
vertx
-- Returns:
- the created server
-
server
public static GrpcServer server(Vertx vertx, GrpcServerOptions options)
Create a blank gRPC server with specified options.- Parameters:
vertx
-options
- the gRPC server options- Returns:
- the created server
-
callHandler
public 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
public <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 thefullMethodName
service method.- Parameters:
serviceMethod
- the service methodhandler
- the service method call handler- Returns:
- a reference to this, so the API can be used fluently
-
addService
public 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
-
getServices
public List<Service> getServices()
Get a list of all services registered with this gRPC server.- Returns:
- an unmodifiable list of all registered services
-
newInstance
public static GrpcServer newInstance(GrpcServer arg)
-
-