miho
miho

Reputation: 12085

Akka supervisor on stop of subordinate

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?

Upvotes: 0

Views: 67

Answers (1)

Johny T Koshy
Johny T Koshy

Reputation: 3887

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.

Upvotes: 2

Related Questions