final case class ReceiveMessage[Message]() extends Keyword[ReceiveMessage[Message], Message] with Product with Serializable
A keyword to receive next message of an Akka actor.
Installation
This ReceiveMessage keyword supports !-notation,
which requires BangNotation and ResetEverywhere compiler plugins along with this receivemessage
library.
For sbt, add the following settings to your build.sbt
:
addCompilerPlugin("com.thoughtworks.dsl" %% "compilerplugins-bangnotation" % "latest.release") addCompilerPlugin("com.thoughtworks.dsl" %% "compilerplugins-reseteverywhere" % "latest.release") libraryDependencies += "com.yang-bo.dsl.keywords.akka.actor" %% "receivemessage" % "latest.release"
Author:
杨博 (Yang Bo)
- Message
The type of message being received, which must be Any for akka.actor.Actor, and must be the same type of
T
for akka.actor.typed.Behavior.
- Source
- ReceiveMessage.scala
This ReceiveMessage keyword can be used in the akka.actor.Actor.Receive domain, to receive the next message. The above code creates an actor to echo any messages.
import akka.actor._ def echoActor = new Actor { def receive: Receive = { while (true) { val lastMessage = !ReceiveMessage[Any] sender() ! lastMessage } throw new Exception("Unreachable code!") } } val pinger = system.actorOf(Props(echoActor)) pinger ! "hello world" expectMsg("hello world")
- See also
domains.akka.actor.typed.typedReceiveMessageDsl for usage in the typed actor domains.
- Alphabetic
- By Inheritance
- ReceiveMessage
- Serializable
- Product
- Equals
- Keyword
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new ReceiveMessage()
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- Implicit
- This member is added by an implicit conversion from ReceiveMessage[Message] toany2stringadd[ReceiveMessage[Message]] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
- def ->[B](y: B): (ReceiveMessage[Message], B)
- Implicit
- This member is added by an implicit conversion from ReceiveMessage[Message] toArrowAssoc[ReceiveMessage[Message]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def apply[Domain](handler: (Message) => Domain)(implicit dsl: Dsl[ReceiveMessage[Message], Domain, Message]): Domain
- Definition Classes
- Keyword
- Annotations
- @inline()
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def cpsApply[Domain](handler: (Message) => Domain)(implicit dsl: Dsl[ReceiveMessage[Message], Domain, Message]): Domain
- Definition Classes
- Keyword
- Annotations
- @inline()
- def ensuring(cond: (ReceiveMessage[Message]) => Boolean, msg: => Any): ReceiveMessage[Message]
- Implicit
- This member is added by an implicit conversion from ReceiveMessage[Message] toEnsuring[ReceiveMessage[Message]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: (ReceiveMessage[Message]) => Boolean): ReceiveMessage[Message]
- Implicit
- This member is added by an implicit conversion from ReceiveMessage[Message] toEnsuring[ReceiveMessage[Message]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean, msg: => Any): ReceiveMessage[Message]
- Implicit
- This member is added by an implicit conversion from ReceiveMessage[Message] toEnsuring[ReceiveMessage[Message]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- def ensuring(cond: Boolean): ReceiveMessage[Message]
- Implicit
- This member is added by an implicit conversion from ReceiveMessage[Message] toEnsuring[ReceiveMessage[Message]] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from ReceiveMessage[Message] toStringFormat[ReceiveMessage[Message]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- 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() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def productElementNames: Iterator[String]
- Definition Classes
- Product
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def unary_!: Message
- Definition Classes
- Keyword
- Annotations
- @shift() @compileTimeOnly("This method requires the compiler plugin: `addCompilerPlugin(\"com.thoughtworks.dsl\" %% \"compilerplugins-bangnotation\" % \"latest.release\")` and must only be called inside a code block annotated as `@reset`.")
- 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
- Deprecated
(Since version ) see corresponding Javadoc for more information.
- def →[B](y: B): (ReceiveMessage[Message], B)
- Implicit
- This member is added by an implicit conversion from ReceiveMessage[Message] toArrowAssoc[ReceiveMessage[Message]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.