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…