I'm trying to implement data contract logic.
I've 2 services switching messages with each other.
Service A send messages in some format + the file descriptor proto of the
.proto file used to generate it. Service B gets them both, the message and
the file descriptor proto and has to ensure the
It appears that the C++ listener code supports multiple types, but assumes
that the correct type can be determined by checking if parsing the
serialized string returns successfully. This is not a reliable way to detect
message types: in fact ParseFromString() only fails if the serialized data
is
If I understand correctly, you are talking about two separate issue.
One is that I use of ParseFromString() is unreliable. The other one
is that I should switch to self describing messages. The latter is
not feasible for now; I receive serialized PB messages that do not
contain their type name,
No, the issue is one and the same. You cannot receive arbitrary serialized
bytes and determine what the message type is. You can do something
heuristically, but there is no way for you to be absolutely certain of the
message type simply by looking at encoded bytes.
Specific points in the code:
Thanks for looking into the code. Please see my comments inline.
On 8/27/2011 17:07 Jason Hsueh writes:
No, the issue is one and the same. You cannot receive arbitrary serialized
bytes and determine what the message type is. You can do something
heuristically, but there is no way for you to
On Sat, Aug 27, 2011 at 6:00 PM, Nader Salehi sal...@alumni.usc.edu wrote:
Thanks for looking into the code. Please see my comments inline.
On 8/27/2011 17:07 Jason Hsueh writes:
No, the issue is one and the same. You cannot receive arbitrary
serialized
bytes and determine what the
Sorry, I guess it's not clear if you know the message type or not. But the
issue is that you're getting some arbitrary message type out of the
transmitted FileDescriptorSet (in fact, any FileDescriptorSet that's ever
been received), not the type you want.
It's not clear from your code how the C++
I am having difficulty understanding the problem I am having with
parsing of some of the messages that I produce in my test environment.
There seems to be some difference between how things are constructed
and serialized in Java vs. C++. That is, unless there is a bug in my
code :)
Here is how I
Hello PB Group,
I am programming a group of programs in C++ that use PB to
communicate. In my first version of the program I was using a .proto
file that looked similar to the example 1 below. I would then run a
switch statement on a MsgType and create the proper message.
I am now starting to
Hi Adam,
I needed to do something similar on a previous project. I stored the
serialized version of the type-specific message as opaque data (bytes) in
an outer enveloping message.
message Envelope
{
required MsgType type = 1;
required bytes data = 2;
}
Then you can create any type of
This is exactly what extensions are for -- see
http://code.google.com/apis/protocolbuffers/docs/proto.html#extensions
It would look something like:
message BaseMessage {
required MsgType type = 1;
extensions 100 to 10;
}
Then each module would have a message like:
message Msg1 {
11 matches
Mail list logo