First Steps with Akka Remoting

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…

Posted in Scala by jmhofer at August 8th, 2012.
Tags: ,

3 Responses to “First Steps with Akka Remoting”

  1. says:

    Thanks for this blog post!

    First of all, I’d apologize for the pains you’ve encountered when using Akka.
    I’ll make sure the Akka Team reads and reflects on what we can do to prevent these problems from happening in the future.

    For your remoting-issue (client having to use ActorSystems) it’s merely because how Akka is structured (peer-to-peer-ish). We do have a ticket to create a light-weight interface to communicate with Actors from a non-actor node, so don’t be surprised if something like that surfaces in the future.

    All in all I hope your Future will be filled with hakking,


    • jmhofer says:

      Actually, imho akka is one of the – if not *the* – awesomest frameworks out there, currently; – and learning is never painless, so just keep up the extremely good work!

      I also notice that I’m kind of abusing a powerful peer-to-peer system here for a much simpler task. – But it’s great to do client/server stuff in a way that doesn’t feel so “enterprisey” for a change…

Leave a Reply