Reputation: 2073
In need to create an Akka2 actor (derived from UntypedActor) as a child of an existing actor (also derived from UntypedActor). The only reference I have to the parent actor is an ActorRef. Is there any way to do this? I'd like to call the parent's UntypedActorContext.actorOf() method, but don't know how to get a reference to it using the Akka API. Is there a better way of accomplishing my goal?
Upvotes: 1
Views: 109
Reputation: 26597
You cannot force someone to conceive against their will. Your actor needs to receive a message to which it responds by creating a new actor and send you the ref to that actor.
Upvotes: 3
Reputation: 24403
Can you change the code of the parent actor? You could for example add a handler for a message of type Props
in your parent and create the child there. It is not possible to get the context outside of the actor class.
Upvotes: 2