thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 封仲淹 <hustjac...@gmail.com>
Subject Async in thrift server
Date Tue, 01 Aug 2017 12:58:07 GMT
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