You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by T Vinod Gupta <tv...@readypulse.com> on 2012/01/06 03:18:00 UTC

does thrift support async client for ruby?

does anyone know if thrift (0.6.0 or 0.8.0) support async/non-blocking ruby
client? if yes, how does the client get the return results?

in my setup, the client calls the service with a request that can take some
time for the server to respond to. so how can this be made non-blocking
wherein the client is gets notified with the results when the call really
returns?

thanks

Re: does thrift support async client for ruby?

Posted by Peter Sanford <ps...@nearbuysystems.com>.
There is an open issue on jira to add support for EventMachine:
https://issues.apache.org/jira/browse/THRIFT-146

The issue contains a patch series that you could apply to get a
non-blocking ruby client.

On Thu, Jan 5, 2012 at 6:18 PM, T Vinod Gupta <tv...@readypulse.com> wrote:
> does anyone know if thrift (0.6.0 or 0.8.0) support async/non-blocking ruby
> client? if yes, how does the client get the return results?
>
> in my setup, the client calls the service with a request that can take some
> time for the server to respond to. so how can this be made non-blocking
> wherein the client is gets notified with the results when the call really
> returns?
>
> thanks

Re: does thrift support async client for ruby?

Posted by Bryan Duxbury <br...@rapleaf.com>.
In rereading your original post, I think that I misread it initially. I
think you're asking for server->client notifications, which we also don't
support. If you don't want the client to wait, the simplest thing you can
do is to have two methods - one to make a request that returns nothing, and
another that gets the result if there is one. Then the client can poll on
whatever appropriate interval.

If you REALLY need notification based updates instead of polling, then the
best thing to do would be to actually have your clients run a Thrift server
as well and make the server know how to contact them with completion
messages. This is complicated, and you're unfortunately on your own.

On Wed, Jan 11, 2012 at 3:17 PM, T Vinod Gupta <tv...@readypulse.com>wrote:

> thanks Bryan.
> Can you elaborate little more on what you meant by using threads to achieve
> this? did you mean spawning multiple threads in ruby to get the data and
> coalescing them somehow?
>
> thanks
>
> On Wed, Jan 11, 2012 at 3:05 PM, Bryan Duxbury <br...@rapleaf.com> wrote:
>
> > I don't think we've implemented an async client in ruby thrift.
> >
> > The usual pattern is to use threads to achieve this sort of async
> behavior.
> >
> > On Thu, Jan 5, 2012 at 6:18 PM, T Vinod Gupta <tv...@readypulse.com>
> > wrote:
> >
> > > does anyone know if thrift (0.6.0 or 0.8.0) support async/non-blocking
> > ruby
> > > client? if yes, how does the client get the return results?
> > >
> > > in my setup, the client calls the service with a request that can take
> > some
> > > time for the server to respond to. so how can this be made non-blocking
> > > wherein the client is gets notified with the results when the call
> really
> > > returns?
> > >
> > > thanks
> > >
> >
>

Re: does thrift support async client for ruby?

Posted by T Vinod Gupta <tv...@readypulse.com>.
thanks Bryan.
Can you elaborate little more on what you meant by using threads to achieve
this? did you mean spawning multiple threads in ruby to get the data and
coalescing them somehow?

thanks

On Wed, Jan 11, 2012 at 3:05 PM, Bryan Duxbury <br...@rapleaf.com> wrote:

> I don't think we've implemented an async client in ruby thrift.
>
> The usual pattern is to use threads to achieve this sort of async behavior.
>
> On Thu, Jan 5, 2012 at 6:18 PM, T Vinod Gupta <tv...@readypulse.com>
> wrote:
>
> > does anyone know if thrift (0.6.0 or 0.8.0) support async/non-blocking
> ruby
> > client? if yes, how does the client get the return results?
> >
> > in my setup, the client calls the service with a request that can take
> some
> > time for the server to respond to. so how can this be made non-blocking
> > wherein the client is gets notified with the results when the call really
> > returns?
> >
> > thanks
> >
>

Re: does thrift support async client for ruby?

Posted by Bryan Duxbury <br...@rapleaf.com>.
I don't think we've implemented an async client in ruby thrift.

The usual pattern is to use threads to achieve this sort of async behavior.

On Thu, Jan 5, 2012 at 6:18 PM, T Vinod Gupta <tv...@readypulse.com> wrote:

> does anyone know if thrift (0.6.0 or 0.8.0) support async/non-blocking ruby
> client? if yes, how does the client get the return results?
>
> in my setup, the client calls the service with a request that can take some
> time for the server to respond to. so how can this be made non-blocking
> wherein the client is gets notified with the results when the call really
> returns?
>
> thanks
>