开发者

How to implement protocol buffers (de)serialization on a Java client talking to a .NET server utilizing protobuf-net v2?

开发者 https://www.devze.com 2023-04-03 17:00 出处:网络
If I understand it correctly, the Java end needs the respective .p开发者_如何学编程roto file. However, it is unclear to me how to generate one from the RuntimeTypeModel instance (protobuf-net v2) used

If I understand it correctly, the Java end needs the respective .p开发者_如何学编程roto file. However, it is unclear to me how to generate one from the RuntimeTypeModel instance (protobuf-net v2) used on the server side.

Thanks.


At current, it simply hasn't been re-written; there is a v1 version of GetProto(), however it won't apply to v2 as it needs to be heavily refactored to work from RuntimeTypeModel. It is simply a case of finding time to put the code together.

If the model is moderately sized, I can probably help hook it together manually.

Note also that protobuf-net offers some features that will not map very nicely into .proto, since they have no definition at all in core .proto (these are usually clearly documented as extension), such as:

  • reference tracking
  • inheritance
  • dynamic types

Additionally, some of the BCL core types do not have direct .proto counterparts, including:

  • Guid
  • DateTime
  • TimeSpan

these can be interpreted, but require a little more shuffling

0

精彩评论

暂无评论...
验证码 换一张
取 消