Could you please explain to me what is the difference between
context.actorOf
and
system.actorOf
?
Answer to this can be easily found in the Akka documentation:
An actor system is typically started by creating actors beneath the guardian actor using the ActorSystem.actorOf method and then using ActorContext.actorOf from within the created actors to spawn the actor tree.
System.actorOf
will be children of the guardian actor.context.actorOf
will be children of the context itself - i.e. the actor which invokes the method.As a more general suggestion, make sure you thoroughly explore Akka docs when in search of similar answers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With