5

I have an existing micro-service in production which has a restful endpoint. For new customers, as well as well from a long term objective, we would like to support grpc. I would like to understand if it's a good idea to support both grpc and restful endpoints in the same spring-boot application. What could be potential downsides of doing this?

tsar2512
  • 2,826
  • 3
  • 33
  • 61

2 Answers2

3

There's some thoughts on this topic in this medium article (take a look at the comment section too), this baeldung article, and somewhat similar question here on SO: Microservices with gRPC and REST using Spring Boot.

1

Well I'd say its a good idea to support both types of APIs but you need to do it in the right way. As there is a easy way to "restify" gRPC APIs, I would change your application so that it uses gRPC by default and the REST API sits basically just on top of it. You could simply add the gRPC API but this can cause some problems as in gRPC the full response (at least the keys) needs to be defined in the proto file so depending on your responses this might get tricky.

Jakob
  • 11
  • 1