You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by 陈竞 <cj...@gmail.com> on 2011/06/13 10:07:11 UTC

Does thrift support asynchronous in c++?

I want to use asynchronous call . But it seems that thrift do not support
asynchronous call.
I need help. thanks

-- 

celix

Re: Does thrift support asynchronous in c++?

Posted by Richard Salz <rs...@us.ibm.com>.
> myServiceClientInstance->send_myMethod(...);
> // other things
> ret = myServiceClientInstance->recv_myMethod();
> 
> I've used this strategy to send a number of requests in parallel and 
then
> grab the results later.  However, recv_* will still block.
> 
> Anyone know if there's a better way to do this?

You can call peek() on the TSocket to see if there's any data.  But this 
appears to work only in non-blocking mode, and it *seems* to me that 
TSocket::open leaves the socket in blocking mode.  Anyone with better 
info?

--
STSM, WebSphere Appliance Architect
https://www.ibm.com/developerworks/mydeveloperworks/blogs/soma/


Re: Does thrift support asynchronous in c++?

Posted by Dan Kuebrich <da...@gmail.com>.
The generated cpp code for your interface will split up each method into
send_methodName() and recv_methodName().  So, normally you'd use:

myServiceClientInstance->myMethod(...);

but you could also do

myServiceClientInstance->send_myMethod(...);
// other things
ret = myServiceClientInstance->recv_myMethod();

I've used this strategy to send a number of requests in parallel and then
grab the results later.  However, recv_* will still block.

Anyone know if there's a better way to do this?

On Mon, Jun 13, 2011 at 4:07 AM, 陈竞 <cj...@gmail.com> wrote:

> I want to use asynchronous call . But it seems that thrift do not support
> asynchronous call.
> I need help. thanks
>
> --
>
> celix
>

Re: Does thrift support asynchronous in c++?

Posted by 陈竞 <cj...@gmail.com>.
oneway seems to be a temporary solution, expect that thrift can support
asynchronous service,
eg:
service Echo {
       void Echo(),
       async void Echo()  // asynchronous call
}

2011/6/13 Eastdawn Yang <ea...@gmail.com>

> Oneway might be a workaround, for example:
>
> Endpoint A --------ServiceB::sendOnewayRequest( ... )-----> Endpoint B
> Endpoint A <------ServiceA::recvOnewayResponse( ... )----- Endpoint B
>
>
> On Mon, Jun 13, 2011 at 4:07 PM, 陈竞 <cj...@gmail.com> wrote:
>
> > I want to use asynchronous call . But it seems that thrift do not support
> > asynchronous call.
> > I need help. thanks
> >
> > --
> >
> > celix
> >
>



-- 
陈竞,中科院计算技术研究所,高性能计算机中心
Jing Chen HPCC.ICT.AC China

Re: Does thrift support asynchronous in c++?

Posted by Eastdawn Yang <ea...@gmail.com>.
It's better that the method sending response back to A is not oneway if you
need know whether the response is sent.
Endpoint A --------ServiceB::sendOnewayRequest( ... )-----> Endpoint B
Endpoint A <------ServiceA::*recvResponse*( ... )----- Endpoint B


On Mon, Jun 13, 2011 at 9:37 PM, Eastdawn Yang <ea...@gmail.com>wrote:

> Oneway might be a workaround, for example:
>
> Endpoint A --------ServiceB::sendOnewayRequest( ... )-----> Endpoint B
> Endpoint A <------ServiceA::recvOnewayResponse( ... )----- Endpoint B
>
>
> On Mon, Jun 13, 2011 at 4:07 PM, 陈竞 <cj...@gmail.com> wrote:
>
>> I want to use asynchronous call . But it seems that thrift do not support
>> asynchronous call.
>> I need help. thanks
>>
>> --
>>
>> celix
>>
>
>

Re: Does thrift support asynchronous in c++?

Posted by Eastdawn Yang <ea...@gmail.com>.
Oneway might be a workaround, for example:

Endpoint A --------ServiceB::sendOnewayRequest( ... )-----> Endpoint B
Endpoint A <------ServiceA::recvOnewayResponse( ... )----- Endpoint B


On Mon, Jun 13, 2011 at 4:07 PM, 陈竞 <cj...@gmail.com> wrote:

> I want to use asynchronous call . But it seems that thrift do not support
> asynchronous call.
> I need help. thanks
>
> --
>
> celix
>