Skip to content

Reference from child to supervisor #213

Answered by slawlor
dcadenas asked this question in Q&A
Discussion options

You must be logged in to vote

It does not give a strongly typed message channel to the child from the parent. If you want that I'd suggest passing it as part of the child actor's startup arguments.

There's too many generics at play, etc, in order to pass an ActorRef downstream into the non-strongly-typed logic at the core of ractor.

Unfortunately there isn't a smarter way today. Unless you manually "link" the actors together (so start the child unlinked, then link it after the fact) however the risks any work specified in post_start causing an error on the child and not be captured in the supervision flow as a potential race condition. By using spawn_linked, it's guaranteed that an error in pre_start will immediately …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dcadenas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants