Hi again, I seem to have found the answer myself: http://code.google.com/apis/protocolbuffers/docs/techniques.html#union
Regards, Jens On Sunday, March 18, 2012, Jens Rantil <jens.ran...@gmail.com> wrote: > Hi, > > I'm a newcomer to protobuf and am trying to wrap my head around some > things. Let's say I have a message receiver of some kind. It can > receive different types requests. All messages are encoded in protobuf > and my receiver has all *.proto message definitions necessary be able > to decode all incoming requests. > > My question is, does protobuf come with any bells and whistles that > let me decode a random incoming message, given all possible message > definitions? If not, how do you generally cope with this situation? > Because I feel it's a common one. > > I guess one possible solution is to create another message definition: > message GenericMessage { > enum MessageType { > SET_NAME = 0; > CREATE_CUSTOMER = 1; > } > required MessageType type = 0; > required bytes protobuf_data = 1; > } > > However, this would require me to do two deserializations. Is this the > prefered way to go? I'm curious to hear you input. Please pinpoint me > if this has been answered previously in forum or in the documentation. > > Regards, > Jens > > -- > 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. > > -- Want to know how full my inbox is? Or how to get in touch with me faster? Or tell me your e-mail is not that important? Then check this out: http://courteous.ly/4WtfZY -- 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.