I have some actors that kill themselves when idle or other system constraints require them to. The actors that have ActorRef
s to them are watching for their Terminated(ref)
, but there is a race condition of messages meant for the actors being sent before the termination arrives and I'm trying to figure out a clean way to handle that.
I was considering subscribing to DeadLetter
and using that to signal the sender that their ref
is stale and that they need to get or spawn a new target ActorRef
.
However, in Akka Typed, I cannot find any way to get to dead letters other than using the untyped co-existence path, so I figure I'm likely approaching this wrong.
Is there a better pattern for dealing dead downstream refs and re-directing messages to a new downstream refs, short of requiring some kind of ack hand-shake for every message?