avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter S <htims.r...@gmail.com>
Subject Re: asynchronous server
Date Mon, 27 Feb 2012 01:02:24 GMT
Hi James,

Thanks for the quick reply.
I get how the client side callback works. My question was actually
concerning the server side.

Suppose I have a service A which is implemented as an asynchronous server
using netty. Service A depends on B, C, D which are also avro service. In
order not to block the thread in service A, service A need to call B,C,D
asynchronously. But this needs Avro to support this when implementing
service A. For example, after calling B, C, D and gathering all results,
the handler in service A could call a callback (e.g.
callback.done(response)) to notify the underline transportation to send the
response to the client of A.

Can Avro support this RPC chain in an asynchronous way?

Regards,
Peter


On Sun, Feb 26, 2012 at 4:40 PM, James Baldassari <jbaldassari@gmail.com>wrote:

> Hi Peter,
>
> Yes, there is support in Avro for asynchronous RPCs, but it's currently
> limited to Java and the Netty client/server implementation.  This was
> implemented in AVRO-539 and first released in Avro 1.5.2.
>
> Asynchronous RPCs are implemented using the Callback interface.  When Avro
> generates the Java interface for your protocol in v1.5.2 or later you'll
> see a sub-interface called Callback.  For example, if your protocol is
> called Mail, you'll have a Java interface called Mail and a sub-interface
> Mail.Callback which extends Mail and adds the callback-enabled RPCs.  This
> is the interface you should use on the client side (when you create a
> SpecificRequestor).  On the server side, nothing changes to enable
> asynchronous RPCs.  The server (SpecificResponder) will implement Mail.
>
> I would suggest taking a look at some examples to get started.  A good
> place to start would be the Avro unit tests for the Callback APIs:
>
>
> http://svn.apache.org/viewvc/avro/trunk/lang/java/ipc/src/test/java/org/apache/avro/ipc/TestNettyServerWithCallbacks.java?view=markup
>
> I also created a github project to demonstrate a real-world use case for
> async RPCs using a real-time online auction:
>
> https://github.com/jbaldassari/Avro-RPC
>
> Also see this recent Avro users thread which has some pointers about
> callbacks:
>
> http://search-hadoop.com/m/HDNLxeVRbO
>
> Hopefully that will get you started, but please write back if you have any
> problems getting it working.
>
> -James
>
>
>
> On Sun, Feb 26, 2012 at 6:24 PM, Peter S <htims.rm.p@gmail.com> wrote:
>
>> Hi all,
>>
>> I am new to avro. I am trying to writing an asynchronous server which
>> will make other RPC calls. So I am wondering how can I do this. I found a
>> related jira issue:
>> https://issues.apache.org/jira/browse/AVRO-405
>>
>> But it seems only #1 is solved. Does Avro support #2 in this ticket now?
>> Thanks!
>>
>> Regards,
>> Peter
>>
>
>

Mime
View raw message