Thanks. Also how do I know the type of the message? One way would be
to check all optional fields (each represent a different type of
message) of the wrapper message and then pick the one which is not
null. Is that the only way?

On Mar 27, 12:08 pm, Dave Bailey <d...@daveb.net> wrote:
> Kenton,
>
> I don't suppose there'd ever be a way to mark a set of fields as
> mutually exclusive?
>
> -dave
>
> On Mar 27, 8:42 am, "Jon Skeet <sk...@pobox.com>" <sk...@pobox.com>
> wrote:
>
> > On Mar 27, 1:32 pm, achin...@gmail.com wrote:
>
> > > If I understand correctly there is no good way to use proto buffers to
> > > stream different types of messages, right? For example if my stream
> > > has a mix of several messages of type m1 and m2, I will have to device
> > > a scheme outside of proto buffers to separate it into 2 streams and
> > > then pass it through parsers for each.
>
> > > In other words is there a way to do event based parsing using proto
> > > buffers, or even a way to say don't parse a repetitive field unless
> > > needed.
>
> > No, you don't have to do it into separate streams. Instead, stream a
> > sequence of messages each of which has either an m1, or an m2, or an
> > m3 etc. This basically ends up being (tag) (message) (tag) (message),
> > where the tag is effectively identifying the type of message.
>
> > All you need to do is create the wrapper message, and the rest should
> > work fine.
>
> > Jon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to