I written a client server program using the Thrift framework, since the server is coded in C# and the clients are in Java.My question is, how can I make a message listener using Thrift? For example, my program has a list that the server sends to each client when one connects to it. If I have three clients connected to the server, and one of them modifies that list (which is declared before the server starts), how can I notify the rest of the clients that the list was modified?
Thank you.
The question has been asked a number of times in various ways. There is also at least one yet unsolved JIRA ticket around.
The general answer is at this time, given the current status quo: No built-in way, but there are indeed some viable alternatives:
Option #1: One can use long polling or similar mechanisms to simulate it. This comes especially handy when clients live in a browser.
Option #2: If the clients are not living in a browser, the recommended way is to have the client start its own Thrift server, allowing the server to create a connection back to the client.
Option #3: Regarding @Rui's comment: Thrift is both a serialization and RPC framework. This offers the option to only use the serialization part of it and transport the messages in different ways, even outside of Thrift RPC. We did that with message bus systems and it works great.