abstract class ExtensionId[T <: Extension] extends AnyRef
Ordering
- Alphabetic
- By Inheritance
Inherited
- ExtensionId
- AnyRef
- Any
Implicitly
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
Visibility
- Public
- Protected
Instance Constructors
- new ExtensionId()
Abstract Value Members
- abstract def createExtension(system: ActorSystem[_]): T
Create the extension, will be invoked at most one time per actor system where the extension is registered.
Concrete Value Members
- final def apply(system: ActorSystem[_]): T
Lookup or create an instance of the extension identified by this id.
- final def equals(other: Any): Boolean
- Definition Classes
- ExtensionId → AnyRef → Any
- final def hashCode(): Int
- Definition Classes
- ExtensionId → AnyRef → Any
- def id: ExtensionId[T]
Java API: The identifier of the extension
Identifier and factory for an extension. Is used to look up an extension from the
ActorSystem
, and possibly create an instance if no instance was already registered. The extension can also be listed in the actor system configuration to have it eagerly loaded and registered on actor system startup.*Scala API*
The
ExtensionId
for an extension written in Scala is best done by letting it be the companion object of the extension. If the extension will be used from Java special care needs to be taken to provide aget
method with the concrete extension type as return (as this will not be inferred correctly by the Java compiler with the default implementation)Example:
*Java API*
To implement an extension in Java you should first create an
ExtensionId
singleton by implementing a static method calledgetInstance
, this is needed to be able to list the extension among theakka.actor.typed.extensions
in the configuration and have it loaded when the actor system starts up.For testing purposes extensions typically provide a concrete ExtensionSetup that can be used in akka.actor.setup.ActorSystemSetup when starting the ActorSystem to replace the default implementation of the extension.
The concrete extension type
ExtensionSetup