Receiving asynchronous messages by thrift client

I use Apache Thrift to define a protocol. I would like the client to receive asynchronous messages from the server.

service ServerService {
    oneway void async_server_hello(1: string message_from_client);
    string sync_server_hello(1: string message_from_client);
}

service ClientService { // how to use it from the server side?
    oneway void async_client_hello(1: string message_from_server);
}

I know how to connect to the server, send sync and async messages to the server, but I don't know how to send async messages from the server to the connected client.

(Python or Erlang code is preferable, but any other language will do)

Answers


Bidi-messaging is not possible with Apache Thrift. The server always reacts on client requests (except for oneway, of course). If you want the server to call the client back, the client has to set up an server on it's own. Another option could be long-running calls to simulate the desired behaviour.

I have seen at least one fork on Github doing Bidi-Messaging, but

  • I don't know what the state of this/these project(s) is, and
  • that stuff is not part of the Apache Thrift project.

There are a bunch of JIRA tickets dealing with this topic, the essence is however that Thrift will not support this in near future, because one of the goals is simplicity, which Bidi is not per se, esepcially across transports and languages.

So there are solutions, but no built-in way that will do this automatically for you.


Need Your Help

Paypal adaptive payment return url is calling twice

asp.net paypal payment-gateway paypal-adaptive-payments

I have implemented paypal adaptive payment method and using the web flow.

Libgdx Collision Detection with TiledMap

java libgdx collision-detection

I'm struggling with implementing a collision detection system through the tiledmap. I have a 2d "pokemon style" game that has a tiled map rendered. Specifically, I have a 'collision' layer in my ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.