trait ActorModule extends AbstractModule
Facilitates runtime dependency injection of "functional programming"-style actor behaviors.
1. Mix this trait into the object
defining the actor message(s) and behavior(s);
2. Define the Message
type with actor message class;
3. Annotate with Provides the "create" method that returns the
(possibly just initial) Behavior of the actor;
4. Use the bindTypedActor
in AkkaGuiceSupport, passing the object
as the actor module.
For example:
object ConfiguredActor extends ActorModule { type Message = GetConfig final case class GetConfig(replyTo: ActorRef[String]) @Provides def apply(configuration: Configuration): Behavior[GetConfig] = { // TODO: Define ConfiguredActor's behavior using the injected configuration. Behaviors.empty } } final class AppModule extends AbstractModule with AkkaGuiceSupport { override def configure() = { bindTypedActor(classOf[ConfiguredActor], "configured-actor") } }
Message
is a type member rather than a type parameter is because you can't define, using the
example above, GetConfig
inside the object and also have the object extend
ActorModule[ConfiguredActor.GetConfig]
.
- Annotations
- @ApiMayChange()
- Source
- ActorModule.scala
- See also
https://doc.akka.io/docs/akka/snapshot/typed/style-guide.html#functional-versus-object-oriented-style
- Alphabetic
- By Inheritance
- ActorModule
- AbstractModule
- Module
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- abstract type Message
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def addError(arg0: com.google.inject.spi.Message): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def addError(arg0: Throwable): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def addError(arg0: String, arg1: <repeated...>[AnyRef]): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- Annotations
- @transient()
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def bind[T <: AnyRef](arg0: Class[T]): AnnotatedBindingBuilder[T]
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def bind[T <: AnyRef](arg0: TypeLiteral[T]): AnnotatedBindingBuilder[T]
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def bind[T <: AnyRef](arg0: Key[T]): LinkedBindingBuilder[T]
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def bindConstant(): AnnotatedConstantBindingBuilder
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def bindInterceptor(arg0: Matcher[_ >: Class[_ <: AnyRef] <: AnyRef], arg1: Matcher[_ >: Method <: AnyRef], arg2: <repeated...>[MethodInterceptor]): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- Annotations
- @transient()
- def bindListener(arg0: Matcher[_ >: Binding[_ <: AnyRef] <: AnyRef], arg1: <repeated...>[ProvisionListener]): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- Annotations
- @transient()
- def bindListener(arg0: Matcher[_ >: TypeLiteral[_ <: AnyRef] <: AnyRef], arg1: TypeListener): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def bindScope(arg0: Class[_ <: Annotation], arg1: Scope): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def binder(): Binder
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def configure(): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- final def configure(arg0: Binder): Unit
- Definition Classes
- AbstractModule → Module
- def convertToTypes(arg0: Matcher[_ >: TypeLiteral[_ <: AnyRef] <: AnyRef], arg1: TypeConverter): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def currentStage(): Stage
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getMembersInjector[T <: AnyRef](arg0: TypeLiteral[T]): MembersInjector[T]
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def getMembersInjector[T <: AnyRef](arg0: Class[T]): MembersInjector[T]
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def getProvider[T <: AnyRef](arg0: Class[T]): Provider[T]
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def getProvider[T <: AnyRef](arg0: Key[T]): Provider[T]
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def install(arg0: Module): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def requestInjection(arg0: AnyRef): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def requestStaticInjection(arg0: <repeated...>[Class[_ <: AnyRef]]): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- Annotations
- @transient()
- def requireBinding(arg0: Class[_ <: AnyRef]): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def requireBinding(arg0: Key[_ <: AnyRef]): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()