I don't know about zeromq, but rabbitmq allows you to have multiple
endpoints. If that is the case, you can have diff types for diff
endpoints. If not, you can create a container message like

message TheOneAndOnlyMessage {
  required string type = 1;
  optional bytes value = 2;
}

And then the bytes in that message could be decoded again. Of course
that means that you end up doing two copies of the data, which is
less-than-desirable. But you can avoid the performance penalty by
doing the encoding manually (i.e. working directly with a coded
input/output stream, getting the type name, and then giving the stream
to a message parse function).

I suppose another option is to make TheOneAndOnlyMessage contain each
of the possible messages directly, but that seems like a maintenance
pain.

On Thu, Mar 21, 2013 at 6:48 PM, kramer65 <kram...@gmail.com> wrote:
> Hello people,
>
> I'm just starting out with protobuf but I hope someone can enlighten me a
> bit.
>
> Lets say that I've got a couple message types defined. Now when a new
> message comes in (via zeromq) I don't know what type of message it is until
> I deserialize it, but to deserialize it I need to know what type of message
> it is (catch 22!). I'm totally lost here. Could anybody please explain this
> to me?
>
> All tips are welcome!
>
> --
> 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 http://groups.google.com/group/protobuf?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

-- 
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 http://groups.google.com/group/protobuf?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to