Play2 server to server communication
-
21-12-2019 - |
Question
How can I implement server to server communication in play framework?
I have to send a lot of data, very frequently, I'm looking for something like websockets but between servers. I could use simple socket, but my data is JSON. Is there any wrapper for sockets to use in similar way to websockets?
I'm using play 2.2 and scala.
Solution
How about Akka remoting? The actor model would fit well with the Play architecture, and would be a good way to handle unsolicited messages at the receiving end.
OTHER TIPS
I recommend you to use ZeroMQ implementation in Akka link. It is fine alternative to remote solution. The only drawback is that it depends on ZeroMQ native so you have to have ZeroMQ library installed. But it works great. Especially that you don't have to implement yourself Pub-Sub pattern.