java - Deserializing protobufs without source file -


is possible deserialize protobuf message without access source .proto file/generated classes? source system generates messages using ruby , consumes in java. source system can create new message formats consumer has no easy way of knowing about. alternatively, what's best way consumer access proto classes? possible have kind of proto repository?

without schema (.proto file or compiled descriptor), can decode protobuf series of tag/value pairs, tags numeric , values have limited type information. may enough human reverse-engineer protocol isn't useful code.

it possible send schema along payload sending along filedescriptorset (basically, compiled version of relevant .proto files), described here:

https://developers.google.com/protocol-buffers/docs/techniques#self-description

however, not useful sounds! filedescriptorset allow determine names , types of fields, doesn't mean code know them.

that said, there possible use cases:

  • you have proxy translates message json based on schema.
  • you have storage system parses message in order store in different form. example, might transpose rows , columns better compression, or might sort of indexing on fields.

however, in these use cases recommend proxy or storage system pre-configured necessary schemas rather sending them every message, schemas tend pretty big.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -