The documentation
at http://doc.akka.io/docs/akka/snapshot/scala/cluster-usage.html doesn't
state that the PoisonPill performs differently than the behaviour listed
here
<http://doc.akka.io/docs/akka/snapshot/scala/routing.html#note-router-terminated-children-scala>,
so I assumed if I used a Broadcast message like below:
...
def vectorizeUserContent(streamer : ActorRef, libraryId : Long,
senderNode : ActorRef) = {
val userVectorizationReducers =
context.actorOf(FromConfig.props(Props[ UserVectorizationReducer ]),
"userVectorizationReducer")
context.actorOf(Props(new Actor {
override def preStart() {
context.watch(userVectorizationReducers)
streamer ! StartStream(libraryId)
}
override def receive = {
case dto : RawUserContentDto => userVectorizationReducers !
ConsistentHashableEnvelope(dto, dto.userId)
case EndOfStream() => {
userVectorizationReducers !
Broadcast(ReturnUserVectors(senderNode))
*userVectorizationReducers ! Broadcast(PoisonPill)*
}
case Terminated(userVectorizationReducers) => {
senderNode ! VectorizationCompleted()
self ! PoisonPill
}
}
}), "userContentVectorizerDirector")
}
...
where userVectorizationReducers is a remotely deployed pool of routees, the
Terminated message would be retrieved due to the watch made in preStart().
Unfortunately, the broadcasted PoisonPill does not trigger the expected
Terminated message I'm waiting for. If I however replace the broadcast in
my 'EndOfStream()' case with userVectorizationReducers ! PoisonPill, then
the Terminated message is returned. In both cases, all routees are
terminated individually (evident through some logging in the postStop()
method of the UserVectorizationReducer actor). I'm assuming the PoisonPill
is actually being routed to the routees where they can be gracefully
shutdown after all other messages have been processed, but I could be wrong.
Can I get clarification if this is in fact true and it is the recommended
way to shutdown a pool of cluster routees?
Cheers,
Sean
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.