You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Karthik Abinav <ka...@gmail.com> on 2012/07/10 11:15:45 UTC

Two Way Asynchronous function in thrift

Hi,

 I would like to know how to use a two direction asynchronous function
using thrift server. This is my current requirement. I have multiple
clients sending requests to the thrift server. This in turn sends the
request to a graph database. Problem is graph database cannot handle
multiple connections at the same time. Hence, I dont want the client to
wait till the thrift returns a response. Ideally, I would want to implement
something like, a client posts a request to the thrift server and continues
with its processing without being stalled. Once the thrift returns the
response back, I want the client to be notified and process the response.
Please give me guidelines on how to implement such a thing in thrift
service.


Thanks,
Karthik Abinav

Re: Two Way Asynchronous function in thrift

Posted by James Paton <jp...@gmail.com>.
I've done something like this in the past. In my application, the client had a number of worker threads. To make an asynchronous call, it would place a request in a queue. The threads dequeue requests and make a synchronous Thrift call. Each request has a callback that gets called when the Thrift call returns. The individual worker threads get blocked on the Thrift call, but the calling threads of execution do not.

-- Jim

On Jul 10, 2012, at 4:15 AM, Karthik Abinav wrote:

> Hi,
> 
> I would like to know how to use a two direction asynchronous function
> using thrift server. This is my current requirement. I have multiple
> clients sending requests to the thrift server. This in turn sends the
> request to a graph database. Problem is graph database cannot handle
> multiple connections at the same time. Hence, I dont want the client to
> wait till the thrift returns a response. Ideally, I would want to implement
> something like, a client posts a request to the thrift server and continues
> with its processing without being stalled. Once the thrift returns the
> response back, I want the client to be notified and process the response.
> Please give me guidelines on how to implement such a thing in thrift
> service.
> 
> 
> Thanks,
> Karthik Abinav