Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Google Protocol Buffers with Java NIO?

I'm currently playing around with java.nio, which I haven't been using for a long time. I use Google Protocol Buffers for serialization and for communication with other parts of my system. Now I can't figure out if/how it is possible to get use protobuffers with java.nio classes.

I can't imagine that Google is using only "one thread per connection" with networked protocol buffers. Could anyone give me a pointer on how to integrate the two?

Thanks in advance!
Martin

like image 638
Martin C. Avatar asked Jul 26 '10 18:07

Martin C.


People also ask

How do I use Google protobuf?

To use the Any type, you must import the google/protobuf/any. proto definition. In the C# code, the Any class provides methods for setting the field, extracting the message, and checking the type. Protobuf's internal reflection code uses the Descriptor static field on each generated type to resolve Any field types.

What is protobuf used for in Java?

Protocol Buffers is a library from Google. It provides efficient and language-independent ways to serialize the data. It supports serialization and deserialization from languages like Java, Python, Go, Dart, etc.

Does Google use protobuf?

Protocol buffers, or Protobuf, is a binary format created by Google to serialize data between different services. Google made this protocol open source and now it provides support, out of the box, to the most common languages, like JavaScript, Java, C#, Ruby and others.

Is protobuf backwards compatible?

The proto-backwards-compatibility plugin is a Maven plugin to run a backwards compatibility check on a set of protobuf IDL files. The plugin can be integrated into various phases of a maven build to check that any changes to a set of . proto files are backwards compatible.


1 Answers

I suggest Netty, specifically this example that is Netty using ProtoBufs.

like image 149
Jacob Tomaw Avatar answered Nov 15 '22 07:11

Jacob Tomaw