thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edward Capriolo <edlinuxg...@gmail.com>
Subject Re: Async in thrift server
Date Fri, 04 Aug 2017 01:54:41 GMT
https://chamibuddhika.wordpress.com/2011/10/02/apache-thrift-quickstart-tutorial/

Thrift generates sync and async stubs for each service method.

On Thu, Aug 3, 2017 at 9:40 PM, Feng Longda <hustjackie@gmail.com> wrote:

> Sorry for disturbing, any help are appreciated.
>
>
> Thanks
> Longda
>
>
> ---------- Forwarded message ----------
> From: 封仲淹 <hustjackie@gmail.com>
> Date: 2017-08-01 20:58 GMT+08:00
> Subject: Async in thrift server
> To: user@thrift.apache.org
>
>
> Hi,
>
>
>
> Any help are appreciated.
>
>
>
> I want to use thrift as my RPC infrastructure,  can thrift provide
> async mode in server side?
>
> If thrift provide async mode in server side, could you please provide
> one example or quickstart for it.
>
>
>
>
>
> For example, client send one request to server, this request will cost
> much i/o in server side, can server register one callback or a
> listener? After server finish i/o operation, thrift call the callback
> or listener, then send response to client in the callback or listener.
>
>
>
> The code maybe  similar as this:
>
>
>
> Future<Response> request(Request req) {
>
>                 Promise<Response>  promise = Promise.of();
>
>                 Event ioEvent = createEvent(req);
>
>                 ioEvent.registerListener(  response ->
> promise.success(response)   );
>
>
>
>                 ioThread.pushEvent(ioEvent);
>
>
>
>                return promise.getFuture();
>
> }
>
>
>
> But from the client, client can do like this.
>
>
>
> Response result = client.request(req);
>
>
>
>
>
> Thanks in advance.
>
> Longda
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message