Joachim Hofer is a long-time senior consultant and lead developer on the Java platform who has recently become a fan of Scala. He regularly contributes to Open Source community projects and shares his experience in his blog and talks. Joachim is a DZone MVB and is not an employee of DZone and has posted 12 posts at DZone. You can read more from them at their website. View Full User Profile

First Steps with Akka Remoting

  • submit to reddit

Initially, I was hopeful that setting up a simple client/server infrastructure with akka would be very easy and painless because

  • akka documentation is generally very well-written and comprehensive,
  • the API looks astonishingly simple.
  • There are some good code samples in the akka repository.

Sadly, this was not really the case. – Of course, part of the problem is my own stupidity, I guess. Anyway, here are the pitfalls I encountered, some of them more, some of them less trivial:

  • Don’t let the links to old documentation versions misguide you! – Always check that the websites you’re looking at are about the most current version of akka.
  • The client seems to require a full ActorSystem with remoting just for calling remote actors on the server.
  • The client ActorSystem has to bind to a different port than the server ActorSystem when running on the same box. Use different configuration sections or files.
  • If you try to look up a remote actor using a wrong akka url, you won’t get any kind of error message. It just won’t work at all.
  • If you call your remote actor serverActor and your remote actor system ServerSystem, and it’s running on localhost:2554, its url is akka://ServerSystem@localhost:2554/user/serverActor, not akka://ServerSystem@localhost:2554/serverActor…
  • Unfortunately, sbt dist won’t copy any subproject libraries into the mikrokernel when the id and name of your sbt subprojects are not equal. Always use the name you set in your subproject settings (for example name := akka-shared) for your subproject id (lazy val shared = Project(id = "akka-shared", ...)

Maybe this saves a few other akka beginners a bit of their time. I pushed the code to a playground Bitbucket repository. You’re invited to take a look. I’d be very happy about any kinds of hints or pointers to possible improvements, of course.

Still, I’d say that getting started here was comparatively easy when I think back to the fun times I had when first learning how to setup the Orion Application Server or JBoss back in the days…

Published at DZone with permission of Joachim Hofer, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Viktor Nordling replied on Mon, 2012/08/27 - 6:18pm

Good writeup, I think we had similar experiences..

In my case I was trying to use typed actors in Java though. I created a playground repo here: 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.