Please take a look at the below code and explain the difference between different ways of spawning an actor in akka actor system. which is efficient and why?
Class Parent extends Actor{
def createChild(props:Props,name:String)={
context.actorOf(props,name)
}
val type1=createChild(ChildActor.props,"Child")
lazy val type2=createChild(ChildActor.props,"Child")
def receive={
case x =>
type1 !"someMessage"
type2 ! "someMessage"
createChild(ChildActor.props,"Child") ! "someMessage
}
}
Thanks in advance