public interface AkkaGuiceSupport
public class MyModule extends AbstractModule implements AkkaGuiceSupport {
protected void configure() {
bindActor(MyActor.class, "myActor");
}
}
Then to use the above actor in your application, add a qualified injected dependency, like so:
public class MyController extends Controller {
@Inject @Named("myActor") ActorRef myActor;
...
}
| Modifier and Type | Method and Description |
|---|---|
default <T extends Actor> |
bindActor(Class<T> actorClass,
String name)
Bind an actor.
|
default <T extends Actor> |
bindActor(Class<T> actorClass,
String name,
Function<Props,Props> props)
Bind an actor.
|
default <T extends Actor> |
bindActorFactory(Class<T> actorClass,
Class<?> factoryClass)
Bind an actor factory.
|
default <T extends Actor> void bindActor(Class<T> actorClass, String name, Function<Props,Props> props)
T - the actor type.actorClass - The class that implements the actor.name - The name of the actor.props - A function to provide props for the actor. The props passed in will just describe how to create the
actor, this function can be used to provide additional configuration such as router and dispatcher
configuration.default <T extends Actor> void bindActor(Class<T> actorClass, String name)
T - the actor type.actorClass - The class that implements the actor.name - The name of the actor.default <T extends Actor> void bindActorFactory(Class<T> actorClass, Class<?> factoryClass)
T - the actor type.actorClass - The class that implements the actor.factoryClass - The factory interface for creating the actor.