private static void PrintChildrenPath(ActorRefWithCell actor)
 {
     foreach (var item in actor.Children)
     {
         Console.WriteLine(item.Path);
         PrintChildrenPath(item as ActorRefWithCell);
     }
 }
Пример #2
0
        private static IEnumerable <string> PrintChildrenPath(ActorRefWithCell actor)
        {
            foreach (var item in actor.Children)
            {
                yield return(item.Path.ToString());

                foreach (var s in PrintChildrenPath(item as ActorRefWithCell))
                {
                    yield return(s);
                }
                ;
            }
        }
Пример #3
0
        /// <summary>
        /// Gets the description of the actor's children
        /// </summary>
        /// <param name="actorRef">The actor ref</param>
        /// <returns>The description of the children</returns>
        private Node[] GetChildren(ActorRefWithCell actorRef)
        {
            if (!actorRef.Children.Any())
            {
                return(Enumerable.Empty <Node>().ToArray());
            }

            var nodes = actorRef.Children.OfType <ActorRefWithCell>().Select(
                child =>
            {
                var node = new Node
                {
                    Name    = child.Path.Name,
                    Address =
                        $"{this.clusterNodeAddress.ToString()}{child.Path.ToStringWithoutAddress()}",
                    ParentAddress =
                        $"{this.clusterNodeAddress.ToString()}{child.Parent?.Path.ToStringWithoutAddress()}",
                    ActorType      = child.Underlying.Props.TypeName,
                    Children       = this.GetChildren(child),
                    QueueSize      = child.Underlying.NumberOfMessages,
                    CurrentMessage =
                        (child.Underlying as ActorCell)?.CurrentMessage?.GetType().FullName,
                    DispatcherId   = (child.Underlying as ActorCell)?.Dispatcher.Id,
                    DispatcherType =
                        (child.Underlying as ActorCell)?.Dispatcher.GetType().Name,
                };
                var cell = child.Underlying as ActorCell;
                if (cell != null)
                {
                    node.ActorType = ActorProperty.GetMethod.Invoke(cell, new object[0])?.GetType().FullName;
                }

                return(node);
            }).OrderBy(n => n.Name).ToArray();

            return(nodes);
        }