Akka react vs receive
Posted
by
Will I Am
on Programmers
See other posts from Programmers
or by Will I Am
Published on 2014-08-19T02:13:14Z
Indexed on
2014/08/19
4:31 UTC
Read the original article
Hit count: 337
I am reading my way through Akka tutorials, but I'd like to get my feet wet with a real-life scenario. I'd like to write both a connectionless UDP server (an echo/ping-pong service) and a TCP server (also an echo service, but it keeps the connection open after it replies).
My first question is, is this a good experimental use case for Akka, or am I better served with more common paradigms like IOCP? Would you do something like this with Akka in production?
Although I understand conceptually the difference between react() and receive(), I struggle to choose one or the other for the two models. In the UDP model, there is no concept of who the sender is on the server, once the pong is sent, so should I use receive()? In the TCP model, the connection is maintained on the server after the pong, so should I use react()?
If someone could give me some guidance, and maybe an opinion on how you'd design these two use cases, it would take me a long way. I have found a number of examples, but they didn't have explanations as to why they chose the paradigms they did.
© Programmers or respective owner