Over a million developers have joined DZone.

First Steps with Akka Remoting

· Java Zone

Learn more about the advantages of moving from a monolithic to microservices architecture.  Brought to you in partnership with IBM.

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…

From Idea to Application gives you the architecture to quickly build, manage and run a range of applications (web, mobile, big data, new smart devices, etc.) on an open-standard, cloud-based platform. See why developers are using IBM Bluemix. Brought to you in partnership with IBM.

Topics:

Published at DZone with permission of Joachim Hofer, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}