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 PekkoGuiceSupport, 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 PekkoGuiceSupport { 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://pekko.apache.org/docs/pekko/1.0/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(message: com.google.inject.spi.Message): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def addError(t: Throwable): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def addError(message: String, arguments: <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](clazz: Class[T]): AnnotatedBindingBuilder[T]
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def bind[T <: AnyRef](typeLiteral: TypeLiteral[T]): AnnotatedBindingBuilder[T]
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def bind[T <: AnyRef](key: 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(classMatcher: Matcher[_ >: Class[_ <: AnyRef] <: AnyRef], methodMatcher: Matcher[_ >: Method <: AnyRef], interceptors: <repeated...>[MethodInterceptor]): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- Annotations
- @transient()
- def bindListener(bindingMatcher: Matcher[_ >: Binding[_ <: AnyRef] <: AnyRef], listener: <repeated...>[ProvisionListener]): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- Annotations
- @transient()
- def bindListener(typeMatcher: Matcher[_ >: TypeLiteral[_ <: AnyRef] <: AnyRef], listener: TypeListener): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def bindScope(scopeAnnotation: Class[_ <: Annotation], scope: 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]) @HotSpotIntrinsicCandidate() @native()
- def configure(): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- final def configure(builder: Binder): Unit
- Definition Classes
- AbstractModule → Module
- def convertToTypes(typeMatcher: Matcher[_ >: TypeLiteral[_ <: AnyRef] <: AnyRef], converter: 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
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def getMembersInjector[T <: AnyRef](type: TypeLiteral[T]): MembersInjector[T]
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def getMembersInjector[T <: AnyRef](type: Class[T]): MembersInjector[T]
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def getProvider[T <: AnyRef](type: Class[T]): Provider[T]
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def getProvider[T <: AnyRef](key: Key[T]): Provider[T]
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def install(module: 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
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def requestInjection[T <: AnyRef](type: TypeLiteral[T], instance: T): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def requestInjection(instance: AnyRef): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def requestStaticInjection(types: <repeated...>[Class[_ <: AnyRef]]): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- Annotations
- @transient()
- def requireBinding(type: Class[_ <: AnyRef]): Unit
- Attributes
- protected[com.google.inject]
- Definition Classes
- AbstractModule
- def requireBinding(key: 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(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()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)