http-grpc transcoder with spring-web
A simplistic spring-web component that automatically configures spring-mvc controllers that
transcodes HTTP requests, invokes corresponding gRPC service method and transcodes the reply back to
HTTP response, with little configuration. Inspired by envoy HTTP to gRPC transcoder.
Show me how: refer to the module example with its tests.
Maven:
<dependency>
<groupId>io.github.kenix</groupId>
<artifactId>http-grpc-spring-web</artifactId>
<version>0.1.0-rc.4</version>
</dependency>
Gradle:
dependencies {
implementation 'io.github.kenix:http-grpc-spring-web:0.1.0-rc.4'
}
After implementing a gRPC service, provide following beans:
HttpGrpcMapper
responsible for discovering gRPC services and registering transcoder controllers
GrpcServerDescriptor
used by HttpGrpcMapper
to discover gRPC services. Currently, only support single server. If necessary, can easily support multiple servers.
List<FileDescriptor>
is mandatory in order to find all message types of gRPC requests. TODO: either injection or enabling ProtoReflectionServiceone of following alternatives:
List<ServerMethodDefinition>
transcoded call is made directlygRPC server port and one of following:
ServerMethodDefinitionInterceptor
and enabling gRPC HealthService
Invoked the first time (service health check) it will collect all ServerMethodDefinition
s, after that only forward calls. This enables direct transcoded calls.spring-cloud-starter-sleuth
, see also module clientRefer to open issues.