/// <summary> /// Creates child actor for actor hierarchy testing /// </summary> /// <param name="createChild"> /// Child creation instructions /// </param> public void CreateChild(CreateChildMessage createChild) { var returnType = typeof(TestActorRef<>).MakeGenericType(createChild.Props.Type); var actorRef = Activator.CreateInstance( returnType, Context.System, createChild.Props, this.Self, createChild.Name); this.Sender.Tell(actorRef); }
/// <summary> /// Creates child actor for actor hierarchy testing /// </summary> /// <param name="createChild"> /// Child creation instructions /// </param> public void CreateChild(CreateChildMessage createChild) { var returnType = typeof(TestActorRef <>).MakeGenericType(createChild.Props.Type); var actorRef = Activator.CreateInstance( returnType, Context.System, createChild.Props, this.Self, createChild.Name); this.Sender.Tell(actorRef); }
private void OnReceiveCreateChildMessage(CreateChildMessage m) { // Create a ChildActor and it will be within the context of this parent actor Context.ActorOf(Props.Create(() => new ChildActor()), m.Name); }