Protocol Buffer Polymorphism 3

Current construction

I am reorganizing some API code that returns an event feed for the user. An API is a regular RESTful API, and the current implementation simply queries DB and returns a feed.

The code is long and cumbersome, so I decided to move the feed generation to a microservice that will be called from the API server.

New design

For decoupling, I thought that data could move back and forth from the API server to the microservice as Protobuf objects. That way, I can change the programming language from both ends and still use the security type and slim protobuf size.

enter image description here

Problem

(, , ). . , , , , .

- FeedItem, , Feed, FeedItem.

3 , , ?

  • Oneof: " ".
  • Any: (, Java List<Object>.
+4

Source: https://habr.com/ru/post/1660629/


All Articles