protocol-buffers

Using Google Protocol Buffers with Java NIO?

你。 提交于 2020-01-01 11:56:12
问题 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 回答1: I suggest Netty,

Can I send a custom Error message from server to client GRPC?

最后都变了- 提交于 2020-01-01 08:33:10
问题 I have created a simple GRPC server and client . What i want to do is to create a custom error in the server and pass it to the client. My code looks as follows: Server.js var error = require('error'); var PROTO_PATH = grpc.load(__dirname + '/proto/hello.proto'); var hello_proto = PROTO_PATH.hello; function sayHello(call, callback) { try { var jsErr = new Error('MY_ERROR'); jsErr.newStatus = 401; jsErr.newMessage = 'custom unAuthorized error'; console.log(Object.getOwnPropertyNames(jsErr));

Can I send a custom Error message from server to client GRPC?

六眼飞鱼酱① 提交于 2020-01-01 08:33:10
问题 I have created a simple GRPC server and client . What i want to do is to create a custom error in the server and pass it to the client. My code looks as follows: Server.js var error = require('error'); var PROTO_PATH = grpc.load(__dirname + '/proto/hello.proto'); var hello_proto = PROTO_PATH.hello; function sayHello(call, callback) { try { var jsErr = new Error('MY_ERROR'); jsErr.newStatus = 401; jsErr.newMessage = 'custom unAuthorized error'; console.log(Object.getOwnPropertyNames(jsErr));

Maximum serialized Protobuf message size

我怕爱的太早我们不能终老 提交于 2020-01-01 05:44:06
问题 Is there a way to get the maximal size of a certain protobuf message after it will be serialized? I'm referring to messages that don't contain "repeated" elements. Note that I'm not referring to the size of a protobuf message with a specific content, but to the maximum possible size that it can get to (in the worst case). 回答1: In general, any protobuf message can be any length due to the possibility of unknown fields. If you are receiving a message, you cannot make any assumptions about the

Protobuf version conflicts with Qt

倖福魔咒の 提交于 2020-01-01 04:23:11
问题 I'm trying to use protobufs v 3.3.2 with Qt 5.9.1. This works with some Qt applications, but only if they are command line programs. Once I create a GUI application with Qt and protobufs, I get this error: [libprotobuf FATAL /home/mkraus/Documents/dev/star385/build/linux-desktop-debug-libs/protobuf/src/src/google/protobuf/stubs/common.cc:78] This program was compiled against version 2.6.1 of the Protocol Buffer runtime library, which is not compatible with the installed version (3.3.2).

Protocol buffers and UTF-8

人盡茶涼 提交于 2020-01-01 03:39:15
问题 The history of Encoding Schemes / multiple Operating Systems and Endian-nes have led to a mess in terms of encoding all forms of string data (--i.e., all alphabets); for this reason protocol buffers only deals with ASCII or UTF-8 in its string types, and I can't see any polymorphic overloads that accept the C++ wstring. The question then is how is one expected to get a UTF-16 string into a protocol buffer ? Presumably I need to keep the data as a wstring in my application code and then

How to design for a future additional enum value in protocol buffers?

点点圈 提交于 2019-12-31 08:28:50
问题 One of the attractive features of protocol buffers is that it allows you extend the message definitions without breaking code that uses the older definition. In the case of an enum according to the documentation: a field with an enum type can only have one of a specified set of constants as its value (if you try to provide a different value, the parser will treat it like an unknown field) therefore if you extend the enum and use the new value then a field with that type in old code will be

Why does CodedInputStream set stream position to end?

这一生的挚爱 提交于 2019-12-31 04:11:46
问题 I'm using protocol buffers 3 in c#. I'm trying to bounce through a stream to find the start locations of each message, without actually Deserialising the messages. All messages are written to the stream with WriteDelimitedTo . I then use this code to try to jump from length markers: _map = new List<int>(); _stream.Seek(0, SeekOrigin.Begin); var codedStream = new CodedInputStream(_stream); while (_stream.Position < _stream.Length) { var length = codedStream.ReadInt32(); _map.Add((int) _stream

Why does CodedInputStream set stream position to end?

夙愿已清 提交于 2019-12-31 04:11:10
问题 I'm using protocol buffers 3 in c#. I'm trying to bounce through a stream to find the start locations of each message, without actually Deserialising the messages. All messages are written to the stream with WriteDelimitedTo . I then use this code to try to jump from length markers: _map = new List<int>(); _stream.Seek(0, SeekOrigin.Begin); var codedStream = new CodedInputStream(_stream); while (_stream.Position < _stream.Length) { var length = codedStream.ReadInt32(); _map.Add((int) _stream

Linking to generated Java protobuf code in Eclipse

走远了吗. 提交于 2019-12-31 03:33:09
问题 Here's the workflow that I'm trying to build compile my proto files using a script, putting the generated src in a specified directory link to the generated classes in Eclipse compile my project I am easily able to do this for C++ using Eclipse CDT: In my project I choose File->New->Other and choose File under General. Then I click on Advanced and select link to system file. I haven't discovered how to do this for Java, though. Once answer here suggests creating another project with the