Is there a way to send a direct message to a child actor of a Shard Actor, without going through the parent? I’m forced to send a message to the parent (EntityRef of the shard actor) which then forwards it to the child ?
You could, for example if it responds with its
context.self actor ref in a response to a message, or registers itself to the receptionist with a service key.
It is important to understand though that since the sharded actor lifecycle is managed by sharding and may be rebalanced or passivated so that the child is stopped and an actor reference directly to it will lead to dead letters.
Sending all messages to it through sharding will make sure the entity is restarted and messages, as far as possible, are re-routed if the entity is rebalanced to another cluster node.