问题
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 ?
回答1:
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/
来源:https://stackoverflow.com/questions/59263528/whats-the-difference-between-using-abstractbehavior-and-abstractactor-to-define