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;
        }
Пример #4
0
 /// <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));
 }