Re: Implementing Rpc service in Java -- need help!

2008-09-18 Thread Kenton Varda
The client needs to check the RpcController for errors.
In retrospect, there probably should have been a second method on
RpcCallback called in case of error.

On Thu, Sep 18, 2008 at 2:39 PM, Jie Yao <[EMAIL PROTECTED]> wrote:

> How do I return the error status to client if
>
> done.run(response)
>
> returns only the expected response under successful scenarios.
>
> Jie
>
> - Original Message 
> From: Kenton Varda <[EMAIL PROTECTED]>
> To: Jie Yao <[EMAIL PROTECTED]>
> Cc: Protocol Buffers 
> Sent: Thursday, September 18, 2008 4:29:35 PM
> Subject: Re: Implementing Rpc service in Java -- need help!
>
> Yes, currently that's how it works.  C++ and Python work this way too.
>
> On Thu, Sep 18, 2008 at 1:43 PM, Jie Yao <[EMAIL PROTECTED]> wrote:
>
>>
>> I see.  The java RPC implementation has to be async via call back, is
>> that right?
>>
>> Jie
>>
>> On Sep 18, 2:15 pm, "Kenton Varda" <[EMAIL PROTECTED]> wrote:
>> > Use the callback:
>> >
>> >   Message response =
>> > responsePrototype.newBuilderForType.mergeFrom(data).build();
>> >   done.run(response);
>> >
>> > On Thu, Sep 18, 2008 at 12:07 PM, Java Jogger <[EMAIL PROTECTED]>
>> wrote:
>> >
>> > > I just started looking at implementing RPC service in Java.  In my
>> > > implementation class of RpcChannel interface, one method to be
>> > > implemented defined as:
>> >
>> > > public void callMethod(Descriptors.MethodDescriptor method,
>> > > RpcController controller, Message request,
>> > >   Message responsePrototype,
>> > > RpcCallback done) {
>> >
>> > >// my implementation goes here...
>> >
>> > > }
>> >
>> > > My understanding is the implementation of the above method is where
>> > > the remote request/response should be hooked in.  The question is: how
>> > > does it return the response message and make it available to the
>> > > caller of this method?
>> >
>> > > From the C++ example code in Language Guide, the responseProtoType is
>> > > passed by reference (pointer), thus making it possible to carry the
>> > > output of the method.  Since arguments to java method call are always
>> > > passed by value, how does one get hold of the response message after
>> > > "callMethod" returns successfully.
>> >
>> > > Deeply puzzled and need help.
>> >
>> > > Jie
>> >>
>>
>
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~--~~~~--~~--~--~---



Re: Implementing Rpc service in Java -- need help!

2008-09-18 Thread Jie Yao
How do I return the error status to client if 

done.run(response)

returns only the expected response under successful scenarios.

Jie



- Original Message 
From: Kenton Varda <[EMAIL PROTECTED]>
To: Jie Yao <[EMAIL PROTECTED]>
Cc: Protocol Buffers 
Sent: Thursday, September 18, 2008 4:29:35 PM
Subject: Re: Implementing Rpc service in Java -- need help!


Yes, currently that's how it works.  C++ and Python work this way too.


On Thu, Sep 18, 2008 at 1:43 PM, Jie Yao <[EMAIL PROTECTED]> wrote:


I see.  The java RPC implementation has to be async via call back, is
that right?

Jie


On Sep 18, 2:15 pm, "Kenton Varda" <[EMAIL PROTECTED]> wrote:
> Use the callback:
>
>   Message response =
> responsePrototype.newBuilderForType.mergeFrom(data).build();
>   done.run(response);
>

> On Thu, Sep 18, 2008 at 12:07 PM, Java Jogger <[EMAIL PROTECTED]> wrote:
>
> > I just started looking at implementing RPC service in Java.  In my
> > implementation class of RpcChannel interface, one method to be
> > implemented defined as:
>
> > public void callMethod(Descriptors.MethodDescriptor method,
> > RpcController controller, Message request,
> >   Message responsePrototype,
> > RpcCallback done) {
>
> >// my implementation goes here...
>
> > }
>
> > My understanding is the implementation of the above method is where
> > the remote request/response should be hooked in.  The question is: how
> > does it return the response message and make it available to the
> > caller of this method?
>
> > From the C++ example code in Language Guide, the responseProtoType is
> > passed by reference (pointer), thus making it possible to carry the
> > output of the method.  Since arguments to java method call are always
> > passed by value, how does one get hold of the response message after
> > "callMethod" returns successfully.
>
> > Deeply puzzled and need help.
>
> > Jie


  
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~--~~~~--~~--~--~---



