[protobuf] Re: Construct return message using Descriptors.ServiceDescriptor

2010-03-04 Thread ph
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,

Re: [protobuf] Re: Construct return message using Descriptors.ServiceDescriptor

2010-02-24 Thread Kenton Varda
The way this is intended to work is that you should have a pointer to the Service object and call its getRequestPrototype() method. I don't understand why you would need to decode requests without having a Service object for which they are destined. On Tue, Feb 23, 2010 at 8:56 PM, ph

[protobuf] Re: Construct return message using Descriptors.ServiceDescriptor

2010-02-24 Thread ph
On the high level I have a wrapper for RpcChannel implements transport. Inside transport I need to parse response. To do that I need and instance of service. To create an instance of service (stub) I need to provide and instance of channel to it. So, my service depends on channel and channel

[protobuf] Re: Construct return message using Descriptors.ServiceDescriptor

2010-02-23 Thread ph
Thanks Kenton, I was using getRequestPrototype, but I need an actual instance of Service to call that method that created additional extra dependency in my code that why I started to look for alternatives. I know my method name and currently I'm just parsing response (byte array) this way (in

Re: [protobuf] Re: Construct return message using Descriptors.ServiceDescriptor

2010-02-23 Thread Kenton Varda
(But to answer your question: Compiled-in types are almost always faster than DynamicMessage.) On Tue, Feb 23, 2010 at 4:27 PM, Kenton Varda ken...@google.com wrote: I'm not sure how your approach works, but since it looks like you're using Java reflection, my guess is that it will only work

[protobuf] Re: Construct return message using Descriptors.ServiceDescriptor

2010-02-23 Thread ph
Thanks It looks like there is no elegant way to solve my issue. In short, I have a transport implementation to use with PB RPC service. Service definitions are built-in and I need to convert byte array to Message inside my transport. I know what service transport handles and I have method name.