Monitoring normal actor exit / shutdown

68 views
Skip to first unread message

oschulz

unread,
Jun 30, 2010, 10:26:29 AM6/30/10
to Akka User List
Is it possible for an actor to react to a regular shutdown (not a
crash)
of another actor (like trapExit and receiving an Exit('normal) /
exit(normal)
message with Scala actors / Erlang)?

Cheers,

Oliver

Jonas Bonér

unread,
Jun 30, 2010, 10:35:08 AM6/30/10
to akka...@googlegroups.com
You can register a listener on ActorRegistry which will give send you a message for each actor that is started and stopped. 

From the docs (http://doc.akkasource.org/actors)

If you want to know when a new Actor is added or to or removed from the registry, you can use the subscription API. You can register an Actor that should be notified when an event happens in the ActorRegistry:

def addRegistrationListener(listener: ActorRef)
def removeRegistrationListener(listener: ActorRef)

The messages sent to this Actor are:

case class ActorRegistered(actor: ActorRef)
case class ActorUnregistered(actor: ActorRef)

So your listener Actor needs to be able to handle these two messages. 

Does it help? 
> --
> You received this message because you are subscribed to the Google Groups "Akka User List" group.
> 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.
>
>



--
Jonas Bonér

work:   http://jayway.com
code:   http://akkasource.com
blog:    http://jonasboner.com
twitter: @jboner





Reply all
Reply to author
Forward
0 new messages