Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actor's parent address #42

Open
Scony opened this issue Apr 19, 2017 · 4 comments
Open

Actor's parent address #42

Scony opened this issue Apr 19, 2017 · 4 comments

Comments

@Scony
Copy link

Scony commented Apr 19, 2017

I did some research (docs + google + lib reverse engineering) but I can’t find an answer for my question: is there any way for the child actor to get its parent address ? At the moment I must introduce a “Setup” or “Initialize” message in my code and utilize “sender”. But I guess there is some other way.

If there is no such feature, then my question is: why ? Previously I’ve been using Akka for Scala, and there is such possibility, so I assume it makes some sense from the actors model POV.

I will appreciate any answer .

@kquick
Copy link
Member

kquick commented Apr 19, 2017

That information is currently not exposed to the Actor itself, so your methodology of a message send from the parent is the recommended Thespian solution.

There is no fundamental reason for not providing this to the Actor other than simplicity. Most of the scenarios I've encountered to-date where the child needed to know the parent's address also involved passing some information from the parent to the child, so an initial message was needed anyhow.

@Scony
Copy link
Author

Scony commented Apr 19, 2017

Well, thank you for explanations.

I think you may consider adding such feature in the future. It may be very beneficial for the users. The present situation may be a bit confusing, because a child actor actually has no link to its parent as long as it doesn't receive any message form it. Also - from the child actor perspective - how do you know that the "Setup" message came from the parent ? Or even any message ? Without knowing your parent's address you don't know. The only solution that comes to my mind is to ensure that the first message always comes from the parent. Then you can store it and use it. But during writing tests one may accidentally forgot about this constraint and cause some harm. Also, this seem to put pressure on the thespian lib client as he is forced to write extra code.

@kquick
Copy link
Member

kquick commented Apr 20, 2017 via email

@andreikee
Copy link

I am agree, this feature will be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants