How do you create an instance of message knowing message "type"?
I do know my message type, I just cannot figure out how to create a
Message without having an instance of service object.

The "right" way is to call
"getRequestPrototype"/"getResponsePrototype" on service instance,
which I'd like to avoid, or have a library of default messages, which
is not very good solution too.
I was trying to use type descriptors, but can't figure out if it's
possible to create a message using type descriptor
e.g.: serviceDescriptor.findMethodByName
( methodName ).getOutputType.toProto.newBuilderForType.mergeFrom
this does not work the I'd hope it'd work...
so now I'm using reflection, which works, but I'd like to use my
knowledge of type as reflection is not fastest way of creating

On Feb 26, 7:53 am, ""
<> wrote:
> > transport you, probably, don't care, but I'm implementing my own
> > transport using asynchronous AMQP protocol. And channel encapsulates
> We use the Type parameter available in the message properties
> (rabbitmq) to indicate what sort of GPB message is encoded in the
> request/response.  This seems to work out well so far.
> Rob

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to