No, sorry – it absolutely has to be rewritten from scratch: Akka isn’t at all compatible with old-style Scala Actors. (The old Scala Actor library has been completely dead for many years – I last used it back in 2009.) I just meant to say that you could keep this pattern, of a Publisher trait that is inherited by your actual Actor, if that was appropriate.
That’s a big question, and honestly, I’d recommend reading one of the Akka books, or at least reading through the online docs. (Which are pretty good, and up-to-date.)
The very quick summary (but this is just the tip of the iceberg) is:
- Your App creates an ActorSystem.
- You use the ActorSystem to create one or more top-level Actors.
- Those Actors can create child Actors under them, if needed.
- When you create an Actor, that gives you an ActorRef, which is the “address” of that Actor.
- You use the
tell()
method (which is usually aliased to!
) on an ActorRef to send a message to that Actor. - You can use the
ask()
method (which is usually aliased to?
), which is an extension method for ActorRef, to send a message to an Actor and get a Future that will resolve to the response to that message.
Finally, note that Akka is in the process of a major migration right now: the new Akka Typed system, which provides a good deal more type-safety but works rather differently, is gradually supplanting “classic” Akka. So if you need to move to Akka at this point, I’d probably recommend learning Akka Typed. (The above notes are for classic Akka; the details are a little different in the new world, but I don’t know Akka Typed as well yet.)