Class GrpcServer
java.lang.Object
io.vertx.rxjava3.grpc.server.ServiceContainer
io.vertx.rxjava3.grpc.server.GrpcServer
- All Implemented Interfaces:
Handler<HttpServerRequest>, io.vertx.lang.rx.RxDelegate
public class GrpcServer
extends ServiceContainer
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddService(Service service) Add a service to this server.callHandler(Handler<GrpcServerRequest<Buffer, Buffer>> handler) Set a call handler that handles any call made to the server.<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.booleanvoidhandle(HttpServerRequest event) Something has happened, so handle it.inthashCode()static GrpcServernewInstance(GrpcServer arg) static GrpcServerCreate a blank gRPC server with default options.static GrpcServerserver(Vertx vertx, GrpcServerOptions options) Create a blank gRPC server with specified options.toString()Methods inherited from class ServiceContainer
newInstance, services
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
GrpcServer
-
GrpcServer
-
-
Method Details
-
toString
- Overrides:
toStringin classServiceContainer
-
equals
- Overrides:
equalsin classServiceContainer
-
hashCode
public int hashCode()- Overrides:
hashCodein classServiceContainer
-
getDelegate
- Specified by:
getDelegatein interfaceio.vertx.lang.rx.RxDelegate- Overrides:
getDelegatein classServiceContainer
-
handle
Something has happened, so handle it.- Specified by:
handlein interfaceHandler<HttpServerRequest>- Parameters:
event- the event to handle
-
server
Create a blank gRPC server with default options.- Parameters:
vertx-- Returns:
- the created server
-
server
Create a blank gRPC server with specified options.- Parameters:
vertx-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
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 thefullMethodNameservice method.- Parameters:
serviceMethod- the service methodhandler- the service method call handler- Returns:
- a reference to this, so the API can be used fluently
-
addService
Description copied from class:ServiceContainerAdd a service to this server.- Overrides:
addServicein classServiceContainer- Parameters:
service- the service to add- Returns:
- a reference to this, so the API can be used fluently
-
newInstance
-