2013-06-05 25 views
6

有一個關於如何整合AKKASpring的方法鏈接。或者更好地說:「如何在spring環境中使用Akka演員」。爲什麼彈簧整合文檔僅適用於1.3.1,而不適用於下一版本

http://doc.akka.io/docs/akka-modules/1.3.1/modules/spring.html

其實有modules文件夾http://doc.akka.io/docs/akka-modules/只存在於1.3.1版本。與父母的監督只是演員創建其他角色,這意味着彈簧不是一個演員,不能:

Does it mean that there is no integration for different than `1.3.1` version 
with spring? 
Or it means that we should not use it (spring integration I mean)? 
Or we should do it in the same way as we do it for `1.3.1` version? 
+0

可能是因爲Typesafe的人沒有重視這個模塊。 – cmbaxter

回答

11

因爲它的方式演員系統的工作相沖突的akka-spring模塊並沒有移植到阿卡2.X系列創建演員。

在即將發佈的2.2版本的文檔中有一個關於如何在創建actor時使用依賴注入的新部分(請參閱the docs)。我們正在研究一個更完整的文檔,描述DI框架和Akka之間的相互作用。

4

正如羅蘭庫恩所指出的那樣,您將兒童演員的創作保留在他們的父母中,否則您將失去整個監督概念。

這裏有一個有用的帖子:http://blog.nemccarthy.me/?p=272在2.2中的兩種方法中使用IndirectActorProducer將Akka Actor與Spring連接起來。

在2.2之前,你也可以使用UntypedActorFactory做類似的事情。 IndirectActorProducer是一個更乾淨的方式來做到這一點。你也可以看看Creatorhttp://doc.akka.io/api/akka/2.2.0-RC1/index.html#akka.japi.Creator

+0

[This](https://github.com/sabomichal/akka-java-springfactory)實現應該同時滿足這兩個世界,因爲它是一個Spring工廠,它使用了上面提到的Creator API。 – miso

相關問題