Module io.inverno.mod.grpc.server
module io.inverno.mod.grpc.server
The Inverno framework gRPC server module provides a gRPC server.
It defines the following sockets:
- configuration
- the gRPC server module configuration
- netService (required)
- the Net service providing the ByteBuf allocator
- messageCompressors
- custom gRPC message compressors
It exposes the following beans:
- configuration
- the gRPC server module configuration
- grpcServer
- the gRPC server
A simple gRPC server can be started with an HTTP/2 server by transforming server HTTPexchange handler into a server gRPC exchange handler as follows:
GrpcServer grpcServer = ...
NetService netService = ...
ResourceService resourceService = ...
Application.with(new Server.Builder(netService, resourceService)
.setConfiguration(HttpServerConfigurationLoader.load(conf -> conf.server_port(8080).h2_enabled(true)))
.setController(ServerController.from(
grpcServer.unary(
HelloRequest.getDefaultInstance(),
HelloReply.getDefaultInstance(),
(GrpcExchange.Unary<ExchangeContext, HelloRequest, HelloReply> grpcExchange) -> {
grpcExchange.response().value(
grpcExchange.request().value().map(request -> HelloReply.newBuilder().setMessage("Hello " + request.getName()).build())
);
}
)
))
).run();
- Since:
- 1.9
- Author:
- Jeremy Kuhn
-
Packages
-
Modules
ModifierModuleDescriptiontransitiveDefines the foundational APIs of the Inverno framework modules.transitiveThe Inverno framework configuration module provides advanced application configuration capabilities.transitiveThe Inverno framework gRPC base module defines the base APIs and services for gRPC client and server implementations.transitiveThe Inverno framework HTTP base module defines the base APIs and services for HTTP client and server implementations.transitiveThe Inverno framework HTTP server module provides a HTTP1.x and HTTP/2 server.