chanan / AkkaGuice

Akka Guice Integration for Playframework
The Unlicense
32 stars 4 forks source link

Documentation for #5

Open barbolani opened 9 years ago

barbolani commented 9 years ago

Guess this is a suggestion more than an issue. Would make it clear to have a couple of changes?

public onStart(Application app) {
        injector = Guice.createInjector(new AkkaGuiceModule());
        GuiceExt extension = akkaGuice.GuiceExtension.GuiceProvider.createExtension(
                ActorSystem.create("customactorsystem" ConfigFactory.load().getConfig("customactorsyste-config")).systemImpl()
            );
        extension.initialize(injector);
}
chanan commented 9 years ago

Sorry about the state of the docs. I will try to fix that shortly.

Not sure what your code example is showing. You can download the project and see the sample code run. You should not need to call the Extension system to use AkkaGuice.

barbolani commented 9 years ago

Wow, that was a quick reply. If the extension system is not needed, then how can I create an actor in an specific actor system?

chanan commented 9 years ago

There are basically two ways. One way is to inject an actor into your class. For example of this take a look at the constructor of the sample controller:

https://github.com/chanan/AkkaGuice/blob/master/app/controllers/Application.java#L20

The second way is you can create actor on demand either by name:

https://github.com/chanan/AkkaGuice/blob/master/app/services/HelloActor.java#L23

or the "normal" way by class:

https://github.com/chanan/AkkaGuice/blob/master/app/services/HelloActor.java#L26

chanan commented 9 years ago

@barbolani Did you get this to work or do you still have issues?