HTTP gRPC Spring Boot Starter


License

License

Categories

Categories

Spring Boot Container Microservices gRPC Net Networking
GroupId

GroupId

io.github.kenix
ArtifactId

ArtifactId

http-grpc-spring-boot-starter
Last Version

Last Version

0.1.0-rc.1
Release Date

Release Date

Type

Type

pom.sha512
Description

Description

HTTP gRPC Spring Boot Starter
HTTP gRPC Spring Boot Starter
Project URL

Project URL

https://github.com/kenix/http-grpc-spring-boot-starter
Source Code Management

Source Code Management

https://github.com/kenix/http-grpc-spring-boot-starter

Download http-grpc-spring-boot-starter

Dependencies

runtime (5)

Group / Artifact Type Version
io.grpc : grpc-protobuf jar 1.31.1
io.grpc : grpc-stub jar 1.31.1
org.springframework.boot : spring-boot-starter-web jar [2.0.0.RELEASE,)
com.google.protobuf : protobuf-java-util jar 3.15.0
org.apache.commons : commons-text jar 1.9

Project Modules

There are no modules declared in this project.

http-grpc-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.

Usage

Show me how: refer to the module example with its tests.

Dependency

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'
}

Plumbing

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 ProtoReflectionService

  • one of following alternatives:

    1. List<ServerMethodDefinition> transcoded call is made directly

    2. gRPC server port and one of following:

      1. a gRPC global server interceptor ServerMethodDefinitionInterceptor and enabling gRPC HealthService Invoked the first time (service health check) it will collect all ServerMethodDefinitions, after that only forward calls. This enables direct transcoded calls.
      2. nothing else, transcoded call will not be direct, but routed internally using an embedded gRPC client. This has performance impact.

Integration

  • distributed tracing: out of the box with spring-cloud-starter-sleuth, see also module client

TODO

Refer to open issues.

Versions

Version
0.1.0-rc.1