Search code examples
akkaactor

What's the difference between using AbstractBehavior and AbstractActor to define Akka Actors?


I've started learning Akka actors recently and seen actors defined in two ways.

class Main extends AbstractBehavior<String> 

and

class SomeActor extends AbstractActor

I'm following the Java API and could someone explain the difference or point to article that does ?


Solution

  • class Main extends AbstractBehavior

    Is Akka Typed, which is the way to define Actor Behavior from Akka 2.6. It is in 2.5 but as experimental.

    class SomeActor extends AbstractActor

    Is for untyped Actors, named classic Actors as of Akka 2.6.

    If you're on Akka 2.6 I'd suggest using AbstractBehavior and following the try-akka guide: https://developer.lightbend.com/guides/akka-quickstart-java/