Example #1
0
        /// <summary>
        /// Creates a new Actor and returns its ActorRef. The new Actor
        /// is of type actorType and will be instantiated with the class
        /// arguments found in props.
        /// </summary>
        /// <param name="actorType">the Type of the Actor to create</param>
        /// <param name="props">the Props to pass as class arguments</param>
        /// <param name="name">the string name of the actor</param>
        /// <param name="suspended"></param>
        /// <param name="channel"></param>
        /// <param name="fiber"></param>
        /// <returns>ActorRef</returns>
        private ActorRef ActorOf(
            Type actorType,
            Props props,
            string name,
            bool suspended,
            IChannel <Delivery> channel,
            IFiber fiber)
        {
            // TODO: Full creations should be asynchronous

            ValidateName(name);

            Actor actor = ActorCreator.CreateWith(actorType, props);

            ActorContext context =
                new ActorContext(
                    System,
                    actorType,
                    actor,
                    name,
                    props,
                    this.Self,
                    this.Path,
                    suspended,
                    channel,
                    fiber);

            Children.Add(context.Self);

            context.System = System;

            return(context.Self);
        }
Example #2
0
        /// <summary>
        /// Creates a new Actor and returns its ActorRef. The new Actor
        /// is of type actorType and will be instantiated with the class
        /// arguments found in props.
        /// </summary>
        /// <param name="actorType">the Type of the Actor to create</param>
        /// <param name="props">the Props to pass as class arguments</param>
        /// <param name="name">the string name of the actor</param>
        /// <returns>ActorRef</returns>
        public ActorRef ActorOf(Type actorType, Props props, string name)
        {
            // TODO: Full creations should be asynchronous

            ValidateName(name);

            Actor actor = ActorCreator.CreateWith(actorType, props);

            ActorContext context =
                new ActorContext(
                    System,
                    actorType,
                    actor,
                    name,
                    props,
                    this.Self,
                    this.Path);

            Children.Add(context.Self);

            context.System = System;

            return(context.Self);
        }