2017-04-12 88 views
0

我的系統在Play framework 2.5和Akka內置模式下運行。我相信有兩種方法來初始化路由器。初始化Akka路由器的兩種方式之間的區別

1:

ActorRef router = akkaService.getActorSystem() 
    .actorOf(new RoundRobinPool(poolSize) 
    .props(Props.create(ProfileActor.class)), "ProfileActor"); 

2:

ActorRef router = akkaService.getActorSystem() 
    .actorOf(new Props(ProfileActor.class) 
    .withRouter(new RoundRobinRouter(poolSize)), "ProfileActor")); 

所以我有2個問題:

  • 它們有什麼不同?
  • 哪種方式更好?

非常感謝!

回答

0

區別在於數字1在當前版本的Akka(2.4.x)中被支持,而數字2已被停用。

RoundRobinRouter是Akka 2.2.x的一部分,並且先在Akka 2.3.x(參見docs)中棄用,然後在Akka 2.4.x中刪除。

相關問題