This ReceiveMessagePartial keyword can be used in the akka.actor.Actor.Receive domain,
to receive the next message that is a Message.
The above code creates an actor to echo any string messages.
import com.yang_bo.dsl.keywords.akka.actor.ReceiveMessagePartial
import akka.actor._
def echoActor = new Actor {
def receive: Receive = {
while (true) {
val lastMessage = !ReceiveMessagePartial[String]
sender() ! lastMessage
}
thrownew Exception("Unreachable code!")
}
}
val pinger = system.actorOf(Props(echoActor))
pinger ! "hello world"
expectMsg("hello world")
All messages that are not the class of Message will not be handled.
This member is added by an implicit conversion from ReceiveMessagePartial[Message] to
any2stringadd[ReceiveMessagePartial[Message]] performed by method any2stringadd in scala.Predef.
This member is added by an implicit conversion from ReceiveMessagePartial[Message] to
ArrowAssoc[ReceiveMessagePartial[Message]] performed by method ArrowAssoc in scala.Predef.
This member is added by an implicit conversion from ReceiveMessagePartial[Message] to
Ensuring[ReceiveMessagePartial[Message]] performed by method Ensuring in scala.Predef.
This member is added by an implicit conversion from ReceiveMessagePartial[Message] to
Ensuring[ReceiveMessagePartial[Message]] performed by method Ensuring in scala.Predef.
This member is added by an implicit conversion from ReceiveMessagePartial[Message] to
Ensuring[ReceiveMessagePartial[Message]] performed by method Ensuring in scala.Predef.
This member is added by an implicit conversion from ReceiveMessagePartial[Message] to
Ensuring[ReceiveMessagePartial[Message]] performed by method Ensuring in scala.Predef.
This member is added by an implicit conversion from ReceiveMessagePartial[Message] to
StringFormat[ReceiveMessagePartial[Message]] performed by method StringFormat in scala.Predef.
This member is added by an implicit conversion from ReceiveMessagePartial[Message] to
ArrowAssoc[ReceiveMessagePartial[Message]] performed by method ArrowAssoc in scala.Predef.
A keyword to receive next message of an Akka actor.
Author:
杨博 (Yang Bo)
This ReceiveMessagePartial keyword can be used in the akka.actor.Actor.Receive domain, to receive the next message that is a Message. The above code creates an actor to echo any string messages.
All messages that are not the class of Message will not be handled.
domains.akka.actor.typed.typedReceiveMessagePartialDsl for usage in the typed actor domains.