IActorDispatch GetDispatcher(ProcessId pid, ActorItem current, ProcessId orig) { if (pid == ProcessId.Top) { if (current.Inbox is ILocalActorInbox) { return(new ActorDispatchLocal(current, Settings.TransactionalIO)); } else { return(cluster.Match( Some: c => new ActorDispatchRemote(Ping, orig, c, ActorContext.SessionId, Settings.TransactionalIO) as IActorDispatch, None: () => new ActorDispatchNotExist(orig))); } } else { var child = pid.HeadName().Value; return(current.Actor.Children.Find(child, Some: process => GetDispatcher(pid.Tail(), process, orig), None: () => new ActorDispatchNotExist(orig))); } }