Is there a reverse to IndirectActorProducer?

(Todor Boev) #1

I use IndirectActorProducer with Props to delegate the creation of the actor object to an external party.
Conversely I need to perform cleanup logic when the actor is disposed of by Akka.
I would not like to do this in the actor’s lifecycle methods (e.g. postStop()), because I do not want to pollute the actor code with infrastructure plumbing.
I am not sure if/how I can do it with a trait the actor can extend for example because I am not sure how to pass the references to the infrastructure I have to call to dispose the actor.