Akka supervisor on stop of subordinate

89 views Asked by At

I'm using Akka 2.3.11 and SupervisorStrategies for handling failures in the actors subordinates. However in addition to the supervision strategy I want to catch all "stops" (planned stops and such one which occur because of exceptions) of a subordinate to persist some information in the backends database.

How can I catch all stops of the subordinates in the supervisor?

1

There are 1 answers

0
Johny T Koshy On BEST ANSWER

You can watch any actor and receive a Terminated message whenever that actor stops.

To watch an actor user:

context.watch(actorRef)

and receive Terminated message just like any other message and do whatever backend jobs that you need there.