Reading about OneOf  -- can I just union all of my messages into one
"container" message?
john

On Thu, Jun 28, 2018 at 1:27 PM John Lilley <whee...@gmail.com> wrote:

> I have a message stream, and on that stream I want to send a variety of
> messages.  I understand that protobuf is not self-describing (no tags like
> XML or JSON) nor does it include the "message type".  So I'm trying to
> figure out how to pack the Type and Body into a single byte buffer in an
> efficient manner.
> It would be pretty easy to invent something, but is there some support
> already built into protobuf?
> Furthermore, when using the Java API, I would like to avoid a double-copy
> of the message body, if possible.  I need to hand the resulting packet to a
> message broker API that only accepts byte[] as a body, so I need to pack
> all of these elements into a single array (hence, my desire to find some
> clever way to avoid the double-copy).
> On the receiving end, I need some kind of factory to create the correct
> message type based on the type embedded in the data.
>
> I see that this question has been asked in different ways, with various
> suggestions proffered, but I am having trouble finding out if there is
> support for this kind of thing built into protobuf or a "Best Practice" to
> accomplish this, both in Java and C++.  Maybe even a helper library?
>
> Thanks
> john
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to