Exemplo n.º 1
0
 Unit Tell(object message, ProcessId sender, string inbox, Message.Type type) =>
 ProcessHub.Connections.Find(Id).Iter(c => c.Tell(
                                          new ClientMessageDTO
 {
     tag          = inbox,
     type         = type.ToString().ToLower(),
     connectionId = (string)Id,
     content      = message,
     contentType  = message.GetType().AssemblyQualifiedName,
     sender       = sender.Path,
     replyTo      = sender.Path,
     requestId    = 0,
     sessionId    = SessionId.Map(x => x.ToString()).IfNone(""),
     to           = ProcessId.Skip(3).Path
 }));
Exemplo n.º 2
0
 public Option <ActorItem> GetLocalActor(ProcessId pid)
 {
     if (pid.System != SystemName)
     {
         return(None);
     }
     return(GetLocalActor(rootItem, pid.Skip(1), pid));
 }
Exemplo n.º 3
0
        public ActorDispatchJS(ProcessId pid, Option <SessionId> sessionId, bool transactionalIO)
        {
            Id = ClientConnectionId.New(pid.Skip(2).Take(1).Name.Value);
            ProcessHub.Connections.Find(Id).IfNone(() => { throw new ClientDisconnectedException(Id); });

            ProcessId            = pid;
            SessionId            = sessionId;
            this.transactionalIO = transactionalIO;
        }
Exemplo n.º 4
0
        internal Option <Func <ProcessId, IEnumerable <ProcessId> > > GetProcessSelector(ProcessId pid)
        {
            if (pid.Count() < 3)
            {
                throw new InvalidProcessIdException("Invalid role Process ID");
            }
            var type = pid.Skip(1).Take(1).Name;

            return(Dispatch.getFunc(type));
        }
Exemplo n.º 5
0
        Option <ActorItem> GetLocalActor(ActorItem current, ProcessId walk, ProcessId pid)
        {
            if (current.Actor.Id == pid)
            {
                return(current);
            }
            var name = walk.Take(1).Name;

            return(from child in current.Actor.Children.Find(walk.Take(1).Name.Value)
                   from result in GetLocalActor(child, walk.Skip(1), pid)
                   select result);
        }
Exemplo n.º 6
0
 internal IActorDispatch GetPluginDispatcher(ProcessId pid) =>
 GetProcessSelector(pid)
 .Map(selector => new ActorDispatchGroup(selector(pid.Skip(2)), Settings.TransactionalIO) as IActorDispatch)
 .IfNone(() => new ActorDispatchNotExist(pid));
Exemplo n.º 7
0
 internal IEnumerable <ProcessId> ResolveProcessIdSelection(ProcessId pid) =>
 GetProcessSelector(pid)
 .Map(selector => selector(pid.Skip(2)))
 .IfNone(() => new ProcessId[0]);
Exemplo n.º 8
0
 public static IEnumerable <ProcessId> NodeIds(ProcessId leaf) =>
 Nodes(leaf).Values.Map(node => ProcessId.Top[node.NodeName].Append(leaf.Skip(1)));