Sorry for disturbing, any help are appreciated.

Thanks
Longda


---------- Forwarded message ----------
From: 封仲淹 <[email protected]>
Date: 2017-08-01 20:58 GMT+08:00
Subject: Async in thrift server
To: [email protected]


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

Reply via email to