Re: Implementing Rpc service in Java -- need help!

2008-09-18 Thread Kenton Varda
Yes, currently that's how it works.  C++ and Python work this way too.

On Thu, Sep 18, 2008 at 1:43 PM, Jie Yao <[EMAIL PROTECTED]> wrote:

>
> I see.  The java RPC implementation has to be async via call back, is
> that right?
>
> Jie
>
> On Sep 18, 2:15 pm, "Kenton Varda" <[EMAIL PROTECTED]> wrote:
> > Use the callback:
> >
> >   Message response =
> > responsePrototype.newBuilderForType.mergeFrom(data).build();
> >   done.run(response);
> >
> > On Thu, Sep 18, 2008 at 12:07 PM, Java Jogger <[EMAIL PROTECTED]> wrote:
> >
> > > I just started looking at implementing RPC service in Java.  In my
> > > implementation class of RpcChannel interface, one method to be
> > > implemented defined as:
> >
> > > public void callMethod(Descriptors.MethodDescriptor method,
> > > RpcController controller, Message request,
> > >   Message responsePrototype,
> > > RpcCallback done) {
> >
> > >// my implementation goes here...
> >
> > > }
> >
> > > My understanding is the implementation of the above method is where
> > > the remote request/response should be hooked in.  The question is: how
> > > does it return the response message and make it available to the
> > > caller of this method?
> >
> > > From the C++ example code in Language Guide, the responseProtoType is
> > > passed by reference (pointer), thus making it possible to carry the
> > > output of the method.  Since arguments to java method call are always
> > > passed by value, how does one get hold of the response message after
> > > "callMethod" returns successfully.
> >
> > > Deeply puzzled and need help.
> >
> > > Jie
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~--~~~~--~~--~--~---



Re: Implementing Rpc service in Java -- need help!

2008-09-18 Thread Jie Yao

I see.  The java RPC implementation has to be async via call back, is
that right?

Jie

On Sep 18, 2:15 pm, "Kenton Varda" <[EMAIL PROTECTED]> wrote:
> Use the callback:
>
>   Message response =
> responsePrototype.newBuilderForType.mergeFrom(data).build();
>   done.run(response);
>
> On Thu, Sep 18, 2008 at 12:07 PM, Java Jogger <[EMAIL PROTECTED]> wrote:
>
> > I just started looking at implementing RPC service in Java.  In my
> > implementation class of RpcChannel interface, one method to be
> > implemented defined as:
>
> > public void callMethod(Descriptors.MethodDescriptor method,
> > RpcController controller, Message request,
> >   Message responsePrototype,
> > RpcCallback done) {
>
> >// my implementation goes here...
>
> > }
>
> > My understanding is the implementation of the above method is where
> > the remote request/response should be hooked in.  The question is: how
> > does it return the response message and make it available to the
> > caller of this method?
>
> > From the C++ example code in Language Guide, the responseProtoType is
> > passed by reference (pointer), thus making it possible to carry the
> > output of the method.  Since arguments to java method call are always
> > passed by value, how does one get hold of the response message after
> > "callMethod" returns successfully.
>
> > Deeply puzzled and need help.
>
> > Jie
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~--~~~~--~~--~--~---



Re: Implementing Rpc service in Java -- need help!

2008-09-18 Thread Kenton Varda
Use the callback:

  Message response =
responsePrototype.newBuilderForType.mergeFrom(data).build();
  done.run(response);

On Thu, Sep 18, 2008 at 12:07 PM, Java Jogger <[EMAIL PROTECTED]> wrote:

>
> I just started looking at implementing RPC service in Java.  In my
> implementation class of RpcChannel interface, one method to be
> implemented defined as:
>
> public void callMethod(Descriptors.MethodDescriptor method,
> RpcController controller, Message request,
>   Message responsePrototype,
> RpcCallback done) {
>
>// my implementation goes here...
>
> }
>
> My understanding is the implementation of the above method is where
> the remote request/response should be hooked in.  The question is: how
> does it return the response message and make it available to the
> caller of this method?
>
> From the C++ example code in Language Guide, the responseProtoType is
> passed by reference (pointer), thus making it possible to carry the
> output of the method.  Since arguments to java method call are always
> passed by value, how does one get hold of the response message after
> "callMethod" returns successfully.
>
> Deeply puzzled and need help.
>
> Jie
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~--~~~~--~~--~--~---