class MyActor(dep1: D1, dep2: D2, dep3: D3) {def act() {dep1 ! Request1dep2 ! Request2dep3 ! Request3react {case Reply1(r1) =>react {case Reply2(r2) =>react {case Reply3(r3) =>//main loop here
class MyActor(dep1: ActorRef, dep2: ActorRef , dep3: ActorRef) {override def preStart() {(dep1 ? Request1) zip (dep2 ? Request2) zip (dep3 ? Request3) pipeTo self}def receive = { case ((Reply1(r1), Reply2(r2)), Reply3(r3)) => become(looping(r1, r2, r3)) }def looping(r1: R1, r2: R2, r3: R3): Receive = { //main loop }}
Was answered this week on the ML, see archives.
Thx.
V
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/d_VotR8vLhkJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.
Does this help?
http://doc.akka.io/api/akka/2.0/akka/actor/Stash.html
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/d_VotR8vLhkJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.
object state {var maybeR1 = none[R1]var maybeR2 = none[R2]var maybeR3 = none[R3]def invokeIfReady(fn: (R1, R2, R3) => Unit) = (maybeR1 <***> (maybeR2, maybeR3) foreach fn}def tryLoop() {val transition = (r1: R1, r2: R2, r3: R3) => { unstashAll(); context become looping(r1, r2, r3) }state invokeIfReady transition}def receive {case Reply(r1) => state.maybeR1 = some(r1); tryLoop()case Reply(r2) => state.maybeR2 = some(r2); tryLoop()case Reply(r3) => state.maybeR3 = some(r3); tryLoop()case other => stash()}def looping(r1: R1, r2: R2, r3: R3) : Receive = { /* main loop here */ }