Skip to content

Latest commit

 

History

History
60 lines (46 loc) · 1.04 KB

README.md

File metadata and controls

60 lines (46 loc) · 1.04 KB

spring-cloud-gateway-grpc

Getting started

This project is a simple example of how to use gRPC with Spring Cloud Gateway, with some customizations:

  • Disable SSL
  • Use protobuf file to generate the gRPC service
  • Use protobuf-gradle-plugin to generate the descriptor file

Generate protobuf file

 gradle build 

or

 .\gradlew.bat build

Run project

 gradle bootRun --parallel

or

 .\gradlew.bat bootRun --parallel

Test

curl --location 'localhost:8080/greetings/hello' \
--header 'Content-Type: application/json' \
--data '{
    "name" : "John Snow"
}'

Limitation

Protobuf

  • Version 2 of protoc supported. Version 3 is not supported. Watch this
  • Don't use required fields in response message.

Use this

message HelloResponse {
  optional string greeting = 1;
}

and don't do that

message HelloResponse {
  required string greeting = 1;
}