Package play.libs

Class Akka


  • public class Akka
    extends Object
    Helper to access the application defined Akka Actor system.
    • Constructor Detail

      • Akka

        public Akka()
    • Method Detail

      • providerOf

        public static <T extends Actor> javax.inject.Provider<ActorRef> providerOf​(Class<T> actorClass,
                                                                                   String name,
                                                                                   Function<Props,​Props> props)
        Create a provider for an actor implemented by the given class, with the given name.

        This will instantiate the actor using Play's injector, allowing it to be dependency injected itself. The returned provider will provide the ActorRef for the actor, allowing it to be injected into other components.

        Typically, you will want to use this in combination with a named qualifier, so that multiple ActorRefs can be bound, and the scope should be set to singleton or eager singleton.

        Type Parameters:
        T - the type of the actor
        Parameters:
        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.
        Returns:
        A provider for the actor.
      • providerOf

        public static <T extends Actor> javax.inject.Provider<ActorRef> providerOf​(Class<T> actorClass,
                                                                                   String name)
        Create a provider for an actor implemented by the given class, with the given name.

        This will instantiate the actor using Play's injector, allowing it to be dependency injected itself. The returned provider will provide the ActorRef for the actor, allowing it to be injected into other components.

        Typically, you will want to use this in combination with a named qualifier, so that multiple ActorRefs can be bound, and the scope should be set to singleton or eager singleton.

        Type Parameters:
        T - the type of the actor
        Parameters:
        actorClass - The class that implements the actor.
        name - The name of the actor.
        Returns:
        A provider for the actor.