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

こ雲淡風輕ζ 提交于 2020-01-24 19:58:13

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!