Interacting with actors

30 views
Skip to first unread message

Ngoc Dao

unread,
Mar 25, 2012, 10:41:37 AM3/25/12
to Akka User List
In Akka actors are hidden in refs. The only way to interact with actor
is sending message to refs. What are the best practices of interacting
with Akka actors?

There are 2 scenarios:
* Interacting with only one actor. Should I create a wrapper object/
class for each actor class? Each message type in the actor has a
corresponding method in the object/class.
* Interacting among actors. Should I let actors send messages directly
among them? If each actor has a wrapper, for N number of actors there
will be N number of wrappers. This is ridiculous. The code size,
maintenance cost etc. must be doubled.

FYI, here's an Erlang recommendation:
http://learnyousomeerlang.com/designing-a-concurrent-application#hide-your-messages

Jonas Boner

unread,
Mar 27, 2012, 7:56:09 AM3/27/12
to akka...@googlegroups.com
Akka is not Erlang. Never create any wrapper classes. Just send messages to the ActorRef.
If you want a typed interface, use Typed Actors. Read more here on that: http://letitcrash.com/post/19074284309/when-to-use-typedactors


--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.




--
Jonas Bonér
CTO
Typesafe - The software stack for applications that scale
Phone: +46 733 777 123
Twitter: @jboner

Ngoc Dao

unread,
Mar 27, 2012, 6:08:31 PM3/27/12
to Akka User List
Thanks for your insight.
Reply all
Reply to author
Forward
0 new messages