public TestManagerActor(ActorProps actorToBeTested)
        {
            this.actorToBeTested = Context.ActorOf(actorToBeTested);

            Receive<Message>(m => this.actorToBeTested.Tell(m));
            Receive<Complete>(m => Context.Parent.Tell(Kill.Instance));
        }
        /// <summary>
        /// Adds a child to the <see cref="CompositeActor"/>.
        /// </summary>
        /// <param name="actorProps"><see cref="Props"/> used to create the child.</param>
        /// <param name="name">Child name. Must be unique.</param>
        /// <returns><see cref="IActorRef"/> corresponding to the newly created child.</returns>
        /// <exception cref="ArgumentException">A child with the same name was already added.</exception>
        public CompositeActorProps AddChild(string name, ActorProps actorProps)
        {
            if (children.ContainsKey(name))
                throw new ArgumentException(string.Format("A child with name \"{0}\" was already added.", name), "name");

            children[name] = actorProps;

            return this;
        }
示例#3
0
        protected ActorProps(ActorProps props)
            : base(props.Type, props.SupervisorStrategy, props.Arguments)
        {
            if (!props.completed)
                throw new InvalidOperationException("Props initialization must be completed before cloning it.");

            this.completed = props.completed;
            this.inboundTransitions = props.inboundTransitions;
            this.outboundTransitions = props.outboundTransitions;
        }
 /// <summary>
 /// Adds a child to the <see cref="CompositeActor"/>.
 /// </summary>
 /// <param name="actorProps"><see cref="Props"/> used to create the child.</param>
 /// <param name="name">Child name. Must be unique.</param>
 internal void AddChild(ActorProps actorProps, string name)
 {
     var child = Context.ActorOf(actorProps, name);
     children[name] = child.Path;
 }
示例#5
0
        public void RegisterProcess(string name, ActorProps props)
        {
            var process = actorSystem.ActorOf(props.WithRouter(new ConsistentHashingPool(5)), name);

            processes[name] = process.Path;
        }
示例#6
0
 public static IActorRef CreateTestActor(this ActorSystem system, ActorProps actorToBeTested)
 {
     return system.ActorOf(ActorProps.Create<TestManagerActor>(actorToBeTested));
 }